Commit 75b902b5 authored by liuyuzhen's avatar liuyuzhen

会员

parent 84900118
...@@ -1057,7 +1057,24 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1057,7 +1057,24 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
} }
public function checkRemoveOnlineGoodsClass($goodsClass){ public function checkRemoveOnlineGoodsClass($goodsClass){
$goodsCommonDao = \DAO\GoodsCommonModel::getInstance();
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
if($goodsClass){
$gcFrom = $goodsClass['gc_from'];
$where['gc_id_1'] = $goodsClass['gc_id_1'];
$where['gc_id_2'] = $goodsClass['gc_id_2'];
$where['gc_id_3'] = $goodsClass['gc_id_3'];
$where['store_id'] = $goodsClass['store_id'];
$where['goods_state'] = \Our\ApiConst::onlineGoodsState;
$where['goods_verify'] = \Our\ApiConst::onlineGoodsVerify;
if($gcFrom==\Our\ApiConst::one){
$where['goods_class_t_id'] = $goodsClass['gc_id_3'];
}
$tempOne = $goodsCommonDao->getOne($where,'goods_commonid');
if(!$tempOne){
$storeOnlineGoodsClassDao->del($goodsClass);
}
}
} }
private static $_instance = null; private static $_instance = null;
......
...@@ -44,6 +44,16 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{ ...@@ -44,6 +44,16 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
return $result ; return $result ;
} }
public function del($where){
$this->setDb(\Our\DbNameConst::masterDBConnectName);
$temp = $this->findByWhere($where);
$result = $this->db->delete($this->_tableName)->where($where)->execute();
return $result;
}
public function getList($where,$field = \Our\NameConst::allField){ public function getList($where,$field = \Our\NameConst::allField){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll(); $result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
......
...@@ -30,6 +30,10 @@ class GoodsCommonModel extends \DAO\AbstractModel { ...@@ -30,6 +30,10 @@ class GoodsCommonModel extends \DAO\AbstractModel {
return $this->db->select($field)->from($this->_tableName)->where(array('goods_commonid'=>$goodsCommonId))->fetchOne(); return $this->db->select($field)->from($this->_tableName)->where(array('goods_commonid'=>$goodsCommonId))->fetchOne();
} }
public function getOne($where,$field = \Our\NameConst::allField){
$this->setDb($this->dbName);
return $this->db->select($field)->from($this->_tableName)->where($where)->fetchOne();
}
public function getGoodsSaleNumFromCache($goodsCommonId){ public function getGoodsSaleNumFromCache($goodsCommonId){
$goodsCommonRedis = \Redis\Db4\GoodsCommonRedisModel::getInstance(); $goodsCommonRedis = \Redis\Db4\GoodsCommonRedisModel::getInstance();
$onlineGoodsCommonSaleNumKey = \Our\NameConst::onlineGoodsCommonSaleNumPrefix; $onlineGoodsCommonSaleNumKey = \Our\NameConst::onlineGoodsCommonSaleNumPrefix;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment