Commit b1879f3c authored by zhz's avatar zhz

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

parents 36904247 c671cdda
...@@ -36,7 +36,6 @@ class CartController extends \Our\Controller_AbstractApi{ ...@@ -36,7 +36,6 @@ class CartController extends \Our\Controller_AbstractApi{
$data['pageIndex'] = $pageIndex; $data['pageIndex'] = $pageIndex;
$data['pageSize'] = $pageSize; $data['pageSize'] = $pageSize;
$storeCartList = $cartService->getCart($data,$this->memberId); $storeCartList = $cartService->getCart($data,$this->memberId);
$pBundlingService = \Business\Goods\GroupSaleServiceModel::getInstance(); $pBundlingService = \Business\Goods\GroupSaleServiceModel::getInstance();
$sess=\Yaf\Session::getInstance(); $sess=\Yaf\Session::getInstance();
$currentAddress = $sess->get('currentAddress'); $currentAddress = $sess->get('currentAddress');
......
...@@ -41,5 +41,6 @@ class CouponController extends \Our\Controller_AbstractIndex{ ...@@ -41,5 +41,6 @@ class CouponController extends \Our\Controller_AbstractIndex{
$couponList = $couponService->getGoodsCoupons($data,$memberId); $couponList = $couponService->getGoodsCoupons($data,$memberId);
$this->success($couponList); $this->success($couponList);
} }
} }
...@@ -23,21 +23,21 @@ class HomeController extends \Our\Controller_AbstractIndex{ ...@@ -23,21 +23,21 @@ class HomeController extends \Our\Controller_AbstractIndex{
} }
$returnData['currentAddress'] = $currentAddress; $returnData['currentAddress'] = $currentAddress;
$currentAddress = $this->sess->get('currentAddress'); $data = $this->req[\Our\NameConst::data];
$requestAddress = \Business\User\AddressServiceModel::getInstance()->getRequestAddress($data,$currentAddress);
//获取首页推荐分类 //获取首页推荐分类
$resultClasses = $this->getPlatformGoodsClassAction(true); $resultClasses = $this->getPlatformGoodsClassAction($requestAddress);
if($resultClasses){ if($resultClasses){
$returnData['recommendClasses'] = $resultClasses; $returnData['recommendClasses'] = $resultClasses;
} }
//获取当前位置对应附近店铺 //获取当前位置对应附近店铺
$nearbyStores = $this->getNearbyStoresAction(true); $nearbyStores = $this->getNearbyStoresAction($requestAddress);
$returnData['nearbyStores'] = $nearbyStores; $returnData['nearbyStores'] = $nearbyStores;
//获取附近店铺对应的商品 //获取附近店铺对应的商品
$recommendGoods = $this->getIndexHotSalesGoodsAction(true); $recommendGoods = $this->getIndexHotSalesGoodsAction($requestAddress);
$returnData['recommendGoods'] = $recommendGoods; $returnData['recommendGoods'] = $recommendGoods;
...@@ -46,6 +46,8 @@ class HomeController extends \Our\Controller_AbstractIndex{ ...@@ -46,6 +46,8 @@ class HomeController extends \Our\Controller_AbstractIndex{
$this->success($returnData); $this->success($returnData);
} }
/** /**
* 设置当前地址 * 设置当前地址
* @param bool $flag * @param bool $flag
...@@ -67,11 +69,14 @@ class HomeController extends \Our\Controller_AbstractIndex{ ...@@ -67,11 +69,14 @@ class HomeController extends \Our\Controller_AbstractIndex{
* @param bool $flag * @param bool $flag
* @return array * @return array
*/ */
public function getIndexHotSalesGoodsAction($flag = false){ public function getIndexHotSalesGoodsAction($address = false){
$currentAddress = $this->sess->get('currentAddress'); $currentAddress = $this->sess->get('currentAddress');
if($address){
$currentAddress = $address ;
}
$goodsCommonService = \Business\Goods\GoodsCommonServiceModel::getInstance(); $goodsCommonService = \Business\Goods\GoodsCommonServiceModel::getInstance();
$recommendGoods = $goodsCommonService->getIndexHotSalesGoods($currentAddress); $recommendGoods = $goodsCommonService->getIndexHotSalesGoods($currentAddress);
if($flag){ if($address){
return $recommendGoods; return $recommendGoods;
} }
$this->success($recommendGoods); $this->success($recommendGoods);
...@@ -82,11 +87,14 @@ class HomeController extends \Our\Controller_AbstractIndex{ ...@@ -82,11 +87,14 @@ class HomeController extends \Our\Controller_AbstractIndex{
* @param bool $flag * @param bool $flag
* @return array * @return array
*/ */
public function getNearbyStoresAction($flag = false){ public function getNearbyStoresAction($address = false){
$currentAddress = $this->sess->get('currentAddress'); $currentAddress = $this->sess->get('currentAddress');
if($address){
$currentAddress = $address ;
}
$storesService = \Business\Store\StoreServiceModel::getInstance(); $storesService = \Business\Store\StoreServiceModel::getInstance();
$nearbyStores = $storesService->getNearbyStores($currentAddress); $nearbyStores = $storesService->getNearbyStores($currentAddress);
if($flag){ if($address){
return $nearbyStores; return $nearbyStores;
} }
$this->success($nearbyStores); $this->success($nearbyStores);
...@@ -98,11 +106,14 @@ class HomeController extends \Our\Controller_AbstractIndex{ ...@@ -98,11 +106,14 @@ class HomeController extends \Our\Controller_AbstractIndex{
* @param bool $flag * @param bool $flag
* @return array * @return array
*/ */
public function getPlatformGoodsClassAction($flag = false){ public function getPlatformGoodsClassAction($address = false){
$currentAddress = $this->sess->get('currentAddress'); $currentAddress = $this->sess->get('currentAddress');
if($address){
$currentAddress = $address ;
}
$goodsClassService = \Business\Goods\GoodsClassServiceModel::getInstance(); $goodsClassService = \Business\Goods\GoodsClassServiceModel::getInstance();
$resultClasses = $goodsClassService->getHomeIndexGoodsClasses($currentAddress); $resultClasses = $goodsClassService->getHomeIndexGoodsClasses($currentAddress);
if($flag){ if($address){
return $resultClasses; return $resultClasses;
} }
$this->success($resultClasses); $this->success($resultClasses);
......
...@@ -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();
} }
...@@ -376,22 +377,6 @@ class CouponServiceModel extends \Business\AbstractModel{ ...@@ -376,22 +377,6 @@ class CouponServiceModel extends \Business\AbstractModel{
return $couponList; return $couponList;
} }
/**
* 删除店铺优惠券缓存
* @param $storeId 店铺ID
* @param bool $couponId 指定优惠券ID
* @throws \Our\Exception
*/
public function deleteCouponCache($storeId,$couponId=false){
$couponDao = \DAO\Coupon\CouponModel::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(&$couponDao, 'getStorePromotionCouponList'),array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array(),array($storeId));
}
public function sortCouponList($couponList){ public function sortCouponList($couponList){
foreach($couponList as $key => $coupon){ foreach($couponList as $key => $coupon){
$isGet[$key] = $coupon['isGet']; $isGet[$key] = $coupon['isGet'];
......
...@@ -8,6 +8,8 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -8,6 +8,8 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
private $pBundingField = 'han_p_bundling.bl_id AS blId,bl_name AS name,bl_title,store_id,store_name,bl_state,bl_quota_starttime,bl_image,bl_storage,bl_discount_price AS discountPrice,bl_sum_price AS sumPrice,bl_quota_endtime AS endTime,image,is_transport,transport_id,snapshot_id,goods_freight,goods_free'; private $pBundingField = 'han_p_bundling.bl_id AS blId,bl_name AS name,bl_title,store_id,store_name,bl_state,bl_quota_starttime,bl_image,bl_storage,bl_discount_price AS discountPrice,bl_sum_price AS sumPrice,bl_quota_endtime AS endTime,image,is_transport,transport_id,snapshot_id,goods_freight,goods_free';
private $pBundingFieldWithDel = 'han_p_bundling.bl_id AS blId,bl_name AS name,bl_title,store_id,store_name,bl_state,bl_quota_starttime,bl_image,bl_storage,bl_discount_price AS discountPrice,bl_sum_price AS sumPrice,bl_quota_endtime AS endTime,image,is_transport,transport_id,snapshot_id,goods_freight,goods_free,is_del';
private $pBundingGoodsField = 'bl_count_price AS discountPrice,num,goods_id,bl_id'; private $pBundingGoodsField = 'bl_count_price AS discountPrice,num,goods_id,bl_id';
private $pBundingGoodsDetailField = 'goods_id,goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_image,goods_spec,goods_storage AS goodsStorage,goods_price AS goodsPrice,goods_state,goods_verify,is_del'; private $pBundingGoodsDetailField = 'goods_id,goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_image,goods_spec,goods_storage AS goodsStorage,goods_price AS goodsPrice,goods_state,goods_verify,is_del';
...@@ -116,7 +118,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -116,7 +118,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
}*/ }*/
//$pBundlingList = $this->getGroupListForCart($blIds); //$pBundlingList = $this->getGroupListForCart($blIds);
//var_dump($pBundlingList); //var_dump($pBundlingList);
$pBundlingList = $this->getPBundlingListByBlIds($blIds,\Our\DbNameConst::salveDBConnectName,true); $pBundlingList = $this->getPBundlingListByBlIds($blIds,\Our\DbNameConst::salveDBConnectName,array(),true,\Our\ApiConst::one);
$pBundlingList = $this->getResizeGroupSaleGoodsList($pBundlingList); $pBundlingList = $this->getResizeGroupSaleGoodsList($pBundlingList);
} }
$goodsCommonIds = $cartListData['goodsCommonIds']; $goodsCommonIds = $cartListData['goodsCommonIds'];
...@@ -150,7 +152,9 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -150,7 +152,9 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
if (!$pBundling) { if (!$pBundling) {
$tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline; $tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline;
} else if (!($pBundling['bl_state'] == \Our\ApiConst::one && ($pBundling['bl_quota_starttime'] < time() && $pBundling['endTime'] >= time()))||!$pBundling['goodsCountFlag']) { } else if(isset($pBundling['is_del'])&&$pBundling['is_del']==\Our\ApiConst::one){
$tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline;
}else if (!($pBundling['bl_state'] == \Our\ApiConst::one && ($pBundling['bl_quota_starttime'] < time() && $pBundling['endTime'] >= time()))||!$pBundling['goodsCountFlag']) {
$tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline; $tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline;
} else { } else {
if($pBundling['bl_storage']<=\Our\ApiConst::zero){ if($pBundling['bl_storage']<=\Our\ApiConst::zero){
...@@ -164,9 +168,11 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -164,9 +168,11 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
}else{ }else{
$tempObj['blChangeFlag'] = \Our\ApiConst::one; $tempObj['blChangeFlag'] = \Our\ApiConst::one;
} }
$tempPrice = \Goods\GoodsUtil::getInstance()->getRealPrice($pBundling['blId'],null,null,\Our\ApiConst::addBundingToCart,\Our\DbNameConst::salveDBConnectName); if($tempObj['goodsState'] != \Our\ApiConst::cartGoodsOffline){
if($tempPrice){ $tempPrice = \Goods\GoodsUtil::getInstance()->getRealPrice($pBundling['blId'],null,null,\Our\ApiConst::addBundingToCart,\Our\DbNameConst::salveDBConnectName);
$tempObj['goodsPrice'] = $tempPrice; if($tempPrice){
$tempObj['goodsPrice'] = $tempPrice;
}
} }
$tempObj['goodsImage'] = $pBundling['image']; $tempObj['goodsImage'] = $pBundling['image'];
...@@ -190,8 +196,10 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -190,8 +196,10 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
}else{ }else{
$tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline; $tempObj['goodsState'] = \Our\ApiConst::cartGoodsOffline;
} }
$price = \Goods\GoodsUtil::getInstance()->getRealPrice($tempCart['goods_id'],$memberId); if($tempObj['goodsState'] != \Our\ApiConst::cartGoodsOffline){
$tempObj['goodsPrice'] = $price?$price:$tempObj['goodsPrice']; $price = \Goods\GoodsUtil::getInstance()->getRealPrice($tempCart['goods_id'],$memberId);
$tempObj['goodsPrice'] = $price?$price:$tempObj['goodsPrice'];
}
} }
$tempObj['goodsAttr'] = $goodsDao->getFormatGoodsAttr($tempCart['goods_spec']); $tempObj['goodsAttr'] = $goodsDao->getFormatGoodsAttr($tempCart['goods_spec']);
$tempObj['goodsMid'] = $tempCart['goods_mid']; $tempObj['goodsMid'] = $tempCart['goods_mid'];
...@@ -303,12 +311,25 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -303,12 +311,25 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
* 获取组合销售商品列表 * 获取组合销售商品列表
* @param $blIds * @param $blIds
*/ */
public function getPBundlingListByBlIds($blIds,$dbName = \Our\DbNameConst::salveDBConnectName,$withKeyFlag= false){
/**
* @param $blIds
* @param string $dbName
* @param bool $withKeyFlag
* @param int $isDel 是否包含已经删除的数据(0:不包含已删除数据, 1 包含已删除数据)
* @return array|bool
* @throws \Our\Exception
*/
public function getPBundlingListByBlIds($blIds,$dbName = \Our\DbNameConst::salveDBConnectName,$limit=array(\Our\ApiConst::zero,\Our\ApiConst::five),$withKeyFlag= false,$isDel=\Our\ApiConst::zero){
if(!$blIds){ if(!$blIds){
return false; return false;
} }
$field = $this->pBundingField;
if($isDel==\Our\ApiConst::one){
$field = $this->pBundingFieldWithDel;
}
$pbundlingInstance = \DAO\PBundlingModel::getInstance(\Our\DbNameConst::salveDBConnectName); $pbundlingInstance = \DAO\PBundlingModel::getInstance(\Our\DbNameConst::salveDBConnectName);
$groupList = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(),array(&$pbundlingInstance, 'getList'),array($this->pBundingField,array('bl_id'=>array('in',$blIds)),array(\Our\ApiConst::zero,\Our\ApiConst::five)),\Our\ApiConst::oneDaySecond,array(implode(',',$blIds))); $groupList = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(),array(&$pbundlingInstance, 'getList'),array($field,array('bl_id'=>array('in',$blIds)),$limit,$isDel),\Our\ApiConst::oneDaySecond,array(implode(',',$blIds)));
$newGroupList = $this->getPBundlingList($groupList,$dbName,$withKeyFlag); $newGroupList = $this->getPBundlingList($groupList,$dbName,$withKeyFlag);
return $newGroupList; return $newGroupList;
} }
...@@ -536,7 +557,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -536,7 +557,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
//unset($goods_temp['goods_image']); //unset($goods_temp['goods_image']);
//unset($goods_temp['bl_id']); //unset($goods_temp['bl_id']);
//$goodsArray[] =$goods_temp; //unset($goods_temp['goods_image']); //$goodsArray[] =$goods_temp; //unset($goods_temp['goods_image']);
if(!$goods_temp['goods_state']==\Our\ApiConst::onlineGoodsState&&$goods_temp['goods_verify']==\Our\ApiConst::onlineGoodsVerify&&$goods_temp['is_del']==\Our\ApiConst::onlineGoodsDel){ if(!($goods_temp['goods_state']==\Our\ApiConst::onlineGoodsState&&$goods_temp['goods_verify']==\Our\ApiConst::onlineGoodsVerify&&$goods_temp['is_del']==\Our\ApiConst::onlineGoodsDel)){
$tempGroup['goodsCountFlag'] = false; $tempGroup['goodsCountFlag'] = false;
} }
if($tempGroup['bl_storage']>0&&floor($goods_temp['goodsStorage']/$goods_temp['num'])<$tempGroup['bl_storage']){ if($tempGroup['bl_storage']>0&&floor($goods_temp['goodsStorage']/$goods_temp['num'])<$tempGroup['bl_storage']){
...@@ -583,7 +604,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -583,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'];
......
...@@ -317,7 +317,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -317,7 +317,7 @@ class OrderServiceModel extends \Business\AbstractModel
} }
} }
if ($memberId) { if ($memberId) {
$orderDao->deleteOrderCache($memberId, $orderId, $order['store_id'],true); $orderDao->deleteOrderCache($memberId, $orderId, $order['storeId'],true);
// $memberDao->fromOrderStateToOrderState($memberId,$order['order_state'],ApiConst::orderStateCancel); // $memberDao->fromOrderStateToOrderState($memberId,$order['order_state'],ApiConst::orderStateCancel);
} }
} }
...@@ -718,18 +718,19 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -718,18 +718,19 @@ class OrderServiceModel extends \Business\AbstractModel
*/ */
public function getQmDeliveryLogList($memberId, $type = ApiConst::orderTypeBuy, $pageIndex = ApiConst::pageIndex, $pageSize = ApiConst::pageSize) public function getQmDeliveryLogList($memberId, $type = ApiConst::orderTypeBuy, $pageIndex = ApiConst::pageIndex, $pageSize = ApiConst::pageSize)
{ {
$QmDeliveryLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::salveDBConnectName); $qmDeliveryLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::salveDBConnectName);
$qmDeliveryMan=\DAO\Order\DiliverymanModel::getInstance(DbNameConst::salveDBConnectName);
$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);
$orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(DbNameConst::salveDBConnectName); $orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(DbNameConst::salveDBConnectName);
$memberDao = \DAO\MemberModel::getInstance(DbNameConst::salveDBConnectName); $memberDao = \DAO\MemberModel::getInstance(DbNameConst::salveDBConnectName);
$qmMans=$qmDeliveryMan->getListByMemberId($memberId);
$diliverymanIds=array_column($qmMans,'id');
$diliverymanId = $memberDao->getInfo($memberId, 'diliveryman_id'); $diliverymanId = $memberDao->getInfo($memberId, 'diliveryman_id');
if (empty($diliverymanId)) { if (empty($diliverymanIds)) {
ErrorModel::throwException(CodeConfigModel::commonError); ErrorModel::throwException(CodeConfigModel::commonError);
} }
$qmDeliveryLogList = $qmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanIds, $type, $pageIndex, $pageSize,$memberId);
$qmDeliveryLogList = $QmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanId, $type, $pageIndex, $pageSize);
$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;
...@@ -860,7 +861,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -860,7 +861,7 @@ class OrderServiceModel extends \Business\AbstractModel
{ {
$memberDao = \DAO\MemberModel::getInstance(DbNameConst::masterDBConnectName); $memberDao = \DAO\MemberModel::getInstance(DbNameConst::masterDBConnectName);
$qmDeliverymanLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::masterDBConnectName); $qmDeliverymanLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::masterDBConnectName);
$deliverymanId = $memberDao->getInfo($memberid, 'diliveryman_id'); //$deliverymanId = $memberDao->getInfo($memberid, 'diliveryman_id');
$qmDeliveryManLog = $qmDeliverymanLogDao->findById($id); $qmDeliveryManLog = $qmDeliverymanLogDao->findById($id);
if ($qmDeliveryManLog['deliveryState'] == ApiConst::deliveryStateWait && $qmDeliveryManLog['id'] == $id) { if ($qmDeliveryManLog['deliveryState'] == ApiConst::deliveryStateWait && $qmDeliveryManLog['id'] == $id) {
$updateResult = $qmDeliverymanLogDao->updateStatusById($id); $updateResult = $qmDeliverymanLogDao->updateStatusById($id);
...@@ -871,7 +872,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -871,7 +872,7 @@ class OrderServiceModel extends \Business\AbstractModel
$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);
$qmDeliverymanLogDao->deleteOrderCache($deliverymanId, $id); $qmDeliverymanLogDao->deleteOrderCache($memberid, $id);
return $updateResult; return $updateResult;
} else { } else {
return false; return false;
......
...@@ -54,7 +54,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -54,7 +54,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$orderDao=\DAO\Order\OrderModel::getInstance(); $orderDao=\DAO\Order\OrderModel::getInstance();
$favoritesStoreDao=\DAO\FavoritesStoreModel::getInstance(); $favoritesStoreDao=\DAO\FavoritesStoreModel::getInstance();
$orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance(); $orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance();
$goodsCount=\Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsCountByStoreId'), array($storeId), ApiConst::one, array($storeId)); $goodsCount=\Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsCountByStoreId'), array($storeId), ApiConst::tenDaySecond, array($storeId));
$condition['store_id'] = $storeId; $condition['store_id'] = $storeId;
//获取店铺信息 //获取店铺信息
$store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this->storeDao, 'getInfo'), array($condition), ApiConst::tenDaySecond, array($storeId)); $store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this->storeDao, 'getInfo'), array($condition), ApiConst::tenDaySecond, array($storeId));
......
...@@ -398,7 +398,6 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -398,7 +398,6 @@ class StoreServiceModel extends \Business\AbstractModel{
if(!$nearbyStoreIds){ if(!$nearbyStoreIds){
return array('totalCount'=>0); return array('totalCount'=>0);
} }
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$storeDao = \DAO\StoreModel::getInstance(); $storeDao = \DAO\StoreModel::getInstance();
...@@ -483,7 +482,6 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -483,7 +482,6 @@ class StoreServiceModel extends \Business\AbstractModel{
$position['lng'] = $where['lng']; $position['lng'] = $where['lng'];
$position['cityCode'] = $where['cityCode']; $position['cityCode'] = $where['cityCode'];
$readisSuffix = crc32(serialize(ksort($position))); $readisSuffix = crc32(serialize(ksort($position)));
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$nearbyStoreKey = \Our\NameConst::nearbyStoreKeyPrefix . $readisSuffix; $nearbyStoreKey = \Our\NameConst::nearbyStoreKeyPrefix . $readisSuffix;
......
...@@ -16,6 +16,25 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -16,6 +16,25 @@ class AddressServiceModel extends \Business\AbstractModel {
{ {
} }
public function getRequestAddress($data,$returnAddress){
$returnData = array();
if($returnAddress['returnAddressId'] > \Our\ApiConst::zero){
$returnData['lat'] = $returnAddress['addresses'][0]['lat'];
$returnData['lng'] = $returnAddress['addresses'][0]['lng'];
$returnData['cityCode'] = $returnAddress['addresses'][0]['cityCode'];
}else {
if($data['cityCode']&&$data['lng']&&$data['lat']){
$returnData = $data;
}else{
$returnData = \Our\ArrayConst::defaultAddress;
unset($returnData['address']);
unset($returnData['default']);
}
}
return $returnData;
}
public function writeToFile(){ public function writeToFile(){
$addressDao = \DAO\AreaModel::getInstance(); $addressDao = \DAO\AreaModel::getInstance();
......
...@@ -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']);
...@@ -512,5 +515,23 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -512,5 +515,23 @@ 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;
}
} }
...@@ -18,7 +18,7 @@ use Our\OrderConst; ...@@ -18,7 +18,7 @@ use Our\OrderConst;
class DiliverymanModel extends \DAO\AbstractModel class DiliverymanModel extends \DAO\AbstractModel
{ {
public $detailField='id as id,true_name as trueName,mobile as mobile,scores as scores,store_id as storeId,add_time as addTime,update_time as updateTime,member_id as memberId,bind_status as bindStatus,is_del as isDel';
/** /**
* 表名 * 表名
* *
...@@ -64,7 +64,16 @@ class DiliverymanModel extends \DAO\AbstractModel ...@@ -64,7 +64,16 @@ class DiliverymanModel extends \DAO\AbstractModel
$data = $this->db->from($this->_tableName)->where($where)->fetchOne(); $data = $this->db->from($this->_tableName)->where($where)->fetchOne();
return $data; return $data;
} }
//任务脚本方法
public function getListByMemberId($memberId)
{
$this->setDb($this->dbName);
$where['member_id']=$memberId;
$where['is_del']=ApiConst::zero;
$where = $this->db->getSqlWhereByArray($where);
$list = $this->db->select($this->detailField)->from($this->_tableName)->where($where)->fetchAll();
return $list;
}
public function findById($id) public function findById($id)
{ {
$this->setDb($this->dbName); $this->setDb($this->dbName);
......
...@@ -54,6 +54,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -54,6 +54,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
*/ */
public function update($where, $data){ public function update($where, $data){
$this->setDb(DbNameConst::masterDBConnectName); $this->setDb(DbNameConst::masterDBConnectName);
$data['gmt_update']=TIMESTAMP;
return $this->db->update($this->_tableName)->where($where)->rows($data)->execute(); return $this->db->update($this->_tableName)->where($where)->rows($data)->execute();
} }
......
...@@ -88,19 +88,24 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel ...@@ -88,19 +88,24 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel
public function getListByDeliverymanIdAndType($diliveryId, $type, $pageIndex, $pageSize, $order = array('get_time' => 'desc')) public function getListByDeliverymanIdAndType($diliveryId, $type, $pageIndex, $pageSize, $order = array('get_time' => 'desc'))
{ {
$this->setDb($this->dbName); $this->setDb($this->dbName);
$where['diliveryman_id'] = $diliveryId; $where['diliveryman_id'] =array('in',$diliveryId);
if ($type == ApiConst::orderTypeBuy) { if ($type == ApiConst::orderTypeBuy) {
$where['order_type'] = ApiConst::orderTypeBuy; $where['order_type'] = ApiConst::orderTypeBuy;
$where['delivery_state'] = ApiConst::deliveryStateWait; $where['delivery_state'] = ApiConst::deliveryStateWait;
} }
if ($type == ApiConst::orderTypeRefund) { if ($type == ApiConst::orderTypeRefund) {
$where=Common::format(" diliveryman_id={0} and order_type={1} and (delivery_state={2} or delivery_state={3})",$diliveryId,ApiConst::orderTypeRefund,ApiConst::deliveryStateWait,ApiConst::deliveryStateWaitTen); // $where=Common::format(" diliveryman_id in ({0}) and order_type={1} and (delivery_state={2} or delivery_state={3})",$diliveryId,ApiConst::orderTypeRefund,ApiConst::deliveryStateWait,ApiConst::deliveryStateWaitTen);
// $where['order_type'] = ApiConst::orderTypeRefund; $where['order_type'] = ApiConst::orderTypeRefund;
// $where['delivery_state'] = ApiConst::deliveryStateWait; $where['delivery_state'] = ApiConst::deliveryStateWait;
} }
if ($type == ApiConst::deliveryStateWait) { if ($type == ApiConst::deliveryStateWait) {
$where['delivery_state'] = ApiConst::deliveryStateComplete; $where['delivery_state'] = ApiConst::deliveryStateComplete;
} }
if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where);
}
if($type==ApiConst::deliveryStateComplete){ if($type==ApiConst::deliveryStateComplete){
$order = array('finish_time' => 'desc'); $order = array('finish_time' => 'desc');
} }
...@@ -108,9 +113,9 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel ...@@ -108,9 +113,9 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel
return $list; return $list;
} }
public function getListByDeliverymanIdAndTypeCache($diliveryId, $type, $pageIndex, $pageSize, $order = array('get_time' => 'desc')) public function getListByDeliverymanIdAndTypeCache($diliveryId, $type, $pageIndex, $pageSize, $order = array('get_time' => 'desc'),$memberId)
{ {
return \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getListByDeliverymanIdAndType'), array($diliveryId, $type, $pageIndex, $pageSize, $order), ApiConst::oneDaySecond, array($diliveryId)); return \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getListByDeliverymanIdAndType'), array($diliveryId, $type, $pageIndex, $pageSize, $order), ApiConst::oneDaySecond, array($memberId));
} }
/** /**
......
...@@ -33,12 +33,28 @@ class PBundlingModel extends \DAO\AbstractModel { ...@@ -33,12 +33,28 @@ class PBundlingModel extends \DAO\AbstractModel {
// $where = array(); // $where = array();
// $groupList=$this->db->select($field)->from($this->_tableName)->where($where)->order('gmt_create','DESC')->fetchOne(); // $groupList=$this->db->select($field)->from($this->_tableName)->where($where)->order('gmt_create','DESC')->fetchOne();
// } // }
public function getList($field,$where,$limit = array(0,0)){
/**
* @param $field
* @param $where
* @param array $limit
* @param int $isDel 是否包含已删除数据(0:不包含,1包含)
* @return mixed
*/
public function getList($field,$where,$limit = [],$isDel = \Our\ApiConst::zero){
$this->setDb($this->dbName); $this->setDb($this->dbName);
if(is_array($where)){ if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where); $where = $this->db->getSqlWhereByArray($where);
} }
return $this->db->select($field)->from($this->_tableName)->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1')->where('is_del=0')->limit($limit[0],$limit[1])->fetchAll(); $this->db->select($field)->from($this->_tableName)->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1');
if($isDel==\Our\ApiConst::zero){
$this->db->where('is_del=0');
}
if($limit){
$this->db->limit($limit[0],$limit[1]);
}
$result = $this->db->fetchAll();
return $result;
} }
public function getImgPath($image){ public function getImgPath($image){
if($image){ if($image){
......
...@@ -33,7 +33,6 @@ class QmStoreClassModel extends \DAO\AbstractModel{ ...@@ -33,7 +33,6 @@ class QmStoreClassModel extends \DAO\AbstractModel{
}else{ }else{
$result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll(); $result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
} }
return $result; return $result;
} }
......
...@@ -219,7 +219,7 @@ push.open=1 ...@@ -219,7 +219,7 @@ push.open=1
[ccwdevelop : common] [ccwdevelop : common]
; 数据库配置 ; 数据库配置
resources.database.params.driver = "pdo_mysql" resources.database.params.driver = "pdo_mysql"
resources.database.params.hostname = "192.168.1.201" resources.database.params.hostname = "127.0.0.1"
resources.database.params.port = 3306 resources.database.params.port = 3306
resources.database.params.database = "qmcs" resources.database.params.database = "qmcs"
resources.database.params.username = "root" resources.database.params.username = "root"
...@@ -229,7 +229,7 @@ resources.database.params.driver_options.1002 = "SET NAMES utf8" ...@@ -229,7 +229,7 @@ resources.database.params.driver_options.1002 = "SET NAMES utf8"
; 从库配置 ; 从库配置
resources.database.slave.params.driver = "pdo_mysql" resources.database.slave.params.driver = "pdo_mysql"
resources.database.slave.params.hostname = "192.168.1.201" resources.database.slave.params.hostname = "127.0.0.1"
resources.database.slave.params.port = 3306 resources.database.slave.params.port = 3306
resources.database.slave.params.database = "qmcs" resources.database.slave.params.database = "qmcs"
resources.database.slave.params.username = "root" resources.database.slave.params.username = "root"
......
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