Commit 215bedb5 authored by wwccw0591's avatar wwccw0591

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

parents 46a4b12c b5bb2af4
...@@ -41,6 +41,8 @@ class OrderConfirmUtil { ...@@ -41,6 +41,8 @@ class OrderConfirmUtil {
private $storeMemos = array(); private $storeMemos = array();
private $cartCacheDeleteFlag = false;
public function addOrder($data,$memberId,$currentAddress){ public function addOrder($data,$memberId,$currentAddress){
$storeCartData = $this->checkPostData($data,$memberId,$currentAddress); $storeCartData = $this->checkPostData($data,$memberId,$currentAddress);
//return $storeCartData; //return $storeCartData;
...@@ -89,6 +91,7 @@ class OrderConfirmUtil { ...@@ -89,6 +91,7 @@ class OrderConfirmUtil {
$this->storeIds= array_keys($cartList['list']); $this->storeIds= array_keys($cartList['list']);
$this->storeMemos[$this->postData['storeId']] = isset($this->postData['storeMemo'])?$this->postData['storeMemo']:\Our\NameConst::emptyString; $this->storeMemos[$this->postData['storeId']] = isset($this->postData['storeMemo'])?$this->postData['storeMemo']:\Our\NameConst::emptyString;
}else{ }else{
$this->cartCacheDeleteFlag = true;
foreach($this->postData as $temp){ foreach($this->postData as $temp){
$this->checkOneStoreData($temp); $this->checkOneStoreData($temp);
if(!$temp['cartIds']){ if(!$temp['cartIds']){
...@@ -513,10 +516,23 @@ class OrderConfirmUtil { ...@@ -513,10 +516,23 @@ class OrderConfirmUtil {
} }
public function opCacheInfo(){ public function opCacheInfo(){
if($this->cartCacheDeleteFlag){
$this->delCartCache();
}
$this->deleteCacheInfo(); $this->deleteCacheInfo();
$this->pushSaleGoods(); $this->pushSaleGoods();
} }
public function delCartCache(){
$cartRedis = \Redis\Db7\CartRedisModel::getInstance();
$memberCartKey = \Our\NameConst::memberCartStorePrefix.$this->memberId;
$cartRedis->tableDel($memberCartKey);
foreach($this->storeIds as $tempStoreId){
$memberStoreCartsKey = \Our\NameConst::memberStoreCartsPrefix.$this->memberId.\Our\NameConst::underline.$tempStoreId;
$cartRedis->tableDel($memberStoreCartsKey);
}
}
public function pushSaleGoods(){ public function pushSaleGoods(){
if($this->saleGoodsIds){ if($this->saleGoodsIds){
$saleGoodsDao = \DAO\SaleGoodsModel::getInstance(); $saleGoodsDao = \DAO\SaleGoodsModel::getInstance();
......
...@@ -118,6 +118,11 @@ class ArrayConst ...@@ -118,6 +118,11 @@ class ArrayConst
'href'=>'', 'href'=>'',
'price'=>0 'price'=>0
); );
const orderCloseAndCancel=array(
0,
-1
);
//确认收货按钮0为未操作过,1为操作过, //确认收货按钮0为未操作过,1为操作过,
const reachRemindButtons=array( const reachRemindButtons=array(
array( array(
......
...@@ -157,8 +157,8 @@ class AdvServiceModel extends \Business\AbstractModel{ ...@@ -157,8 +157,8 @@ class AdvServiceModel extends \Business\AbstractModel{
$advMobileSql = \Our\Common::format($advMobileSql,$where['storeId'],$position,\Our\ApiConst::one,\Our\ApiConst::one); $advMobileSql = \Our\Common::format($advMobileSql,$where['storeId'],$position,\Our\ApiConst::one,\Our\ApiConst::one);
$advMobileField = 'href,src,end_time,start_time'; $advMobileField = 'href,src,end_time,start_time';
$advMobileList = \Our\RedisHelper::cachedFunction(\Redis\Db9\AdvMobileRedisModel::getInstance(),array(&$advMobileDao, 'getList'),array($advMobileSql,$advMobileField,array('adv_id'=>\Our\NameConst::desc)),\Our\ApiConst::oneHour,array($where['storeId'])); $advMobileList = \Our\RedisHelper::cachedFunction(\Redis\Db9\AdvMobileRedisModel::getInstance(),array(&$advMobileDao, 'getList'),array($advMobileSql,$advMobileField,array('adv_id'=>\Our\NameConst::desc)),\Our\ApiConst::oneHour,array($where['storeId']));
$advs = array();
if($advMobileList){ if($advMobileList){
$advs = array();
foreach($advMobileList as $adv){ foreach($advMobileList as $adv){
if($adv['start_time']<=TIMESTAMP&&$adv['end_time']>TIMESTAMP){ if($adv['start_time']<=TIMESTAMP&&$adv['end_time']>TIMESTAMP){
$temp = array(); $temp = array();
...@@ -167,7 +167,7 @@ class AdvServiceModel extends \Business\AbstractModel{ ...@@ -167,7 +167,7 @@ class AdvServiceModel extends \Business\AbstractModel{
$advs[] = $temp; $advs[] = $temp;
} }
} }
}else{ }/*else{
$storeAdvPositionDao = \DAO\Adv\StoreAdvPositionModel::getInstance(); $storeAdvPositionDao = \DAO\Adv\StoreAdvPositionModel::getInstance();
$storeAdvPosition = \Our\RedisHelper::cachedFunction(\Redis\Db9\StoreAdvPositionRedisModel::getInstance(),array(&$storeAdvPositionDao, 'find'),array(array('ap_id'=>$position)),\Our\ApiConst::oneHour,array($position)); $storeAdvPosition = \Our\RedisHelper::cachedFunction(\Redis\Db9\StoreAdvPositionRedisModel::getInstance(),array(&$storeAdvPositionDao, 'find'),array(array('ap_id'=>$position)),\Our\ApiConst::oneHour,array($position));
if($storeAdvPosition&&$storeAdvPosition['default_content']){ if($storeAdvPosition&&$storeAdvPosition['default_content']){
...@@ -176,7 +176,7 @@ class AdvServiceModel extends \Business\AbstractModel{ ...@@ -176,7 +176,7 @@ class AdvServiceModel extends \Business\AbstractModel{
}else{ }else{
$advs = array(); $advs = array();
} }
} }*/
return $advs; return $advs;
} }
......
...@@ -270,7 +270,8 @@ class CouponServiceModel extends \Business\AbstractModel{ ...@@ -270,7 +270,8 @@ class CouponServiceModel extends \Business\AbstractModel{
public function getStorePromotionCouponTitles($where){ public function getStorePromotionCouponTitles($where){
$this->validCouponStore($where); $this->validCouponStore($where);
$couponDao = \DAO\Coupon\CouponModel::getInstance(); $couponDao = \DAO\Coupon\CouponModel::getInstance();
$couponTitles = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponDao, 'getStorePromotionCouponList'),array($where['storeId']),\Our\ApiConst::oneHour,array($where['storeId'])); $couponTitles = $couponDao->getStorePromotionCouponList($where['storeId']);
//\Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponDao, 'getStorePromotionCouponList'),array($where['storeId']),\Our\ApiConst::oneHour,array($where['storeId']));
return $couponTitles?$couponTitles:array(); return $couponTitles?$couponTitles:array();
} }
......
...@@ -237,7 +237,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -237,7 +237,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$firstClassId = intval($param['firstClassId']); $firstClassId = intval($param['firstClassId']);
$secondClassId = intval($param['secondClassId']); $secondClassId = intval($param['secondClassId']);
$thirdClassId = intval($param['thirdClassId']); $thirdClassId = intval($param['thirdClassId']);
$keyword = trim($param['keyword']); $keyword = (string)trim($param['keyword']);
$minPrice = intval($param['minPrice']); $minPrice = intval($param['minPrice']);
$maxPrice = intval($param['maxPrice']); $maxPrice = intval($param['maxPrice']);
$goodsSort = intval($param['goodsSort']); $goodsSort = intval($param['goodsSort']);
...@@ -247,7 +247,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -247,7 +247,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$secondClassId && $where[] = "gc_id_2 = {$secondClassId}"; $secondClassId && $where[] = "gc_id_2 = {$secondClassId}";
$thirdClassId && $where[] = "gc_id_3 = {$thirdClassId}"; $thirdClassId && $where[] = "gc_id_3 = {$thirdClassId}";
$storeThirdClassId && $where[] = "goods_class_t_id = {$storeThirdClassId}"; $storeThirdClassId && $where[] = "goods_class_t_id = {$storeThirdClassId}";
$keyword && $where[] = "goods_name like '%{$keyword}%'"; $keyword !== '' && $where[] = "goods_name like '%{$keyword}%'";
list($_where,$order,$attrStr,$saleSort) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort); list($_where,$order,$attrStr,$saleSort) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort);
$where = array_merge($where,$_where); $where = array_merge($where,$_where);
...@@ -803,7 +803,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -803,7 +803,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$thirdClassId = (int)($param['thirdClassId']); $thirdClassId = (int)($param['thirdClassId']);
$storeThirdClassId = (int)($param['storeThirdClassId']); $storeThirdClassId = (int)($param['storeThirdClassId']);
$couponId = (int)$param['couponId']; $couponId = (int)$param['couponId'];
$keyword = trim($param['keyword']); $keyword = (string)trim($param['keyword']);
$couponDao = \DAO\Coupon\CouponModel::getInstance(); $couponDao = \DAO\Coupon\CouponModel::getInstance();
$couponId && $coupon = $couponDao->findById($couponId); $couponId && $coupon = $couponDao->findById($couponId);
...@@ -832,7 +832,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -832,7 +832,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$productData = []; $productData = [];
$attributeRedis = \Redis\Db4\GoodsAttributeRedisModel::getInstance(); $attributeRedis = \Redis\Db4\GoodsAttributeRedisModel::getInstance();
$attrbuteDAO = \DAO\GoodsAttributeModel::getInstance(); $attrbuteDAO = \DAO\GoodsAttributeModel::getInstance();
if(!empty($keyword)){ if($keyword !== ''){
// if($where){ // if($where){
// $where = implode(' AND ',$where); // $where = implode(' AND ',$where);
// } // }
......
...@@ -604,7 +604,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -604,7 +604,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
/*foreach($blIds as $val){ /*foreach($blIds as $val){
$group[]['blId']=$val; $group[]['blId']=$val;
}*/ }*/
$pBundlingList = $this->getPBundlingListByBlIds($blIds,$dbName,true); $pBundlingList = $this->getPBundlingListByBlIds($blIds,$dbName,array(),true);
} }
$goodsCommonIds = $cartListData['goodsCommonIds']; $goodsCommonIds = $cartListData['goodsCommonIds'];
$goodsIds = $cartListData['goodsIds']; $goodsIds = $cartListData['goodsIds'];
......
...@@ -104,7 +104,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -104,7 +104,7 @@ class OrderServiceModel extends \Business\AbstractModel
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$goodsDao = \DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName); $goodsDao = \DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName);
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName); //$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
if ($keyWord !== false) { if ($keyWord !== false) {
$where = $this->getOrderIndexWhere($memberId, $keyWord, $pageIndex, $pageSize); $where = $this->getOrderIndexWhere($memberId, $keyWord, $pageIndex, $pageSize);
if($where===false){ if($where===false){
...@@ -128,7 +128,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -128,7 +128,7 @@ class OrderServiceModel extends \Business\AbstractModel
} }
//获得订单列表 //获得订单列表
$orders = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'getList'), array($where, $this->orderField, $pageIndex, $pageSize, $order = array('add_time' => 'desc')), \Our\ApiConst::oneDaySecond, array($memberId)); $orders = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'getList'), array($where, $this->orderField, $pageIndex, $pageSize, $order = array('gmt_update' => 'desc')), \Our\ApiConst::oneDaySecond, array($memberId));
if (!empty($orders['list'])) { if (!empty($orders['list'])) {
$orderIds = array_column($orders['list'], 'orderId'); $orderIds = array_column($orders['list'], 'orderId');
//获得订单商品列表 //获得订单商品列表
...@@ -561,6 +561,13 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -561,6 +561,13 @@ class OrderServiceModel extends \Business\AbstractModel
if(!$update || !$res){ if(!$update || !$res){
echo '订单:'.$order['orderId'].'没取消成功!'; echo '订单:'.$order['orderId'].'没取消成功!';
} }
//$orderGoodsUpdateData['refund_state_name']='退款成功';
$orderGoodsUpdateData['is_refund']=1;
$whereOrderGoods['order_id']=$order['orderId'];
$orderGoodsUpdateRes=$orderGoodsDao->update($whereOrderGoods,$orderGoodsUpdateData);
if(!$orderGoodsUpdateRes){
echo '订单:'.$order['order_id'].'is_refund'.'没更新成功';
}
$orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId'],true); $orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId'],true);
} }
$orderIds = array_column($orders, 'orderId'); $orderIds = array_column($orders, 'orderId');
...@@ -730,7 +737,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -730,7 +737,7 @@ class OrderServiceModel extends \Business\AbstractModel
if (empty($diliverymanIds)) { if (empty($diliverymanIds)) {
ErrorModel::throwException(CodeConfigModel::commonError); ErrorModel::throwException(CodeConfigModel::commonError);
} }
$qmDeliveryLogList = $qmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanIds, $type, $pageIndex, $pageSize,$memberId); $qmDeliveryLogList = $qmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanIds, $type, $pageIndex, $pageSize,array('get_time' => 'desc'),$memberId);
$orderIds = array_column($qmDeliveryLogList['list'], 'orderId'); $orderIds = array_column($qmDeliveryLogList['list'], 'orderId');
// echo json_encode($orderIds);exit; // echo json_encode($orderIds);exit;
// $where['delete_state'] = ApiConst::undeleteOrder; // $where['delete_state'] = ApiConst::undeleteOrder;
...@@ -765,7 +772,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -765,7 +772,7 @@ class OrderServiceModel extends \Business\AbstractModel
$delivery['mobPhone'] = $delivery['mobPhone'] ? $delivery['mobPhone'] : ''; $delivery['mobPhone'] = $delivery['mobPhone'] ? $delivery['mobPhone'] : '';
$delivery['finishTime'] = $delivery['finishTime'] ? $delivery['finishTime'] : ApiConst::zero; $delivery['finishTime'] = $delivery['finishTime'] ? $delivery['finishTime'] : ApiConst::zero;
$delivery['orderGoods'] = !empty($goodsDao->convert($orderMerge[$value['orderId']]['orderGoods']))?$goodsDao->convert($orderMerge[$value['orderId']]['orderGoods']):array(); $delivery['orderGoods'] = !empty($goodsDao->convert($orderMerge[$value['orderId']]['orderGoods']))?$goodsDao->convert($orderMerge[$value['orderId']]['orderGoods']):array();
$delivery['street'] = $delivery['reciverInfo']['address'] . $delivery['reciverInfo']['street']; $delivery['street'] = $delivery['reciverInfo']['address'];
$delivery['lng'] = $delivery['reciverInfo']['lng'] ? $delivery['reciverInfo']['lng'] : 0.0; $delivery['lng'] = $delivery['reciverInfo']['lng'] ? $delivery['reciverInfo']['lng'] : 0.0;
$delivery['lat'] = $delivery['reciverInfo']['lat'] ? $delivery['reciverInfo']['lat'] : 0.0; $delivery['lat'] = $delivery['reciverInfo']['lat'] ? $delivery['reciverInfo']['lat'] : 0.0;
$delivery['subAddress'] = isset($delivery['reciverInfo']['sub_address']) ? $delivery['reciverInfo']['sub_address'] : ''; $delivery['subAddress'] = isset($delivery['reciverInfo']['sub_address']) ? $delivery['reciverInfo']['sub_address'] : '';
...@@ -833,6 +840,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -833,6 +840,7 @@ class OrderServiceModel extends \Business\AbstractModel
if($delivery['deliveryState']==ApiConst::deliveryStateWait||$delivery['deliveryState']==ApiConst::deliveryStateWaitTen){ if($delivery['deliveryState']==ApiConst::deliveryStateWait||$delivery['deliveryState']==ApiConst::deliveryStateWaitTen){
$delivery['deliveryState']=ApiConst::deliveryStateWait; $delivery['deliveryState']=ApiConst::deliveryStateWait;
} }
// $reciverInfo['sub_address']
$returnData = array( $returnData = array(
'orderId' => $this->order['orderId'], 'orderId' => $this->order['orderId'],
'storeName' => $this->order['storeName'], 'storeName' => $this->order['storeName'],
...@@ -845,10 +853,10 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -845,10 +853,10 @@ class OrderServiceModel extends \Business\AbstractModel
'getTime' => $delivery['getTime'], 'getTime' => $delivery['getTime'],
'reciverName' => $this->orderCommon['reciverName'], 'reciverName' => $this->orderCommon['reciverName'],
'mobPhone' => $reciverInfo['mob_phone'], 'mobPhone' => $reciverInfo['mob_phone'],
'street' => $reciverInfo['street'], 'street' => $reciverInfo['address'],
'lng' => isset($reciverInfo['lng']) ? $reciverInfo['lng'] : ApiConst::zero, 'lng' => isset($reciverInfo['lng']) ? $reciverInfo['lng'] : ApiConst::zero,
'lat' => isset($reciverInfo['lat']) ? $reciverInfo['lat'] : ApiConst::zero, 'lat' => isset($reciverInfo['lat']) ? $reciverInfo['lat'] : ApiConst::zero,
'subAddress' => isset($reciverInfo['sub_address']) ? $reciverInfo['sub_address'] : '', 'subAddress' => isset($reciverInfo['sub_address'])?$reciverInfo['sub_address']:'',
'orderGoods' => $orderGoods, 'orderGoods' => $orderGoods,
'shippingFee' => $this->order['shippingFee'], 'shippingFee' => $this->order['shippingFee'],
...@@ -871,7 +879,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -871,7 +879,7 @@ class OrderServiceModel extends \Business\AbstractModel
$push = Push::getInstance(); $push = Push::getInstance();
$push->reacheRemind($order['buyerId'], $order['orderId'], $order['orderSn']); $push->reacheRemind($order['buyerId'], $order['orderId'], $order['orderSn']);
} }
$orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId'], $order['storeId'],true); $orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId'], $order['storeId'],true,true,true,$memberid);
$qmDeliverymanLogDao->deleteOrderCache($memberid, $id); $qmDeliverymanLogDao->deleteOrderCache($memberid, $id);
return $updateResult; return $updateResult;
} else { } else {
......
...@@ -491,7 +491,6 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -491,7 +491,6 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$this->taskIndex = PageConst::taskPageBegin; $this->taskIndex = PageConst::taskPageBegin;
$this->taskSize = PageConst::taskPageSize; $this->taskSize = PageConst::taskPageSize;
do { do {
$addDatas = array();
$storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize); $storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize);
$storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false; $storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false;
if($storeMemberStatisticData){ if($storeMemberStatisticData){
...@@ -506,7 +505,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -506,7 +505,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
if(!empty($ordersCount) && !empty($refundLists)){ if(!empty($ordersCount) && !empty($refundLists)){
foreach($ordersCount as &$order){ foreach($ordersCount as &$order){
foreach($refundLists as $refund){ foreach($refundLists as $refund){
if($order['buyerId']==$refund['buyerId'] and $order['storeId']==$refund['storeId']){ if($order['buyerId']==$refund['buyerId'] && $order['storeId']==$refund['storeId']){
$order['orderTotal']=$order['orderTotal']-$refund['refundTotal']; $order['orderTotal']=$order['orderTotal']-$refund['refundTotal'];
} }
} }
......
...@@ -553,6 +553,9 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -553,6 +553,9 @@ class AddressServiceModel extends \Business\AbstractModel {
if(!($address['citycode'])){ if(!($address['citycode'])){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyCityCodeForSave); \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyCityCodeForSave);
} }
if(intval($address['citycode'])<=0){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongCityCode);
}
if(!($address['lng']&&$address['lat'])){ if(!($address['lng']&&$address['lat'])){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::chooseAddressFormMap); \Error\ErrorModel::throwException(\Error\CodeConfigModel::chooseAddressFormMap);
} }
......
...@@ -281,10 +281,10 @@ class MemberCenterServiceModel extends \Business\AbstractModel ...@@ -281,10 +281,10 @@ class MemberCenterServiceModel extends \Business\AbstractModel
//删除缓存 //删除缓存
if(is_array($ids) && count($ids) <= 20){ if(is_array($ids) && count($ids) <= 20){
foreach ($ids as $v){ foreach ($ids as $v){
\Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array('*',array('goods_commonid'=>$v,'member_id'=>$memberId)),array($memberId)); \Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array('*',array('member_id'=>$memberId,'goods_commonid'=>$v)),array($memberId));
} }
}elseif (!is_array($ids)){ }elseif (!is_array($ids)){
\Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array('*',array('goods_commonid'=>$ids,'member_id'=>$memberId)),array($memberId)); \Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array('*',array('member_id'=>$memberId,'goods_commonid'=>$ids)),array($memberId));
}else{ }else{
\Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array(),array($memberId)); \Our\RedisHelper::delCachedFunction(\Redis\Db4\FavoritesRedisModel::getInstance(),array(&$favoritesInstance, 'getOne'),array(),array($memberId));
} }
......
...@@ -152,9 +152,9 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -152,9 +152,9 @@ class CouponModel extends \DAO\AbstractModel {
$field = $this->availStoreIndexField; $field = $this->availStoreIndexField;
$where = ' and store_id ='.$storeId.' and type<>1'; $where = ' and store_id ='.$storeId.' and type<>1';
$this->setDb($this->dbName); $this->setDb($this->dbName);
$coupons = $this->getOnlineCouponList($where,$field); //$coupons = $this->getOnlineCouponList($where,$field);
//$coupons = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getOnlineCouponList'),array($where,$field),\Our\ApiConst::oneHour); $coupons = \Our\RedisHelper::cachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getOnlineCouponList'),array($where,$field),\Our\ApiConst::oneHour,array($storeId));
//$coupons = $this->getOnlineCouponList($where,$field); //$coupons = $this->getOnlineCouponList($where,$field);
if(!$coupons){ if(!$coupons){
...@@ -169,6 +169,9 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -169,6 +169,9 @@ class CouponModel extends \DAO\AbstractModel {
$storeCouponGoodsClassDao = \DAO\GoodsClass\StoreCouponGoodsClassModel::getInstance(); $storeCouponGoodsClassDao = \DAO\GoodsClass\StoreCouponGoodsClassModel::getInstance();
$result = array(); $result = array();
foreach($coupons as $coupon){ foreach($coupons as $coupon){
if(!($coupon['start_time']<=TIMESTAMP&&$coupon['end_time']>TIMESTAMP)){
continue;
}
if($coupon['type']==\Our\ApiConst::goodsClassCoupon){ //指定品类优惠券,需要判断该优惠券对应分类店铺是否在经营 if($coupon['type']==\Our\ApiConst::goodsClassCoupon){ //指定品类优惠券,需要判断该优惠券对应分类店铺是否在经营
if($storeClassIds){ if($storeClassIds){
$gcIds = $storeCouponGoodsClassDao->getGoodsClassIdsByCouponId($coupon['id']); $gcIds = $storeCouponGoodsClassDao->getGoodsClassIdsByCouponId($coupon['id']);
...@@ -489,6 +492,27 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -489,6 +492,27 @@ class CouponModel extends \DAO\AbstractModel {
} }
} }
/**
* 删除店铺优惠券缓存
* @param $storeId 店铺ID
* @param bool $couponId 指定优惠券ID
* @throws \Our\Exception
*/
public function deleteCouponCache($storeId,$couponId=false){
$couponService = \Business\Coupon\CouponServiceModel::getInstance();
$memberCouponDao = \DAO\Coupon\MemberCouponModel::getInstance();
if($couponId){
\Our\RedisHelper::delCachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(), array(&$memberCouponDao, 'getList'),array(),array($couponId));
}
//\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStorePromotionCouponList'),array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponService, 'getStoreCouponsById'),array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getOnlineCouponList'),array(),array($storeId));
return true;
}
public function getDb() public function getDb()
{ {
return $this->db; return $this->db;
...@@ -512,22 +536,6 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -512,22 +536,6 @@ class CouponModel extends \DAO\AbstractModel {
} }
/**
* 删除店铺优惠券缓存
* @param $storeId 店铺ID
* @param bool $couponId 指定优惠券ID
* @throws \Our\Exception
*/
public function deleteCouponCache($storeId,$couponId=false){
$couponService = \Business\Coupon\CouponServiceModel::getInstance();
$memberCouponDao = \DAO\Coupon\MemberCouponModel::getInstance();
if($couponId){
\Our\RedisHelper::delCachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(), array(&$memberCouponDao, 'getList'),array(),array($couponId));
}
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStorePromotionCouponList'),array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponService, 'getStoreCouponsById'),array(),array($storeId));
return true;
}
} }
...@@ -149,6 +149,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel { ...@@ -149,6 +149,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
break; break;
} }
} }
$expriseStartTime += $deliveryIntval*\Our\ApiConst::oneMinute;
if($expriseStartTime<$todayEndTime){ if($expriseStartTime<$todayEndTime){
$expriseData = $this->getTomorrowFormulaList($expriseStartTime,$todayEndTime,$deliveryIntval*\Our\ApiConst::oneMinute,$minFee,$myCurrentStartTime); $expriseData = $this->getTomorrowFormulaList($expriseStartTime,$todayEndTime,$deliveryIntval*\Our\ApiConst::oneMinute,$minFee,$myCurrentStartTime);
if($expriseData){ if($expriseData){
......
...@@ -386,6 +386,20 @@ class OrderModel extends \DAO\AbstractModel ...@@ -386,6 +386,20 @@ class OrderModel extends \DAO\AbstractModel
} }
} }
public function getFieldByWhere($where,$filed){
$this->setDb($this->dbName);
if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where);
}
$res=$this->db->from($this->_tableName)->select($filed)->where($where)->fetchAll();
if($res){
$fie=array_column($res,$filed);
return $fie;
}else{
return [];
}
}
public function getSumAmountCountByMemberAndStoreId($storeIds,$memberIds) public function getSumAmountCountByMemberAndStoreId($storeIds,$memberIds)
{ {
$this->setDb($this->dbName); $this->setDb($this->dbName);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace DAO\Order; namespace DAO\Order;
use Our\ApiConst; use Our\ApiConst;
use Our\ArrayConst;
use Our\Common; use Our\Common;
use Our\DbNameConst; use Our\DbNameConst;
use Our\ImageConst; use Our\ImageConst;
...@@ -65,8 +66,15 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -65,8 +66,15 @@ class OrderGoodsModel extends \DAO\AbstractModel {
} }
public function getOrderGoodsCountByStoreId($storeId){ public function getOrderGoodsCountByStoreId($storeId){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$where['store_id']=$storeId; $where['store_id']=$storeId;
$where['is_refund']=array('neq',ApiConst::refundSuccess); $where['is_refund']=array('neq',ApiConst::refundSuccess);
$whereOrder['store_id']=array('eq',$storeId);
$whereOrder['order_state']=array('in',ArrayConst::orderCloseAndCancel);
$orderIds=$orderDao->getFieldByWhere($whereOrder,'order_id');
if($orderIds){
$where['order_id']=array('notin',$orderIds);
}
if(is_array($where)){ if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where); $where=$this->db->getSqlWhereByArray($where);
} }
...@@ -235,9 +243,17 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -235,9 +243,17 @@ class OrderGoodsModel extends \DAO\AbstractModel {
} }
public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){ public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$whereOrder['store_id']=array('in',$storeIds);
$whereOrder['buyer_id']=array('in',$memberIds);
$whereOrder['order_state']=array('in',ArrayConst::orderCloseAndCancel);
$orderIds=$orderDao->getFieldByWhere($whereOrder,'order_id');
$where['store_id']=array('in',$storeIds); $where['store_id']=array('in',$storeIds);
$where['buyer_id']=array('in',$memberIds); $where['buyer_id']=array('in',$memberIds);
$where['is_refund']=array('neq',ApiConst::refundSuccess); $where['is_refund']=array('neq',ApiConst::refundSuccess);
if($orderIds){
$where['order_id']=array('notin',$orderIds);
}
$where=$this->db->getSqlWhereByArray($where); $where=$this->db->getSqlWhereByArray($where);
$res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchAll(); $res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchAll();
return $res; return $res;
......
...@@ -435,7 +435,7 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -435,7 +435,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
public function getMemberStoreStaticsByGmtUpdate($gmtUpdate,$pageIndex,$pageSize){ public function getMemberStoreStaticsByGmtUpdate($gmtUpdate,$pageIndex,$pageSize){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} and refund_state={2}',$gmtUpdate,TIMESTAMP,ApiConst::refundStateComplete); $where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} and refund_state={2}',$gmtUpdate,TIMESTAMP,ApiConst::refundStateComplete);
$res=$this->lists($where,array('gmt_update'=>'asc'),$this->sumField,$pageIndex,$pageSize); $res=$this->lists($where,array('gmt_update'=>'asc'),$this->sumField,$pageIndex,$pageSize);
return $res['list']?$res:false; return $res['list']?$res:false;
} }
......
...@@ -367,6 +367,7 @@ class CodeConfigModel { ...@@ -367,6 +367,7 @@ class CodeConfigModel {
const emptyDistrictId = 140020; const emptyDistrictId = 140020;
const emptyAddressAndName = 140021; const emptyAddressAndName = 140021;
const wrongAddressTagType = 140022; const wrongAddressTagType = 140022;
const wrongCityCode = 140023;
//消息,推送等 //消息,推送等
const removeMessage=150001; const removeMessage=150001;
...@@ -599,6 +600,7 @@ class CodeConfigModel { ...@@ -599,6 +600,7 @@ class CodeConfigModel {
self::emptyDistrictId => '找不到对应区', self::emptyDistrictId => '找不到对应区',
self::emptyAddressAndName => '地址和具体街道不能为空', self::emptyAddressAndName => '地址和具体街道不能为空',
self::wrongAddressTagType => '地址标签传输错误', self::wrongAddressTagType => '地址标签传输错误',
self::wrongCityCode => '城市码格式错误',
self::emptyLatLng => '经纬度不能为空', self::emptyLatLng => '经纬度不能为空',
self::emptyCityCode => '高德地图城市编码不能为空', self::emptyCityCode => '高德地图城市编码不能为空',
......
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