Commit dad52d83 authored by wwccw0591's avatar wwccw0591

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

parents df64ad77 5f058bd6
...@@ -625,9 +625,12 @@ class OrderConfirmUtil { ...@@ -625,9 +625,12 @@ class OrderConfirmUtil {
} }
} }
} }
if($updateSaleNumFlag){
$storeTopSaleGoodsDao = \DAO\Goods\StoreTopSaleGoodsModel::getInstance();
$storeTopSaleGoodsDao->pushChangeSaleStore($storeId);
}
} }
$this->updateGoodsStorageToDBAndCache($goodsCommonIds,$goodsIds,$blIds,$goodsNewList,$op,$updateSaleNumFlag); $this->updateGoodsStorageToDBAndCache($goodsCommonIds,$goodsIds,$blIds,$goodsNewList,$op,$updateSaleNumFlag);
//$goodsStorages = $goodsDao->getOnlineStorageGoodsByGoodsCommonIds(array_keys($goodsCommonIds));
return true; return true;
} }
...@@ -657,6 +660,7 @@ class OrderConfirmUtil { ...@@ -657,6 +660,7 @@ class OrderConfirmUtil {
$goodsCommonDao = \DAO\GoodsCommonModel::getInstance($dbName); $goodsCommonDao = \DAO\GoodsCommonModel::getInstance($dbName);
$resultGoodsCommon = $goodsCommonDao->updateGoodsStorage($goodsCommons,$op,$updateSaleNumFlag); $resultGoodsCommon = $goodsCommonDao->updateGoodsStorage($goodsCommons,$op,$updateSaleNumFlag);
$resultGoods = $goodsDao->updateGoodsStorage($goodsNewList,$op); $resultGoods = $goodsDao->updateGoodsStorage($goodsNewList,$op);
if(!($resultGoodsCommon&&$resultGoods)){ if(!($resultGoodsCommon&&$resultGoods)){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::goodsStorageToDBFailedForOrder); \Error\ErrorModel::throwException(\Error\CodeConfigModel::goodsStorageToDBFailedForOrder);
} }
......
...@@ -281,6 +281,7 @@ class CouponServiceModel extends \Business\AbstractModel{ ...@@ -281,6 +281,7 @@ class CouponServiceModel extends \Business\AbstractModel{
$couponList = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array($where['storeId'],$memberId),\Our\ApiConst::oneHour,array($where['storeId']."_".$memberId)); $couponList = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array($where['storeId'],$memberId),\Our\ApiConst::oneHour,array($where['storeId']."_".$memberId));
if($couponList){ if($couponList){
$couponList = array_values($couponList); $couponList = array_values($couponList);
$couponList =$this->sortCouponList($couponList);
}else{ }else{
$couponList = array(); $couponList = array();
} }
...@@ -294,6 +295,7 @@ class CouponServiceModel extends \Business\AbstractModel{ ...@@ -294,6 +295,7 @@ class CouponServiceModel extends \Business\AbstractModel{
$couponList = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array($where['storeId'],$memberId,\Our\ApiConst::one),\Our\ApiConst::oneHour,array($where['storeId']."_".$memberId)); $couponList = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array($where['storeId'],$memberId,\Our\ApiConst::one),\Our\ApiConst::oneHour,array($where['storeId']."_".$memberId));
if($couponList){ if($couponList){
$couponList = array_values($couponList); $couponList = array_values($couponList);
$couponList = $this->sortCouponList($couponList);
if(count($couponList)>=\Our\ApiConst::defaultCouponTitleLength){ if(count($couponList)>=\Our\ApiConst::defaultCouponTitleLength){
$couponTitleArray= array_slice($couponList,0,\Our\ApiConst::defaultCouponTitleLength); $couponTitleArray= array_slice($couponList,0,\Our\ApiConst::defaultCouponTitleLength);
}else{ }else{
...@@ -388,6 +390,14 @@ class CouponServiceModel extends \Business\AbstractModel{ ...@@ -388,6 +390,14 @@ class CouponServiceModel extends \Business\AbstractModel{
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array(),array($storeId)); \Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array(),array($storeId));
} }
public function sortCouponList($couponList){
foreach($couponList as $key => $coupon){
$isGet[$key] = $coupon['isGet'];
}
array_multisort($isGet, SORT_ASC, $couponList);
return $couponList;
}
/** /**
* 类实例 * 类实例
*/ */
......
...@@ -40,6 +40,9 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{ ...@@ -40,6 +40,9 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{
public function getList($where){ public function getList($where){
$this->setDb(); $this->setDb();
if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where);
}
return $this->db->select('goods_commonid as goodsCommonId,goods_name as goodsName,goods_image as goodsImage,goods_score as evalScore')->from($this->_tableName)->where($where)->fetchAll(); return $this->db->select('goods_commonid as goodsCommonId,goods_name as goodsName,goods_image as goodsImage,goods_score as evalScore')->from($this->_tableName)->where($where)->fetchAll();
} }
...@@ -61,7 +64,7 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{ ...@@ -61,7 +64,7 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{
$singleStoreGoods = $this->getList(array('store_id'=>$storeId)); $singleStoreGoods = $this->getList(array('store_id'=>$storeId));
if($singleStoreGoods){ if($singleStoreGoods){
$ordesGoods = empty($orderGoods)?$singleStoreGoods:array_merge($orderGoods,$singleStoreGoods); $ordesGoods = empty($orderGoods)?$singleStoreGoods:array_merge($orderGoods,$singleStoreGoods);
$storeTopSaleGoodsRedis->update($storeId,$singleStoreGoods); $storeTopSaleGoodsRedis->update($storeId,$singleStoreGoods,\Our\ApiConst::oneDaySecond);
} }
} }
} }
......
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