Commit e09c9756 authored by wwccw0591's avatar wwccw0591

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into ccw

parents 2d4e6e65 85138953
......@@ -61,7 +61,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$maxPrice = intval($param['maxPrice']);
$goodsSort = intval($param['goodsSort']);
$attrValue = $param['attrValue'];
list($where,$order,$attrStr) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort);
list($where,$order,$attrStr,$saleSort) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort);
$keyword && $where[] = "goods_name like '%{$keyword}%'";
$commonDAO = \DAO\GoodsCommonModel::getInstance();
$couponDao = \DAO\Coupon\CouponModel::getInstance();
......@@ -80,11 +80,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where[] = 'goods_commonid in('.trim($ids,',').')';
}
}
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
if($activities){
$activities = array_keys($activities);
$field = 'han_goods_common.goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_price,goods_marketprice AS goodsMarketPrice,goods_image AS goodsImage,IFNULL(discount_price,goods_price) AS goodsPrice';
if($storeId > 0){
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),\Our\ApiConst::oneDaySecond,array($storeId));
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),$ttl,array($storeId));
}else{
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),\Our\ApiConst::oneMinute,array(\Our\ApiConst::zero));
}
......@@ -94,7 +95,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$field = 'han_goods_common.'.$field;
}
if($storeId > 0 ){
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),\Our\ApiConst::oneDaySecond,array($storeId));
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),$ttl,array($storeId));
}else{
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),\Our\ApiConst::oneMinute,array(\Our\ApiConst::zero));
}
......@@ -183,14 +184,17 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}elseif ($maxPrice){
$where[] = "goods_price <= {$maxPrice}";
}
$saleSort = false;
$order = [];
switch ($goodsSort){
case 1:
$order[] = ['sale_num','DESC'];
$order[] = ['eval_score','DESC'];
$saleSort = true;
break;
case 2:
$order[] = ['sale_num','DESC'];
$saleSort = true;
break;
case 3:
$order[] = ['goods_selltime','DESC'];
......@@ -206,7 +210,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$order[] = ['eval_score','DESC'];
break;
}
return array($where,$order,$attrStr);
return array($where,$order,$attrStr,$saleSort);
}
/**
* 获取商品列表
......@@ -244,20 +248,21 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$thirdClassId && $where[] = "gc_id_3 = {$thirdClassId}";
$storeThirdClassId && $where[] = "goods_class_t_id = {$storeThirdClassId}";
$keyword && $where[] = "goods_name like '%{$keyword}%'";
list($_where,$order,$attrStr) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort);
list($_where,$order,$attrStr,$saleSort) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort);
$where = array_merge($where,$_where);
$commonDAO = \DAO\GoodsCommonModel::getInstance();
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
if(!$activities){
$field = 'goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_price as goodsPrice,goods_marketprice AS goodsMarketPrice,goods_image AS goodsImage,goods_commend AS isRecoment,goods_new AS isNew,goods_hot AS isHot';
if($attrStr){
$field = 'han_goods_common.'.$field;
}
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),\Our\ApiConst::oneDaySecond,array($storeId));
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),$ttl,array($storeId));
}else{
$activities = array_keys($activities);
$field = 'han_goods_common.goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_price,goods_marketprice AS goodsMarketPrice,goods_image AS goodsImage,goods_commend AS isRecoment,goods_new AS isNew,goods_hot AS isHot,IFNULL(discount_price,han_goods_common.goods_price) AS goodsPrice';
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),\Our\ApiConst::oneDaySecond,array($storeId));
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),$ttl,array($storeId));
}
$goods = [];
if(is_array($list) && !empty($list)){
......@@ -1105,14 +1110,27 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/
public function storeOnlineGoodsClass(){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
$plusFlag = false;
$minusFlag = false;
for($i=0;$i<2000;$i++){
$goodsClassStr = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::plus);
$goodsClass = unserialize($goodsClassStr);
$this->checkExistOnlineGoodsClass($goodsClass);
if($goodsClassStr&&$plusFlag==false){
$goodsClass = unserialize($goodsClassStr);
$this->checkExistOnlineGoodsClass($goodsClass);
}else{
$plusFlag=true;
}
$goodsClassStrMinus = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::minus);
$goodsClassMinus = unserialize($goodsClassStrMinus);
$this->checkRemoveOnlineGoodsClass($goodsClassMinus);
if($goodsClassStrMinus&&$minusFlag==false){
$goodsClassMinus = unserialize($goodsClassStrMinus);
$this->checkRemoveOnlineGoodsClass($goodsClassMinus);
}else{
$minusFlag = true;
}
if($plusFlag&&$minusFlag){
break;
}
}
}
......
......@@ -82,7 +82,7 @@ class cliStoreOnlineGoodsClass extends basecli
}
}
$oCli = new cliShopkeeperIndex(TRUE);
$oCli = new cliStoreOnlineGoodsClass(TRUE);
EXIT;
?>
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