Commit 5656b4c6 authored by zhz's avatar zhz

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

parents 7a5ccbea 39682aab
...@@ -114,7 +114,6 @@ class CartController extends \Our\Controller_AbstractApi{ ...@@ -114,7 +114,6 @@ class CartController extends \Our\Controller_AbstractApi{
$gcIds = isset($cartList['gcIds'])?$cartList['gcIds']:array(); $gcIds = isset($cartList['gcIds'])?$cartList['gcIds']:array();
$storeCartData = array('cartList'=>$cartList['list'],'storeIds'=>$storeCartList['storeIds'],'goodsIds'=>$storeCartList['goodsIds'],'goodsCommonIds'=>$storeCartList['goodsCommonIds'],'blIds'=>$storeCartList['blIds'],'gcIds'=>$gcIds); $storeCartData = array('cartList'=>$cartList['list'],'storeIds'=>$storeCartList['storeIds'],'goodsIds'=>$storeCartList['goodsIds'],'goodsCommonIds'=>$storeCartList['goodsCommonIds'],'blIds'=>$storeCartList['blIds'],'gcIds'=>$gcIds);
//var_dump($storeCartData); //var_dump($storeCartData);
//$this->success($storeCartData);
$storeCartData = $cartService->checkCouponForCart($storeCartData,$this->memberId); $storeCartData = $cartService->checkCouponForCart($storeCartData,$this->memberId);
//$this->success($storeCartData); //$this->success($storeCartData);
$storeCartData = $cartService->getDeliveryTypeForCart($address,$storeCartData); $storeCartData = $cartService->getDeliveryTypeForCart($address,$storeCartData);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -253,7 +253,10 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -253,7 +253,10 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
$storeIds = $cartListData['storeIds']; $storeIds = $cartListData['storeIds'];
$newResult = array(); $newResult = array();
foreach($storeIds as $key){ foreach($storeIds as $key){
$newResult[] = $result[$key]; $tempReturnCart = $result[$key];
$tempStore = $storeDao->get($key,false);
$tempReturnCart['inAreaFlag'] = $storeDao->checkAddressInServiceArea($address,$tempStore);
$newResult[] = $tempReturnCart;
} }
return array('totalCount'=>count($storeCartList),'list'=>$newResult); return array('totalCount'=>count($storeCartList),'list'=>$newResult);
} }
......
...@@ -133,8 +133,9 @@ class MessageServiceModel extends \Business\AbstractModel ...@@ -133,8 +133,9 @@ class MessageServiceModel extends \Business\AbstractModel
} }
if ($type == 4) { if ($type == 4) {
$store = \DAO\StoreModel::getInstance(); $store = \DAO\StoreModel::getInstance();
$store->setDb($db); $storeData=\Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$store, 'getInfoById'), array($userid, $store->detailField), \Our\ApiConst::oneDaySecond);
$avatar = $store->getInfoById($userid, 'store_label', 'store_label'); $avatar=$storeData['storeLabel'];
// $avatar = $store->getInfoById($userid, 'store_label', 'store_label');
$avatar = Common::getStaticFile($avatar, ImageConst::storeLabel, ImageConst::imageDomain); $avatar = Common::getStaticFile($avatar, ImageConst::storeLabel, ImageConst::imageDomain);
} }
...@@ -170,6 +171,14 @@ class MessageServiceModel extends \Business\AbstractModel ...@@ -170,6 +171,14 @@ class MessageServiceModel extends \Business\AbstractModel
$toMember = $this->getUserByMemberIdAndSelfType($val['toId'], $val['toType']); $toMember = $this->getUserByMemberIdAndSelfType($val['toId'], $val['toType']);
$val['message'] = unserialize($val['message']); $val['message'] = unserialize($val['message']);
$val['toAvatar'] = $self['avatar']; $val['toAvatar'] = $self['avatar'];
foreach($val['message']['buttons'] as &$button){
if($button['type']==ApiConst::messageButtonTypeConfirmButton || $button['type']==ApiConst::messageButtonTypeReciverButton){
$timeDiff=TIMESTAMP-$val['message']['createTime'];
if($timeDiff>(ApiConst::tenMinSecond-ApiConst::oneMinute)){
$button['showType']=ApiConst::messageButtonShowTypeGray;
}
}
}
$val['fromAvatar'] = $toMember['avatar']; $val['fromAvatar'] = $toMember['avatar'];
// $val['toAvatar']=$this->getAvatar($val['toType'],$val['toId']); // $val['toAvatar']=$this->getAvatar($val['toType'],$val['toId']);
// $val['fromAvatar']=$this->getAvatar($val['fromType'],$val['fromId']); // $val['fromAvatar']=$this->getAvatar($val['fromType'],$val['fromId']);
......
...@@ -254,9 +254,9 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -254,9 +254,9 @@ class OrderServiceModel extends \Business\AbstractModel
$this->orderGoodsList = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderId, $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond, array($orderId)); $this->orderGoodsList = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderId, $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond, array($orderId));
//商店相关信息 //商店相关信息
$this->store=$storeDao->get($this->order['storeId']); // $this->store=$storeDao->get($this->order['storeId']);
$this->store=Common::convertUnderline($this->store[0]); // $this->store=Common::convertUnderline($this->store[0]);
// $this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'], $this->storeField), \Our\ApiConst::oneDaySecond,array($this->order['storeId'])); $this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'], $storeDao->detailField), \Our\ApiConst::sevenDaySecond,array($this->order['storeId']));
$returnData = $this->order; $returnData = $this->order;
//配送员信息 //配送员信息
$this->diliveryman = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($returnData['diliverymanId']), \Our\ApiConst::oneDaySecond); $this->diliveryman = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$diliverymanDao, 'findById'), array($returnData['diliverymanId']), \Our\ApiConst::oneDaySecond);
...@@ -609,7 +609,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -609,7 +609,7 @@ class OrderServiceModel extends \Business\AbstractModel
$beginTime = file_get_contents($this->baseDir . \Our\PathConst::orderCloseWaitRecieveOrder, TIMESTAMP); $beginTime = file_get_contents($this->baseDir . \Our\PathConst::orderCloseWaitRecieveOrder, TIMESTAMP);
$beginTime = $beginTime ? $beginTime : ApiConst::zero; $beginTime = $beginTime ? $beginTime : ApiConst::zero;
$endTime = TIMESTAMP - ApiConst::orderStateWaitConfirmBeyond; $endTime = TIMESTAMP - ApiConst::orderStateWaitConfirmBeyond;
$beginTime=0; // $beginTime=0;
$orders = $orderDao->getMustCecelRecieveOrders($beginTime, $endTime, $orderDao->getOrderDetailField()); $orders = $orderDao->getMustCecelRecieveOrders($beginTime, $endTime, $orderDao->getOrderDetailField());
if (!empty($orders)) { if (!empty($orders)) {
foreach ($orders as $order) { foreach ($orders as $order) {
...@@ -832,8 +832,9 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -832,8 +832,9 @@ class OrderServiceModel extends \Business\AbstractModel
if (empty($this->orderGoodsList)) { if (empty($this->orderGoodsList)) {
ErrorModel::throwException(CodeConfigModel::notExistOrderGoods); ErrorModel::throwException(CodeConfigModel::notExistOrderGoods);
} }
//商店相关信息 //商店相关信息
$this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'], $this->storeField), \Our\ApiConst::oneDaySecond); $this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($this->order['storeId'],$storeDao->detailField), \Our\ApiConst::oneDaySecond);
$orderGoods = $goodsDao->convert($this->orderGoodsList); $orderGoods = $goodsDao->convert($this->orderGoodsList);
if (empty($orderGoods)) { if (empty($orderGoods)) {
......
...@@ -235,8 +235,9 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -235,8 +235,9 @@ class RefundServiceModel extends \Business\AbstractModel
$orderGoodses = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderInfo['orderId'], $this->orderGoodsField), \Our\ApiConst::oneDaySecond); $orderGoodses = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderInfo['orderId'], $this->orderGoodsField), \Our\ApiConst::oneDaySecond);
$orderGoodses = $orderGoodsDao->convertOrderGoods($orderGoodses, 'goodsId'); $orderGoodses = $orderGoodsDao->convertOrderGoods($orderGoodses, 'goodsId');
$goodsIds = $orderGoodsDao->getRefundOrderGoodsIds($orderGoodses); $goodsIds = $orderGoodsDao->getRefundOrderGoodsIds($orderGoodses);
$this->store=$storeDao->get($this->order['storeId']); // $this->store=$storeDao->get($this->order['storeId']);
$this->store=Common::convertUnderline($this->store[0]); // $this->store=Common::convertUnderline($this->store[0]);
$this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($orderInfo['storeId'], $storeDao->detailField), \Our\ApiConst::sevenDaySecond,array($orderInfo['storeId']));
if(!empty($orderGoodses[$goodsId])){ if(!empty($orderGoodses[$goodsId])){
$orderGoods = $orderGoodses[$goodsId]; $orderGoods = $orderGoodses[$goodsId];
} }
...@@ -337,6 +338,7 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -337,6 +338,7 @@ class RefundServiceModel extends \Business\AbstractModel
*/ */
public function addRefund($memberId, $refund) public function addRefund($memberId, $refund)
{ {
error_reporting(E_ALL);
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName); $refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName);
$refundReasonDao = \DAO\Order\RefundReasonModel::getInstance(DbNameConst::masterDBConnectName); $refundReasonDao = \DAO\Order\RefundReasonModel::getInstance(DbNameConst::masterDBConnectName);
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName); $orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::masterDBConnectName);
...@@ -443,8 +445,10 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -443,8 +445,10 @@ class RefundServiceModel extends \Business\AbstractModel
ErrorModel::throwException(CodeConfigModel::notExistRefund); ErrorModel::throwException(CodeConfigModel::notExistRefund);
} }
$orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'findByRecId'), array($refundReturn['orderGoodsId'], $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond); $orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\RefundReasonRedisModel::getInstance(), array(&$orderGoodsDao, 'findByRecId'), array($refundReturn['orderGoodsId'], $this->getGoodsDetailField()), \Our\ApiConst::oneDaySecond);
$this->store=$storeDao->get($refundReturn['storeId']); // $this->store=$storeDao->get($refundReturn['storeId']);
$this->store=Common::convertUnderline($this->store[0]); // $this->store=Common::convertUnderline($this->store[0]);
$this->store = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$storeDao, 'getInfoById'), array($refundReturn['storeId'],$storeDao->detailField), \Our\ApiConst::sevenDaySecond,array($refundReturn['storeId']));
$refundReturn['goodsGroup'] = $goodsDao->getGoodsGroup($orderGoods['goodsGroup']); $refundReturn['goodsGroup'] = $goodsDao->getGoodsGroup($orderGoods['goodsGroup']);
$refundReturn['goodsAttr'] = $goodsDao->getFormatGoodsAttr($orderGoods['goodsSpec']); $refundReturn['goodsAttr'] = $goodsDao->getFormatGoodsAttr($orderGoods['goodsSpec']);
$refundReturn['sellerStateName'] = ArrayConst::sellerState[$refundReturn['sellerState']]; $refundReturn['sellerStateName'] = ArrayConst::sellerState[$refundReturn['sellerState']];
......
...@@ -53,23 +53,28 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -53,23 +53,28 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
// $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance(); // $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance();
$orderDao = \DAO\Order\OrderModel::getInstance(); $orderDao = \DAO\Order\OrderModel::getInstance();
$favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance(); $favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance();
$memberFavoritesStoreStoreMemberStatisticsDao=\DAO\Store\MemberFavoritesStoreStoreMemberStatisticsModel::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::tenDaySecond, array($storeId)); //$goodsCount = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsCountByStoreId'), array($storeId), ApiConst::tenDaySecond, array($storeId));
$totalOrderCount = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$memberFavoritesStoreStoreMemberStatisticsDao, 'getGoodsCountOrderTotalByStoreId'), array($storeId), ApiConst::oneDaySecond, 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::oneDaySecond, array($storeId));
//获取店铺数据统计 //获取店铺数据统计
//$storeStats = $storeStatisticsDao->find($condition); //$storeStats = $storeStatisticsDao->find($condition);
//获取店铺今日销售额和订单量 //获取店铺今日销售额和订单量
// $storeStats=$orderDao->getShopKeeperCountByStoreId($storeId); // $storeStats=$orderDao->getShopKeeperCountByStoreId($storeId);
$storeStats = $orderDao->getShopKeeperCountByStoreIdCache($storeId); $storeStats = $orderDao->getShopKeeperCountByStoreIdCache($storeId);
$storeFavariteCount = $favoritesStoreDao->getFavoritesCountByStoreIdCache($storeId); $storeFavariteCount = $favoritesStoreDao->getFavoritesCountByStoreIdCache($storeId);
$goodsCount=$totalOrderCount['orderGoodsCount'];
$orderTotal=$totalOrderCount['orderTotal'];
$data['storeId'] = $store['store_id']; $data['storeId'] = $store['store_id'];
$data['storeName'] = $store['store_name']; $data['storeName'] = $store['store_name'];
$data['storeLabel'] = $store['store_label']; $data['storeLabel'] = $store['store_label'];
$data['goodsCount'] = $goodsCount; $data['goodsCount'] = $goodsCount;
$data['orderCount'] = $storeStats['orderCount']; $data['orderCount'] = $storeStats['orderCount'];
$data['orderTotal'] = $storeStats['orderTotal']; $data['orderTotal'] = $orderTotal;
$data['favCount'] = $storeFavariteCount['favCount']; $data['favCount'] = $storeFavariteCount['favCount'];
$data['todayOrderCount'] = $storeStats['todayOrderCount']; $data['todayOrderCount'] = $storeStats['todayOrderCount'];
$data['todayOrderTotal'] = $storeStats['todayOrderTotal']; $data['todayOrderTotal'] = $storeStats['todayOrderTotal'];
...@@ -240,6 +245,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -240,6 +245,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} }
} else { } else {
$update_data['order_state'] = ApiConst::orderStateWaitSend; $update_data['order_state'] = ApiConst::orderStateWaitSend;
$update_data['accept_time']=TIMESTAMP;
$result = $orderDao->update($where, $update_data); $result = $orderDao->update($where, $update_data);
$orderDao->deleteOrderCache($order['buyer_id'], $orderId, $order['store_id'], true); $orderDao->deleteOrderCache($order['buyer_id'], $orderId, $order['store_id'], true);
// \Our\RedisHelper::memberTotalFromStateToState($order['buyer_id'], $order['order_state'], ApiConst::orderStateWaitSend); // \Our\RedisHelper::memberTotalFromStateToState($order['buyer_id'], $order['order_state'], ApiConst::orderStateWaitSend);
......
...@@ -413,6 +413,22 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -413,6 +413,22 @@ class AddressServiceModel extends \Business\AbstractModel {
return $result; return $result;
} }
public function createPinyin(){
$areaDao =\DAO\AreaModel::getInstance();
$pageSize=1000;
$pageIndex=0;
for($i=$pageIndex;$i<4;$i++){
$pageIndex = $i*$pageSize;
$limit = array($pageIndex,$pageSize);
$areaList = $areaDao->getList($limit);
foreach($areaList as $area){
$updateData = array();
$updateData['pinyin'] = ucfirst(\Our\Pinyin::pinyin($area['area_name']));
$areaDao->update(array('area_id'=>$area['area_id']),$updateData);
}
}
}
/** /**
* 获取城市列表 * 获取城市列表
* @return bool * @return bool
......
...@@ -50,6 +50,22 @@ class AreaModel extends \DAO\AbstractModel { ...@@ -50,6 +50,22 @@ class AreaModel extends \DAO\AbstractModel {
return $result; return $result;
} }
public function update($where, $data){
$this->setDb(\Our\DbNameConst::masterDBConnectName);
return $this->db->update($this->_tableName)->where($where)->rows($data)->execute();
}
public function getList($limit){
$this->setDb($this->dbName);
$this->db->select(\Our\NameConst::allField)->from($this->_tableName);
if($limit){
$this->db->limit($limit[0],$limit[1]);
}
$areaList = $this->db->fetchAll();
return $areaList;
}
public function getCityListWithoutCounty(){ public function getCityListWithoutCounty(){
$addressRedis = AddressRedisModel::getInstance(); $addressRedis = AddressRedisModel::getInstance();
$cityList = $addressRedis->find('cityListWithoutCounty'); $cityList = $addressRedis->find('cityListWithoutCounty');
...@@ -60,17 +76,19 @@ class AreaModel extends \DAO\AbstractModel { ...@@ -60,17 +76,19 @@ class AreaModel extends \DAO\AbstractModel {
$addressRedis->update('allCityListWithoutCounty',$areaList); $addressRedis->update('allCityListWithoutCounty',$areaList);
$cityListInitial = array(); $cityListInitial = array();
$cityInitialList = array(); $cityInitialList = array();
$cityPinyinList = array();
foreach($areaList as $area){ foreach($areaList as $area){
if(isset($area['initial'])&&$area['initial']&&!($cityInitialList&&in_array($area['initial'],$cityInitialList))){ if(isset($area['initial'])&&$area['initial']&&!($cityInitialList&&in_array($area['initial'],$cityInitialList))){
$cityInitialList[] = $area['initial']; $cityInitialList[] = $area['initial'];
} }
$cityListInitial[$area['initial']][] =$area['area_name'] ;
$cityListInitial[$area['initial']][] = $area['area_name']; $cityPinyinList[$area['initial']][] = array('name'=>$area['area_name'],'pinyin'=>$area['pinyin']);
} }
$list = array(); $list = array();
foreach($cityInitialList as $inital){ foreach($cityInitialList as $inital){
$initalCity['initial'] = $inital; $initalCity['initial'] = $inital;
$initalCity['list'] = $cityListInitial[$inital]; $initalCity['list'] = $cityListInitial[$inital];
$initalCity['pinyinList'] = $cityPinyinList[$inital];
$list[] = $initalCity; $list[] = $initalCity;
} }
$addressRedis->update('cityListWithoutCounty',$list); $addressRedis->update('cityListWithoutCounty',$list);
...@@ -93,11 +111,13 @@ class AreaModel extends \DAO\AbstractModel { ...@@ -93,11 +111,13 @@ class AreaModel extends \DAO\AbstractModel {
} }
$cityListInitial[$area['initial']][] = $area['area_name']; $cityListInitial[$area['initial']][] = $area['area_name'];
$cityPinyinList[$area['initial']][] = array('name'=>$area['area_name'],'pinyin'=>$area['pinyin']);
} }
$list = array(); $list = array();
foreach($cityInitialList as $inital){ foreach($cityInitialList as $inital){
$initalCity['initial'] = $inital; $initalCity['initial'] = $inital;
$initalCity['list'] = $cityListInitial[$inital]; $initalCity['list'] = $cityListInitial[$inital];
$initalCity['pinyinList'] = $cityPinyinList[$inital];
$list[] = $initalCity; $list[] = $initalCity;
} }
$addressRedis->update('cityList',$list); $addressRedis->update('cityList',$list);
...@@ -106,16 +126,13 @@ class AreaModel extends \DAO\AbstractModel { ...@@ -106,16 +126,13 @@ class AreaModel extends \DAO\AbstractModel {
public function getAllCityList($withoutCounty=false){ public function getAllCityList($withoutCounty=false){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$sql = " SELECT t1.area_name, t2.f_py as initial FROM han_area t1 "; $sql = " SELECT t1.area_name,t1.pinyin, LEFT(t1.pinyin,1) as initial FROM han_area t1 ";
$sql .= " left join han_coslers t2 "; $sql .= " where t1.is_city=1 ";
$sql .= " on CONV(HEX(LEFT(CONVERT(t1.area_name USING gbk ), 1)), 16, 10) BETWEEN t2.cbegin AND t2.cend
where t1.is_city=1 ";
if($withoutCounty){ if($withoutCounty){
$sql .= " and t1.area_name not like '%县'"; $sql .= " and t1.area_name not like '%县'";
} }
$sql .= " ORDER BY t1.area_deep,convert(t1.area_name using gbk) ASC "; $sql .= " ORDER BY t1.area_deep,t1.pinyin ASC ";
$area_list = $this->db->query($sql)->rows; $area_list = $this->db->query($sql)->rows;
echo $this->db->getLastSql();
return $area_list; return $area_list;
} }
......
...@@ -366,7 +366,7 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -366,7 +366,7 @@ class CouponModel extends \DAO\AbstractModel {
$totalPrice = \Our\ApiConst::zero; $totalPrice = \Our\ApiConst::zero;
if($gcTotalPriceArray){ if($gcTotalPriceArray){
foreach($gcTotalPriceArray as $key=>$gcTotalPrice){ foreach($gcTotalPriceArray as $key=>$gcTotalPrice){
if(strpos($coupon['ids'],','.$key.',')===\Our\ApiConst::zero||strpos($coupon['ids'],','.$key.',')>\Our\ApiConst::zero){ if(strpos($coupon['ids'],','.$key.',')!==false){
$totalPrice +=$gcTotalPrice['totalPrice']; $totalPrice +=$gcTotalPrice['totalPrice'];
} }
} }
...@@ -419,11 +419,12 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -419,11 +419,12 @@ class CouponModel extends \DAO\AbstractModel {
$gcPrices = array(); $gcPrices = array();
$goodsCommonPrices = array(); $goodsCommonPrices = array();
foreach($goodsList as $goods){ foreach($goodsList as $goods){
$goodsNum = $goods['goodsNum'];
if($goods['type']== \Our\ApiConst::addGoodsToCart){ if($goods['type']== \Our\ApiConst::addGoodsToCart){
if(strpos($giftGoodsIds,','.$goods['goodsId'].',')===\Our\ApiConst::zero||strpos($giftGoodsIds,','.$goods['goodsId'].',')>\Our\ApiConst::zero){
$goodsNum = $goods['goodsNum'];
if(strpos($giftGoodsIds,','.$goods['goodsCommonId'].',')!==false){
$giftGoodsAmount += $goods['goodsPrice']; $giftGoodsAmount += $goods['goodsPrice'];
$goodsNum = $goods['goodsNum']-\Our\ApiConst::one; $goodsNum = $goodsNum-\Our\ApiConst::one;
} }
if($goodsNum>\Our\ApiConst::zero){ if($goodsNum>\Our\ApiConst::zero){
if(isset($gcPrices[$goods['gcId']])){ if(isset($gcPrices[$goods['gcId']])){
...@@ -449,7 +450,7 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -449,7 +450,7 @@ class CouponModel extends \DAO\AbstractModel {
return false; return false;
} }
foreach($gcPrices as $key=>$gcTotalPrice){ foreach($gcPrices as $key=>$gcTotalPrice){
if(strpos($coupon['ids'],','.$key.',')===\Our\ApiConst::zero||strpos($coupon['ids'],','.$key.',')>\Our\ApiConst::zero){ if(strpos($coupon['ids'],','.$key.',')!==false){
$totalPrice +=$gcTotalPrice; $totalPrice +=$gcTotalPrice;
} }
} }
...@@ -458,12 +459,12 @@ class CouponModel extends \DAO\AbstractModel { ...@@ -458,12 +459,12 @@ class CouponModel extends \DAO\AbstractModel {
return false; return false;
} }
foreach($goodsCommonPrices as $key=>$goodsCommonPrice){ foreach($goodsCommonPrices as $key=>$goodsCommonPrice){
if(strpos($coupon['ids'],','.$key.',')===\Our\ApiConst::zero||strpos($coupon['ids'],','.$key.',')>\Our\ApiConst::zero){ if(strpos($coupon['ids'],','.$key.',')!==false){
$totalPrice += $goodsCommonPrice; $totalPrice += $goodsCommonPrice;
} }
} }
}else if($coupon['type'] == \Our\ApiConst::commonCoupon){//普通优惠券 }else if($coupon['type'] == \Our\ApiConst::commonCoupon){//普通优惠券
if($storeCouponPrice>\Our\ApiConst::zero){ if($storeCouponPrice==\Our\ApiConst::zero){
return false; return false;
} }
$totalPrice += $storeCouponPrice; $totalPrice += $storeCouponPrice;
......
...@@ -108,6 +108,7 @@ class MemberModel extends \DAO\AbstractModel ...@@ -108,6 +108,7 @@ class MemberModel extends \DAO\AbstractModel
} }
public function saveWxUserToken($key,$memberId){ public function saveWxUserToken($key,$memberId){
$member = $this->getInfo($memberId);
$memberDb0Redis = \Redis\Db0\MemberRedisModel::getInstance(); $memberDb0Redis = \Redis\Db0\MemberRedisModel::getInstance();
$memberDb0Redis->tableHMSet($memberId, array('wxUserToken'=>$key)); $memberDb0Redis->tableHMSet($memberId, array('wxUserToken'=>$key));
} }
......
...@@ -409,7 +409,7 @@ class OrderModel extends \DAO\AbstractModel ...@@ -409,7 +409,7 @@ class OrderModel extends \DAO\AbstractModel
if(is_array($memberIds)){ if(is_array($memberIds)){
$memberIds=implode(',',$memberIds); $memberIds=implode(',',$memberIds);
} }
$where=Common::format(" store_id in({0}) and buyer_id in({1}) and order_state not in({2})",$storeIds,$memberIds,'-1,0'); $where=Common::format(" store_id in({0}) and buyer_id in({1}) and order_state not in({2}) and refund_amount={3}",$storeIds,$memberIds,'-1,0',ApiConst::zero);
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(order_amount)) AS orderTotal")->group('buyer_id')->group('store_id')->fetchAll(); $res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(order_amount)) AS orderTotal")->group('buyer_id')->group('store_id')->fetchAll();
return $res; return $res;
} }
...@@ -848,6 +848,8 @@ class OrderModel extends \DAO\AbstractModel ...@@ -848,6 +848,8 @@ class OrderModel extends \DAO\AbstractModel
} }
$this->deleteGetListByMemberId($stroeId); $this->deleteGetListByMemberId($stroeId);
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
\DAO\Store\MemberFavoritesStoreStoreMemberStatisticsModel::getInstance()->deleteCacheGetGoodsCountOrderTotalByStoreId($stroeId);
$orderGoodsDao->deleteOrderGoodsCache($memberId, $orderId,$stroeId); $orderGoodsDao->deleteOrderGoodsCache($memberId, $orderId,$stroeId);
} }
......
...@@ -238,7 +238,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -238,7 +238,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
public function getMemberStoreStaticsByCreateTime($gmtCreate,$pageIndex,$pageSize){ public function getMemberStoreStaticsByCreateTime($gmtCreate,$pageIndex,$pageSize){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} ',$gmtCreate,TIMESTAMP); $where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} ',$gmtCreate,TIMESTAMP);
$res=$this->lists($where,array('gmt_create'=>'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;
} }
public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){ public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
......
...@@ -13,6 +13,7 @@ use Our\ImageConst; ...@@ -13,6 +13,7 @@ use Our\ImageConst;
class StoreModel extends \DAO\AbstractModel class StoreModel extends \DAO\AbstractModel
{ {
public $detailField= " member_id as memberId,store_id as storeId,offline_payway as offlinePayway,store_label as storeLabel";
protected function init() protected function init()
{ {
......
...@@ -20,6 +20,7 @@ class MemberFavoritesStoreStoreMemberStatisticsModel extends \DAO\AbstractModel ...@@ -20,6 +20,7 @@ class MemberFavoritesStoreStoreMemberStatisticsModel extends \DAO\AbstractModel
* @var string * @var string
*/ */
protected $_tableName = 'han_member-favorites_store-store_member_statistics'; protected $_tableName = 'han_member-favorites_store-store_member_statistics';
public $sumField='sum(order_total) as orderTotal,sum(order_goods_count) as orderGoodsCount';
public $field="fav_type as favType,member_id as memberId,member_mobile as memberMobile,is_backlist as isBacklist,fav_time as favTime,member_avatar as memberAvatar,member_name as memberName,order_total as orderTotal,order_goods_count as orderGoodsCount"; public $field="fav_type as favType,member_id as memberId,member_mobile as memberMobile,is_backlist as isBacklist,fav_time as favTime,member_avatar as memberAvatar,member_name as memberName,order_total as orderTotal,order_goods_count as orderGoodsCount";
/** /**
...@@ -130,7 +131,7 @@ class MemberFavoritesStoreStoreMemberStatisticsModel extends \DAO\AbstractModel ...@@ -130,7 +131,7 @@ class MemberFavoritesStoreStoreMemberStatisticsModel extends \DAO\AbstractModel
} }
public function getInfoByMemberId($memberId,$field='*',$isField=false) public function getInfoByMemberId($memberId,$field='*',$isField=false)
{ {
$this->setDb(); $this->setDb($this->dbName);
$where['member_id'] = $memberId; $where['member_id'] = $memberId;
$store = $this->db->from($this->_tableName)->select($field)->where($where)->fetchOne(); $store = $this->db->from($this->_tableName)->select($field)->where($where)->fetchOne();
if ($isField) { if ($isField) {
...@@ -139,7 +140,15 @@ class MemberFavoritesStoreStoreMemberStatisticsModel extends \DAO\AbstractModel ...@@ -139,7 +140,15 @@ class MemberFavoritesStoreStoreMemberStatisticsModel extends \DAO\AbstractModel
return $store; return $store;
} }
} }
public function getGoodsCountOrderTotalByStoreId($storeId){
$this->setDb($this->dbName);
$where['store_id']=$storeId;
$res=$this->db->from($this->_tableName)->select($this->sumField)->where($where)->fetchOne();
return $res?$res:[];
}
public function deleteCacheGetGoodsCountOrderTotalByStoreId($storeId){
return \Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getGoodsCountOrderTotalByStoreId'), array(),array($storeId));
}
/** /**
* 类实例 * 类实例
* *
......
<?php
/**
* User: liuyuzhen
* Date: 2018/9/26
* Time: 10:15
* Description:
*/
define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../../../')); //指向public的上一级
require APPLICATION_PATH . '/scripts/crontab/baseCli.php';
require APPLICATION_PATH . '/scripts/crontab/common.php';
error_reporting(E_ALL ^ E_NOTICE);
\Business\User\AddressServiceModel::getInstance()->createPinyin();
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