Commit e8ac36be authored by zhz's avatar zhz

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

parents e055121c 567a582c
...@@ -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;
}
/** /**
* 类实例 * 类实例
*/ */
......
...@@ -107,10 +107,14 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -107,10 +107,14 @@ class OrderServiceModel extends \Business\AbstractModel
$where = $this->getOrderIndexWhere($memberId, $keyWord, $pageIndex, $pageSize); $where = $this->getOrderIndexWhere($memberId, $keyWord, $pageIndex, $pageSize);
} else { } else {
$where['delete_state'] = ApiConst::undeleteOrder; $where['delete_state'] = ApiConst::undeleteOrder;
$where['buyer_id'] = $memberId; $where['buyer_id'] = $memberId;
//$where['lock_state'] = ApiConst::zero; //$where['lock_state'] = ApiConst::zero;
if ($orderState != false) { if ($orderState != false) {
if($orderState==ApiConst::orderStateComplete){
$where['evaluation_state']=ApiConst::waitEvaluation;
}
$where['order_state'] = array('in', explode(',', $orderState)); $where['order_state'] = array('in', explode(',', $orderState));
} }
} }
......
...@@ -313,7 +313,7 @@ class GoodsModel extends \DAO\AbstractModel { ...@@ -313,7 +313,7 @@ class GoodsModel extends \DAO\AbstractModel {
$updateAllSql = $baseSql; $updateAllSql = $baseSql;
$dataIds = array(); $dataIds = array();
for ($i = 0; $i < count($datas); $i++) { for ($i = 0; $i < count($datas); $i++) {
$updateSql = \Our\Common::format(" WHEN {0} THEN goods_storage{2}{1},", $datas[$i]['goodsId'], $datas[$i]['goodsNum'],\Our\ArrayConst::ops[$op]); $updateSql = \Our\Common::format(" WHEN {0} THEN goods_storage{2}{1} ", $datas[$i]['goodsId'], $datas[$i]['goodsNum'],\Our\ArrayConst::ops[$op]);
$dataIds[] = $datas[$i]['goodsId']; $dataIds[] = $datas[$i]['goodsId'];
$updateAllSql .= $updateSql; $updateAllSql .= $updateSql;
if ($i % 1000 == 0 && $i != 0) { if ($i % 1000 == 0 && $i != 0) {
......
...@@ -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();
} }
...@@ -58,10 +61,10 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{ ...@@ -58,10 +61,10 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{
if ($storeGoods) { if ($storeGoods) {
$orderGoods = empty($orderGoods)?$storeGoods:array_merge($orderGoods, $storeGoods); $orderGoods = empty($orderGoods)?$storeGoods:array_merge($orderGoods, $storeGoods);
}else{ }else{
$singleStoreGoods = $this->getList(array('store_id'=>$storeId)); $singleStoreGoods = $this->getList(array('store_id'=>$storeId,'goods_commonid'=>array('neq','')));
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);
} }
} }
} }
......
...@@ -223,9 +223,9 @@ class GoodsCommonModel extends \DAO\AbstractModel { ...@@ -223,9 +223,9 @@ class GoodsCommonModel extends \DAO\AbstractModel {
$saleNumSql = 'sale_num = case goods_commonid '; $saleNumSql = 'sale_num = case goods_commonid ';
} }
for ($i = 0; $i < count($datas); $i++) { for ($i = 0; $i < count($datas); $i++) {
$goodsCommonSql .= \Our\Common::format(" WHEN {0} THEN goods_storage{1}{2}, ", $datas[$i]['goodsCommonId'],\Our\ArrayConst::ops[$op], $datas[$i]['goodsNum']); $goodsCommonSql .= \Our\Common::format(" WHEN {0} THEN goods_storage{1}{2} ", $datas[$i]['goodsCommonId'],\Our\ArrayConst::ops[$op], $datas[$i]['goodsNum']);
if($updateSaleNumFlag){ if($updateSaleNumFlag){
$saleNumSql .= \Our\Common::format(" when {0} THEN sale_num {1}{2},", $datas[$i]['goodsCommonId'],$updateSaleNumOp, $datas[$i]['goodsNum']); $saleNumSql .= \Our\Common::format(" when {0} THEN sale_num {1}{2} ", $datas[$i]['goodsCommonId'],$updateSaleNumOp, $datas[$i]['goodsNum']);
} }
$dataIds[] = $datas[$i]['goodsCommonId']; $dataIds[] = $datas[$i]['goodsCommonId'];
if ($i % 1000 == 0 && $i != 0) { if ($i % 1000 == 0 && $i != 0) {
...@@ -248,7 +248,7 @@ class GoodsCommonModel extends \DAO\AbstractModel { ...@@ -248,7 +248,7 @@ class GoodsCommonModel extends \DAO\AbstractModel {
$dataIds = array(); $dataIds = array();
} }
} }
if ($updateAllSql != $baseSql) { if ($goodsCommonSql) {
$goodsCommonSql = trim($goodsCommonSql,',').' END '; $goodsCommonSql = trim($goodsCommonSql,',').' END ';
$updateAllSql .= $goodsCommonSql; $updateAllSql .= $goodsCommonSql;
if($updateSaleNumFlag){ if($updateSaleNumFlag){
......
...@@ -573,7 +573,7 @@ class OrderModel extends \DAO\AbstractModel ...@@ -573,7 +573,7 @@ class OrderModel extends \DAO\AbstractModel
} }
$diff = TIMESTAMP - $order['finnshedTime']; $diff = TIMESTAMP - $order['finnshedTime'];
if ($order['orderState'] == ApiConst::orderStateComplete && $diff < ApiConst::oneDaySecond) { if ($order['orderState'] == ApiConst::orderStateComplete && $diff < ApiConst::oneDaySecond) {
$refundStateName == '退货'; $refundStateName == DescribeConst::refundRetund;
} }
return $refundStateName; return $refundStateName;
...@@ -600,7 +600,11 @@ class OrderModel extends \DAO\AbstractModel ...@@ -600,7 +600,11 @@ class OrderModel extends \DAO\AbstractModel
$text = OrderConst::unpayMessage; $text = OrderConst::unpayMessage;
} }
if ($order['orderState'] == ApiConst::orderStateWaitConfirm && $order['paymentType'] != ApiConst::offlinePay && $order['paymentType'] != ApiConst::afterSendPay) { if ($order['orderState'] == ApiConst::orderStateWaitConfirm && $order['paymentType'] != ApiConst::offlinePay && $order['paymentType'] != ApiConst::afterSendPay) {
$text = OrderConst::payCancelMessage; if($order['orderState']==ApiConst::orderStateClose && $order['orderState']==ApiConst::orderStateCancel){
$test='';
}else{
$text = OrderConst::payCancelMessage;
}
} }
} }
//详情 //详情
......
...@@ -935,7 +935,7 @@ class LinkMySQLModel{ ...@@ -935,7 +935,7 @@ class LinkMySQLModel{
return false; return false;
} }
}else{ }else{
if (empty($array) || !$key ||( count($array) != 2)|| $array[1] === '' || $array[1] === null) { if (empty($array) || !$key ||( count($array) != 2)) {
return false; return false;
} }
} }
......
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