Commit e7044a6a authored by zhz's avatar zhz

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

parents 8fb5d14e 515123ec
...@@ -18,6 +18,9 @@ class HomeController extends \Our\Controller_AbstractIndex{ ...@@ -18,6 +18,9 @@ class HomeController extends \Our\Controller_AbstractIndex{
//获取地址相关信息 //获取地址相关信息
$currentAddress = $this->setAddressAction(true); $currentAddress = $this->setAddressAction(true);
if(!isset($currentAddress['addresses'])){
$currentAddress['addresses'] = array();
}
$returnData['currentAddress'] = $currentAddress; $returnData['currentAddress'] = $currentAddress;
$currentAddress = $this->sess->get('currentAddress'); $currentAddress = $this->sess->get('currentAddress');
......
...@@ -15,8 +15,6 @@ class StoreController extends \Our\Controller_AbstractIndex { ...@@ -15,8 +15,6 @@ class StoreController extends \Our\Controller_AbstractIndex {
public function getStoreInfoAction(){ public function getStoreInfoAction(){
$address = \Business\User\AddressServiceModel::getInstance()->getMyAddress($this->req[\Our\NameConst::data],$this->memberId); $address = \Business\User\AddressServiceModel::getInstance()->getMyAddress($this->req[\Our\NameConst::data],$this->memberId);
$storeInfo = $this->storeService->getStoreInfo($this->req[\Our\NameConst::data],$this->memberId, $address); $storeInfo = $this->storeService->getStoreInfo($this->req[\Our\NameConst::data],$this->memberId, $address);
//.
$storeInfo['adv'] = array('href'=>'','imageUrl'=>'http://qmoss-01.oss-cn-hangzhou.aliyuncs.com/data/upload/mall/adv/05715960161498410.jpg');
$storeInfo['share'] = \Business\Common\CommonServiceModel::getInstance()->getShareInfo(\Our\ApiConst::shareStore,$this->req[\Our\NameConst::data]['storeId']); $storeInfo['share'] = \Business\Common\CommonServiceModel::getInstance()->getShareInfo(\Our\ApiConst::shareStore,$this->req[\Our\NameConst::data]['storeId']);
$this->success($storeInfo); $this->success($storeInfo);
} }
......
...@@ -921,7 +921,7 @@ class OrderConfirmUtil { ...@@ -921,7 +921,7 @@ class OrderConfirmUtil {
if($tempOrder['coupon_id']>\Our\ApiConst::zero){ if($tempOrder['coupon_id']>\Our\ApiConst::zero){
$couponIds[$tempOrder['order_id']] = $tempOrder['coupon_id']; $couponIds[$tempOrder['order_id']] = $tempOrder['coupon_id'];
} }
$orderModel->deleteOrderCache($tempOrder['buyer_id'],$tempOrder['order_id']); $orderModel->deleteOrderCache($tempOrder['buyer_id'],$tempOrder['order_id'],$tempOrder['store_id'],true,true);
\Our\RedisHelper::memberTotalFromStateToState($tempOrder['buyer_id'],ApiConst::orderStateWaitPay,ApiConst::orderStateWaitConfirm); \Our\RedisHelper::memberTotalFromStateToState($tempOrder['buyer_id'],ApiConst::orderStateWaitPay,ApiConst::orderStateWaitConfirm);
} }
//送券、送礼品 //送券、送礼品
......
...@@ -11,7 +11,7 @@ class ApiConst ...@@ -11,7 +11,7 @@ class ApiConst
const randLengh = 8; const randLengh = 8;
//10天数秒 //10天数秒
const tenDaySecond = 86400; const tenDaySecond = 864000;
//const tenDaySecond = 300; //const tenDaySecond = 300;
//一天 //一天
const oneDaySecond = 86400; const oneDaySecond = 86400;
......
...@@ -140,7 +140,7 @@ class DescribeConst ...@@ -140,7 +140,7 @@ class DescribeConst
const payOnlineName = '线上支付'; //线上支付 const payOnlineName = '线上支付'; //线上支付
const payOfflineName = '线下支付'; //线下支付 const payOfflineName = '线下支付'; //线下支付
const payAogName = '到店自提'; //到店自提 const payAogName = '货到付款'; //货到付款
const refund='退款'; const refund='退款';
const refundRetund='退货'; const refundRetund='退货';
......
...@@ -48,6 +48,7 @@ class ImageConst{ ...@@ -48,6 +48,7 @@ class ImageConst{
const defaultStoreLabelName = 'default_store_avatar.jpg'; const defaultStoreLabelName = 'default_store_avatar.jpg';
const defaultStoreBannerName = 'default_store_banner.jpg';
//图片指向的域名 //图片指向的域名
const imageDomain="ossHost"; const imageDomain="ossHost";
......
...@@ -156,7 +156,7 @@ class NameConst { ...@@ -156,7 +156,7 @@ class NameConst {
const rightBracket = ']'; const rightBracket = ']';
const elasticName='elastic.master'; const elasticName='elastic.master';
const shopkeeper='orders'; const shopkeeper='shenbdindex';
const cancelUnPayedOrderTimePrefix = 'cancelUnPayedOrderTime'; const cancelUnPayedOrderTimePrefix = 'cancelUnPayedOrderTime';
const cancelUnReceivedOrderTimePrefix = 'cancelUnReceivedOrderTime'; const cancelUnReceivedOrderTimePrefix = 'cancelUnReceivedOrderTime';
......
...@@ -61,7 +61,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -61,7 +61,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$maxPrice = intval($param['maxPrice']); $maxPrice = intval($param['maxPrice']);
$goodsSort = intval($param['goodsSort']); $goodsSort = intval($param['goodsSort']);
$attrValue = $param['attrValue']; $attrValue = $param['attrValue'];
list($where,$order,$attrStr) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort); list($where,$order,$attrStr,$saleSort) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort);
$keyword && $where[] = "goods_name like '%{$keyword}%'"; $keyword && $where[] = "goods_name like '%{$keyword}%'";
$commonDAO = \DAO\GoodsCommonModel::getInstance(); $commonDAO = \DAO\GoodsCommonModel::getInstance();
$couponDao = \DAO\Coupon\CouponModel::getInstance(); $couponDao = \DAO\Coupon\CouponModel::getInstance();
...@@ -80,11 +80,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -80,11 +80,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where[] = 'goods_commonid in('.trim($ids,',').')'; $where[] = 'goods_commonid in('.trim($ids,',').')';
} }
} }
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
if($activities){ if($activities){
$activities = array_keys($activities); $activities = array_keys($activities);
$field = 'han_goods_common.goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_price,goods_marketprice AS goodsMarketPrice,goods_image AS goodsImage,IFNULL(discount_price,goods_price) AS goodsPrice'; $field = 'han_goods_common.goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_price,goods_marketprice AS goodsMarketPrice,goods_image AS goodsImage,IFNULL(discount_price,goods_price) AS goodsPrice';
if($storeId > 0){ if($storeId > 0){
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),\Our\ApiConst::oneDaySecond,array($storeId)); $list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),$ttl,array($storeId));
}else{ }else{
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),\Our\ApiConst::oneMinute,array(\Our\ApiConst::zero)); $list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),\Our\ApiConst::oneMinute,array(\Our\ApiConst::zero));
} }
...@@ -94,7 +95,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -94,7 +95,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$field = 'han_goods_common.'.$field; $field = 'han_goods_common.'.$field;
} }
if($storeId > 0 ){ if($storeId > 0 ){
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),\Our\ApiConst::oneDaySecond,array($storeId)); $list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),$ttl,array($storeId));
}else{ }else{
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),\Our\ApiConst::oneMinute,array(\Our\ApiConst::zero)); $list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),\Our\ApiConst::oneMinute,array(\Our\ApiConst::zero));
} }
...@@ -183,14 +184,17 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -183,14 +184,17 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}elseif ($maxPrice){ }elseif ($maxPrice){
$where[] = "goods_price <= {$maxPrice}"; $where[] = "goods_price <= {$maxPrice}";
} }
$saleSort = false;
$order = []; $order = [];
switch ($goodsSort){ switch ($goodsSort){
case 1: case 1:
$order[] = ['sale_num','DESC']; $order[] = ['sale_num','DESC'];
$order[] = ['eval_score','DESC']; $order[] = ['eval_score','DESC'];
$saleSort = true;
break; break;
case 2: case 2:
$order[] = ['sale_num','DESC']; $order[] = ['sale_num','DESC'];
$saleSort = true;
break; break;
case 3: case 3:
$order[] = ['goods_selltime','DESC']; $order[] = ['goods_selltime','DESC'];
...@@ -206,7 +210,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -206,7 +210,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$order[] = ['eval_score','DESC']; $order[] = ['eval_score','DESC'];
break; break;
} }
return array($where,$order,$attrStr); return array($where,$order,$attrStr,$saleSort);
} }
/** /**
* 获取商品列表 * 获取商品列表
...@@ -244,20 +248,21 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -244,20 +248,21 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$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) = $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);
$commonDAO = \DAO\GoodsCommonModel::getInstance(); $commonDAO = \DAO\GoodsCommonModel::getInstance();
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
if(!$activities){ if(!$activities){
$field = 'goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_price as goodsPrice,goods_marketprice AS goodsMarketPrice,goods_image AS goodsImage,goods_commend AS isRecoment,goods_new AS isNew,goods_hot AS isHot'; $field = 'goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_price as goodsPrice,goods_marketprice AS goodsMarketPrice,goods_image AS goodsImage,goods_commend AS isRecoment,goods_new AS isNew,goods_hot AS isHot';
if($attrStr){ if($attrStr){
$field = 'han_goods_common.'.$field; $field = 'han_goods_common.'.$field;
} }
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),\Our\ApiConst::oneDaySecond,array($storeId)); $list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getGoodsList'),array($where,$field,$limit,$order,$attrStr),$ttl,array($storeId));
}else{ }else{
$activities = array_keys($activities); $activities = array_keys($activities);
$field = 'han_goods_common.goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_price,goods_marketprice AS goodsMarketPrice,goods_image AS goodsImage,goods_commend AS isRecoment,goods_new AS isNew,goods_hot AS isHot,IFNULL(discount_price,han_goods_common.goods_price) AS goodsPrice'; $field = 'han_goods_common.goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_price,goods_marketprice AS goodsMarketPrice,goods_image AS goodsImage,goods_commend AS isRecoment,goods_new AS isNew,goods_hot AS isHot,IFNULL(discount_price,han_goods_common.goods_price) AS goodsPrice';
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),\Our\ApiConst::oneDaySecond,array($storeId)); $list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$activities,$limit,$order,$attrStr),$ttl,array($storeId));
} }
$goods = []; $goods = [];
if(is_array($list) && !empty($list)){ if(is_array($list) && !empty($list)){
...@@ -345,14 +350,24 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -345,14 +350,24 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
//商品图片表 //商品图片表
$goodsImagesInstance = \DAO\GoodsImagesModel::getInstance(); $goodsImagesInstance = \DAO\GoodsImagesModel::getInstance();
$image = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsImagesRedisModel::getInstance(),array(&$goodsImagesInstance, 'getListByCommonId'),array($goodsCommonId,'attr_name,attr_value,goods_image'),\Our\ApiConst::oneDaySecond,array($goodsCommonId)); $image = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsImagesRedisModel::getInstance(),array(&$goodsImagesInstance, 'getListByCommonId'),array($goodsCommonId,'attr_name,attr_value,goods_image'),\Our\ApiConst::oneDaySecond,array($goodsCommonId));
$attrImage = [];
$images = []; $images = [];
$haveImg = false;
$goodsImageGroup = unserialize($commonInfo['goods_image_group']);
if($goodsImageGroup) {
$haveImg = true;
foreach ($goodsImageGroup as $v) {
$images[] = \Our\ImageUtil::getGoodsImgUrl($v,\Our\ImageConst::goodsDetailImgSize);
}
}
$attrImage = [];
if($image && is_array($image)){ if($image && is_array($image)){
$i = 0; $i = 0;
foreach ($image as $k=>$v){ foreach ($image as $k=>$v){
$image[$k]['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::SpecSelectGoodsImgSize); $image[$k]['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::SpecSelectGoodsImgSize);
$attrImage[$v['attr_name']][$v['attr_value']][] = $image[$k]['goods_image']; $attrImage[$v['attr_name']][$v['attr_value']][] = $image[$k]['goods_image'];
if($i < 5 ){ if($i < 5 && !$haveImg){
$images[] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::goodsDetailImgSize); $images[] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::goodsDetailImgSize);
} }
$i += 1; $i += 1;
...@@ -1105,14 +1120,27 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1105,14 +1120,27 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/ */
public function storeOnlineGoodsClass(){ public function storeOnlineGoodsClass(){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance(); $storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
$plusFlag = false;
$minusFlag = false;
for($i=0;$i<2000;$i++){ for($i=0;$i<2000;$i++){
$goodsClassStr = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::plus); $goodsClassStr = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::plus);
$goodsClass = unserialize($goodsClassStr); if($goodsClassStr&&$plusFlag==false){
$this->checkExistOnlineGoodsClass($goodsClass); $goodsClass = unserialize($goodsClassStr);
$this->checkExistOnlineGoodsClass($goodsClass);
}else{
$plusFlag=true;
}
$goodsClassStrMinus = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::minus); $goodsClassStrMinus = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::minus);
$goodsClassMinus = unserialize($goodsClassStrMinus); if($goodsClassStrMinus&&$minusFlag==false){
$this->checkRemoveOnlineGoodsClass($goodsClassMinus); $goodsClassMinus = unserialize($goodsClassStrMinus);
$this->checkRemoveOnlineGoodsClass($goodsClassMinus);
}else{
$minusFlag = true;
}
if($plusFlag&&$minusFlag){
break;
}
} }
} }
...@@ -1123,7 +1151,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1123,7 +1151,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/ */
public function checkExistOnlineGoodsClass($goodsClass){ public function checkExistOnlineGoodsClass($goodsClass){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance(); $storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
$oldTemp = $storeOnlineGoodsClassDao->find($goodsClass); $oldTemp = $storeOnlineGoodsClassDao->findByWhere($goodsClass);
if(!$oldTemp){ if(!$oldTemp){
$storeOnlineGoodsClassDao->insert($goodsClass); $storeOnlineGoodsClassDao->insert($goodsClass);
} }
...@@ -1157,18 +1185,23 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1157,18 +1185,23 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$topSaleList = array(); $topSaleList = array();
for($i=0;$i<2000;$i++){ for($i=0;$i<2000;$i++){
$storeId = $storeTopSaleGoodsModel->getChangedSaleStoreId(); $storeId = $storeTopSaleGoodsModel->getChangedSaleStoreId();
if(!$storeId){ if($storeId===false){
break; break;
} }
if(!($storeIds&&in_array($storeId,$storeIds))){ if($storeId){
$topSaleList=$storeTopSaleGoodsModel->getStoreTopSaleGoodsListByStoreId($storeId); if(($storeIds&&in_array($storeId,$storeIds))){
$storeTopSaleList = $this->getNewStoreTopSaleGoodsList($topSaleList,$storeId); continue;
}
$topSaleListTemp=$storeTopSaleGoodsModel->getStoreTopSaleGoodsListByStoreId($storeId);
$storeTopSaleList = $this->getNewStoreTopSaleGoodsList($topSaleListTemp,$storeId);
$topSaleList = $topSaleList?array_merge($topSaleList,$storeTopSaleList):$storeTopSaleList; $topSaleList = $topSaleList?array_merge($topSaleList,$storeTopSaleList):$storeTopSaleList;
} }
} }
\Our\Log::getInstance()->write(json_encode($topSaleList)); if($topSaleList){
$result = $storeTopSaleGoodsModel->insertAllOrUpdate($topSaleList); $result = $storeTopSaleGoodsModel->insertAllOrUpdate($topSaleList);
\Our\Log::getInstance()->write('店铺销量更新'.($result?'success':'fail')); \Our\Log::getInstance()->write('店铺销量更新'.($result?'success':'fail'));
}
\Our\Log::getInstance()->write('本次没有店铺数据需要更新');
} }
/** /**
......
...@@ -255,7 +255,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -255,7 +255,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
public function getStorePBundlingList($storeId,$dbName = \Our\DbNameConst::salveDBConnectName,$withKeyFlag= false,$limit = ''){ public function getStorePBundlingList($storeId,$dbName = \Our\DbNameConst::salveDBConnectName,$withKeyFlag= false,$limit = ''){
$pbundlingInstance = \DAO\PBundlingModel::getInstance($dbName); $pbundlingInstance = \DAO\PBundlingModel::getInstance($dbName);
$limit == '' ? $limit = array(\Our\ApiConst::zero,\Our\ApiConst::five) : $limit = $limit; $limit == '' ? $limit = array(\Our\ApiConst::zero,\Our\ApiConst::five) : $limit = $limit;
$groupList = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(),array(&$pbundlingInstance, 'getList'),array($this->pBundingField,array('store_id'=>$storeId),$limit),\Our\ApiConst::oneDaySecond); $groupList = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(),array(&$pbundlingInstance, 'getList'),array($this->pBundingField,array('store_id'=>$storeId),$limit),\Our\ApiConst::oneDaySecond, array($storeId));
$newGroupList = $this->getPBundlingList($groupList,$dbName,$withKeyFlag); $newGroupList = $this->getPBundlingList($groupList,$dbName,$withKeyFlag);
return $newGroupList; return $newGroupList;
} }
......
...@@ -25,7 +25,7 @@ use Our\Push; ...@@ -25,7 +25,7 @@ use Our\Push;
*/ */
class OrderServiceModel extends \Business\AbstractModel class OrderServiceModel extends \Business\AbstractModel
{ {
private $orderField = "order_id as orderId,order_sn as orderSn,store_name as storeName,evaluation_state as evaluationState,add_time as addTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment"; private $orderField = "order_id as orderId,order_sn as orderSn,store_name as storeName,evaluation_state as evaluationState,add_time as addTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,payment_time as paymentTime,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment";
private $orderGoodsField = "order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,refund_state_name as refundStateName,refund_id as refundId"; private $orderGoodsField = "order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,refund_state_name as refundStateName,refund_id as refundId";
private $addressField = " mob_phone as MobPhone,tel_phone as TelPhone,address as address,area_info as areaInfo,lng,lat,address_id as addressId,subaddress as subAddress"; private $addressField = " mob_phone as MobPhone,tel_phone as TelPhone,address as address,area_info as areaInfo,lng,lat,address_id as addressId,subaddress as subAddress";
...@@ -293,7 +293,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -293,7 +293,7 @@ class OrderServiceModel extends \Business\AbstractModel
$orderGoodsDao->update($where,$orderGoodsUpdateData); $orderGoodsDao->update($where,$orderGoodsUpdateData);
} }
if ($memberId) { if ($memberId) {
$orderDao->deleteOrderCache($memberId, $orderId, $order['store_id']); $orderDao->deleteOrderCache($memberId, $orderId, $order['store_id'],true);
// $memberDao->fromOrderStateToOrderState($memberId,$order['order_state'],ApiConst::orderStateCancel); // $memberDao->fromOrderStateToOrderState($memberId,$order['order_state'],ApiConst::orderStateCancel);
} }
} }
...@@ -315,7 +315,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -315,7 +315,7 @@ class OrderServiceModel extends \Business\AbstractModel
if ($isAllowConfirm) { if ($isAllowConfirm) {
$res = $orderDao->updateStatusByOrderId($orderId, ApiConst::orderStateComplete, TRUE); $res = $orderDao->updateStatusByOrderId($orderId, ApiConst::orderStateComplete, TRUE);
if ($res) { if ($res) {
$orderDao->deleteOrderCache($memberId, $orderId, $order['store_id']); $orderDao->deleteOrderCache($memberId, $orderId, $order['store_id'],true);
return true; return true;
} else { } else {
ErrorModel::throwException(CodeConfigModel::receiveError); ErrorModel::throwException(CodeConfigModel::receiveError);
...@@ -520,7 +520,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -520,7 +520,7 @@ class OrderServiceModel extends \Business\AbstractModel
if(!$update || !$res){ if(!$update || !$res){
echo '订单:'.$order['orderId'].'没取消成功!'; echo '订单:'.$order['orderId'].'没取消成功!';
} }
$orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId']); $orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId'],true);
} }
$orderIds = array_column($orders, 'orderId'); $orderIds = array_column($orders, 'orderId');
//更新商品库存 //更新商品库存
...@@ -571,7 +571,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -571,7 +571,7 @@ class OrderServiceModel extends \Business\AbstractModel
$this->changeOrderStateCancelUnconditional($order); $this->changeOrderStateCancelUnconditional($order);
} }
} }
$orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId']); $orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId'],true);
} }
$orderIds = array_column($orders, 'orderId'); $orderIds = array_column($orders, 'orderId');
...@@ -623,13 +623,13 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -623,13 +623,13 @@ class OrderServiceModel extends \Business\AbstractModel
if ($order['shippingType'] == ApiConst::bySeller) { if ($order['shippingType'] == ApiConst::bySeller) {
if (isset($qmDeliverymanLogsOrderIds[$order['orderId']])) { if (isset($qmDeliverymanLogsOrderIds[$order['orderId']])) {
array_push($sellerOrderIds, $order['orderId']); array_push($sellerOrderIds, $order['orderId']);
$orderDao->deleteOrderCache($order['buyerId'], $order['orderId'], $order['storeId']); $orderDao->deleteOrderCache($order['buyerId'], $order['orderId'], $order['storeId'],true);
} }
} else { } else {
$limitTime = TIMESTAMP - ApiConst::orderWaitRecieveThreeDays; $limitTime = TIMESTAMP - ApiConst::orderWaitRecieveThreeDays;
if ($order['acceptTime'] < $limitTime) { if ($order['acceptTime'] < $limitTime) {
array_push($expressOrderIds, $order['orderId']); array_push($expressOrderIds, $order['orderId']);
$orderDao->deleteOrderCache($order['buyerId'], $order['orderId'], $order['storeId']); $orderDao->deleteOrderCache($order['buyerId'], $order['orderId'], $order['storeId'],true);
} }
} }
\Our\RedisHelper::memberTotalFromStateToState($order['buyerId'], $order['orderState'], ApiConst::orderStateComplete); \Our\RedisHelper::memberTotalFromStateToState($order['buyerId'], $order['orderState'], ApiConst::orderStateComplete);
...@@ -702,19 +702,21 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -702,19 +702,21 @@ class OrderServiceModel extends \Business\AbstractModel
$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);
$diliverymanId = $memberDao->getInfo($memberId, 'diliveryman_id'); $diliverymanId = $memberDao->getInfo($memberId, 'diliveryman_id');
$diliverymanId=46;
if (empty($diliverymanId)) { if (empty($diliverymanId)) {
ErrorModel::throwException(CodeConfigModel::commonError); ErrorModel::throwException(CodeConfigModel::commonError);
} }
$qmDeliveryLogList = $QmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanId, $type, $pageIndex, $pageSize); $qmDeliveryLogList = $QmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanId, $type, $pageIndex, $pageSize);
$orderIds = array_column($qmDeliveryLogList['list'], 'orderId'); $orderIds = array_column($qmDeliveryLogList['list'], 'orderId');
$where['delete_state'] = ApiConst::undeleteOrder; // echo json_encode($orderIds);exit;
//$orderIds=implode(',',$orderIds); // $where['delete_state'] = ApiConst::undeleteOrder;
$where['order_id'] = array('in', $orderIds); $orderIds=implode(',',$orderIds);
$where['lock_state'] = ApiConst::zero; $where =Common::format(" order_id in({0})",$orderIds);
// $where['lock_state'] = ApiConst::zero;
//获得订单列表 //获得订单列表
//$orders=$orderDao->getList($where, $this->orderField, $pageIndex, $pageSize, $order = array('add_time' => 'desc')); // $orders=$orderDao->getList($where, $this->orderField, $pageIndex, $pageSize, $order = array('add_time' => 'desc'));
$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($diliverymanId)); $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($diliverymanId));
$goodsDao = \DAO\GoodsModel::getInstance(); $goodsDao = \DAO\GoodsModel::getInstance();
$orderIds = array_column($orders['list'], 'orderId'); $orderIds = array_column($orders['list'], 'orderId');
...@@ -722,7 +724,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -722,7 +724,7 @@ class OrderServiceModel extends \Business\AbstractModel
//获得订单商品列表 //获得订单商品列表
if (!empty($orderIds)) { if (!empty($orderIds)) {
$orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderIds, $this->orderGoodsField), \Our\ApiConst::oneDaySecond, array($diliverymanId)); $orderGoods = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsByOrderIds'), array($orderIds, $this->orderGoodsField), \Our\ApiConst::oneDaySecond, array($diliverymanId.'_'));
$orderMerge = Common::intergrateOneToMany($orders['list'], $orderGoods, 'orderId', 'orderId', 'orderGoods'); $orderMerge = Common::intergrateOneToMany($orders['list'], $orderGoods, 'orderId', 'orderId', 'orderGoods');
$orderMerge = Common::intergrateOneToOne($orderMerge, $orderCommons, 'orderId', 'orderId'); $orderMerge = Common::intergrateOneToOne($orderMerge, $orderCommons, 'orderId', 'orderId');
$orderMerge = $orderDao->convertOrderList($orderMerge); $orderMerge = $orderDao->convertOrderList($orderMerge);
...@@ -737,13 +739,13 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -737,13 +739,13 @@ class OrderServiceModel extends \Business\AbstractModel
$delivery['finishTime'] = $value['finishTime']; $delivery['finishTime'] = $value['finishTime'];
$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'] = $goodsDao->convert($orderMerge[$value['orderId']]['orderGoods']); $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['reciverInfo']['street'];
$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'] : '';
unset($delivery['goodsAmount']); unset($delivery['goodsAmount']);
unset($delivery['orderState']); // unset($delivery['orderState']);
unset($delivery['refundState']); unset($delivery['refundState']);
unset($delivery['goodsAmount']); unset($delivery['goodsAmount']);
unset($delivery['reciverInfo']); unset($delivery['reciverInfo']);
...@@ -841,7 +843,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -841,7 +843,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']); $orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId'], $order['storeId'],true);
$qmDeliverymanLogDao->deleteOrderCache($deliverymanId, $id); $qmDeliverymanLogDao->deleteOrderCache($deliverymanId, $id);
return $updateResult; return $updateResult;
} else { } else {
...@@ -886,6 +888,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -886,6 +888,7 @@ class OrderServiceModel extends \Business\AbstractModel
$orderContent['payway'] = \Our\DescribeConst::afterPay; $orderContent['payway'] = \Our\DescribeConst::afterPay;
} }
$orderContent['orderAmount'] = $order['order_amount']; $orderContent['orderAmount'] = $order['order_amount'];
$orderContents[]=$orderContent;
} }
$orderIds[] = $order['order_id']; $orderIds[] = $order['order_id'];
} }
......
...@@ -397,15 +397,17 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -397,15 +397,17 @@ class RefundServiceModel extends \Business\AbstractModel
$refundArray['refund_shipping_type']=isset($refund['refundShippingType'])?$refund['refundShippingType']:ApiConst::zero; $refundArray['refund_shipping_type']=isset($refund['refundShippingType'])?$refund['refundShippingType']:ApiConst::zero;
$refundArrayUnLine=Common::convertUnderline($refundArray); $refundArrayUnLine=Common::convertUnderline($refundArray);
$state = $refundReturnDao->addRefundReturn($refundArray,$orderInfo,$orderGoods); $state = $refundReturnDao->addRefundReturn($refundArray,$orderInfo,$orderGoods);
$orderDao->deleteOrderCache($memberId,$orderInfo['orderId'],$orderInfo['storeId'],true);
$refundReturnDao->deleteRefundCache($memberId);
if ($state) { if ($state) {
$orderDao->deleteOrderCache($memberId,$refund['orderId']);
$refundReturnDao->deleteRefundCache($memberId);
$refundStateName=$refundReturnDao->getRefundTextStatus($refundArrayUnLine); $refundStateName=$refundReturnDao->getRefundTextStatus($refundArrayUnLine);
$orderGoodsDao->update(array('rec_id'=>$orderGoods['recId']),array('refund_state_name'=>$refundStateName,'refund_id'=>$state)); $orderGoodsDao->update(array('rec_id'=>$orderGoods['recId']),array('refund_state_name'=>$refundStateName,'refund_id'=>$state));
$orderLogDao->addRefundOrderLog($orderInfo['orderId'],$refundArray['refund_type'],DescribeConst::buyer,$orderInfo['buyerName'],$orderInfo['orderState']); $orderLogDao->addRefundOrderLog($orderInfo['orderId'],$refundArray['refund_type'],DescribeConst::buyer,$orderInfo['buyerName'],$orderInfo['orderState']);
if ($orderInfo['orderState'] == ApiConst::orderStateWaitRecieve) { if ($orderInfo['orderState'] == ApiConst::orderStateWaitRecieve) {
$orderDao->editOrderLock($orderInfo['orderId']); $orderDao->editOrderLock($orderInfo['orderId']);
} }
return $state; return $state;
} else { } else {
ErrorModel::throwException(CodeConfigModel::refundRefuseByStore); ErrorModel::throwException(CodeConfigModel::refundRefuseByStore);
...@@ -446,8 +448,13 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -446,8 +448,13 @@ class RefundServiceModel extends \Business\AbstractModel
} else { } else {
$address = $addressDao->getAddressByStoreId($refundReturn['storeId'], $this->daddressField); $address = $addressDao->getAddressByStoreId($refundReturn['storeId'], $this->daddressField);
} }
$address['isDefault'] = (int)$address['isDefault']; if(!empty($address)){
$info['dAddressInfo'] = $address; $address['isDefault'] = (int)$address['isDefault'];
$info['dAddressInfo'] = $address;
}else{
$info['dAddressInfo'] =new \stdClass();
}
} else { } else {
$info['dAddressInfo'] = new \stdClass(); $info['dAddressInfo'] = new \stdClass();
} }
......
...@@ -53,6 +53,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -53,6 +53,8 @@ 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();
$orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance();
$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));
...@@ -64,7 +66,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -64,7 +66,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$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'] = ApiConst::zero; $data['goodsCount'] = $goodsCount;
$data['orderCount'] =$storeStats['orderCount']; $data['orderCount'] =$storeStats['orderCount'];
$data['orderTotal'] = $storeStats['orderTotal']; $data['orderTotal'] = $storeStats['orderTotal'];
$data['favCount'] = $storeFavariteCount['favCount']; $data['favCount'] = $storeFavariteCount['favCount'];
...@@ -237,7 +239,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -237,7 +239,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} else { } else {
$update_data['order_state'] = ApiConst::orderStateWaitSend; $update_data['order_state'] = ApiConst::orderStateWaitSend;
$result = $orderDao->update($where, $update_data); $result = $orderDao->update($where, $update_data);
$orderDao->deleteOrderCache($order['buyer_id'], $orderId,$order['store_id']); $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);
return $result; return $result;
} }
...@@ -527,7 +529,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -527,7 +529,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
{ {
$elasticsTool = ElasticsToolModel::getInstance('orders'); $elasticsTool = ElasticsToolModel::getInstance('orders');
// $elasticsTool->deleteIndex(); $elasticsTool->deleteIndex();
$indexsFiled = array( $indexsFiled = array(
'goodsName' => array( 'goodsName' => array(
'type' => 'string', 'type' => 'string',
...@@ -537,6 +539,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -537,6 +539,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
'type' => 'string', 'type' => 'string',
"analyzer" => "ik_max_word" "analyzer" => "ik_max_word"
), ),
'orderSn' => array(
'type' => 'string',
"index" => "not_analyzed"
),
); );
$elasticsTool->createIkField($indexsFiled); $elasticsTool->createIkField($indexsFiled);
} }
......
...@@ -454,6 +454,9 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -454,6 +454,9 @@ class AddressServiceModel extends \Business\AbstractModel {
if(!($address['address']&&$address['name'])){ if(!($address['address']&&$address['name'])){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyAddressAndName); \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyAddressAndName);
} }
if(!($address['tag_type']>=\Our\ApiConst::zero&&$address['tag_type']<=3)){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongAddressTagType);
}
if($province){ if($province){
$province = mb_substr($province,0,2); $province = mb_substr($province,0,2);
$provinceList = $areaList[\Our\ApiConst::zero]; $provinceList = $areaList[\Our\ApiConst::zero];
......
...@@ -84,6 +84,7 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{ ...@@ -84,6 +84,7 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{
* @return mixed * @return mixed
*/ */
public function getStoreTopSaleGoodsListByStoreId($storeId){ public function getStoreTopSaleGoodsListByStoreId($storeId){
$this->setDb();
$sql = \Our\Common::format('SELECT a.store_id,a.sale_num,a.goods_commonid,IFNULL((evaluation_score/evaluation_number),{0}) as goods_score,a.group_id as rank,a.goods_name,a.goods_image $sql = \Our\Common::format('SELECT a.store_id,a.sale_num,a.goods_commonid,IFNULL((evaluation_score/evaluation_number),{0}) as goods_score,a.group_id as rank,a.goods_name,a.goods_image
FROM FROM
( (
...@@ -93,7 +94,7 @@ FROM han_goods_common t1 where t1.goods_state={1} and t1.goods_verify={2} and t1 ...@@ -93,7 +94,7 @@ FROM han_goods_common t1 where t1.goods_state={1} and t1.goods_verify={2} and t1
left join han_goods_score_statistics b left join han_goods_score_statistics b
on a.goods_commonid = b.goods_commonid on a.goods_commonid = b.goods_commonid
WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\ApiConst::onlineGoodsState,\Our\ApiConst::onlineGoodsVerify,$storeId); WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\ApiConst::onlineGoodsState,\Our\ApiConst::onlineGoodsVerify,$storeId);
$list = $this->db->query($sql)->fetchAll(); $list = $this->db->query($sql)->rows;
return $list; return $list;
} }
...@@ -101,6 +102,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\Api ...@@ -101,6 +102,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\Api
* @return mixed * @return mixed
*/ */
public function getSourceGoodsList(){ public function getSourceGoodsList(){
$this->setDb();
$sql = 'SELECT a.store_id,a.goods_commonid,IFNULL(a.evaluation_score/a.evaluation_number,'.\Our\ApiConst::defaultGoodsScore.') as goods_score,a.group_id as rank,a.goods_name,a.goods_image $sql = 'SELECT a.store_id,a.goods_commonid,IFNULL(a.evaluation_score/a.evaluation_number,'.\Our\ApiConst::defaultGoodsScore.') as goods_score,a.group_id as rank,a.goods_name,a.goods_image
FROM FROM
( (
...@@ -111,7 +113,7 @@ on t1.goods_commonid = t2.goods_commonid ...@@ -111,7 +113,7 @@ on t1.goods_commonid = t2.goods_commonid
where t1. where t1.
) a ) a
WHERE a.group_id<=3 AND a.sale_num>0 and a.goods_state=1 and a.goods_verify=1 ORDER BY a.store_id ,a.group_id'; WHERE a.group_id<=3 AND a.sale_num>0 and a.goods_state=1 and a.goods_verify=1 ORDER BY a.store_id ,a.group_id';
$list = $this->db->query($sql)->fetchAll(); $list = $this->db->query($sql)->rows;
return $list; return $list;
} }
...@@ -121,7 +123,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 and a.goods_state=1 and a.goods_verify=1 OR ...@@ -121,7 +123,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 and a.goods_state=1 and a.goods_verify=1 OR
$baseSql = "insert into {$this->_tableName}(store_id,goods_commonid,goods_score,rank,goods_name,goods_image) values"; $baseSql = "insert into {$this->_tableName}(store_id,goods_commonid,goods_score,rank,goods_name,goods_image) values";
$insertAllSql = $baseSql; $insertAllSql = $baseSql;
for ($i = 0; $i < count($datas); $i++) { for ($i = 0; $i < count($datas); $i++) {
$addSql = \Our\Common::format("({0},{1},{2},{3},{4},{5}),", $datas[$i]['store_id'],$datas[$i]['goods_commonid'], $datas[$i]['goods_score'], $datas[$i]['rank'],$datas[$i]['goods_name'],$datas[$i]['goods_image']); $addSql = \Our\Common::format("('{0}','{1}','{2}','{3}','{4}','{5}'),", $datas[$i]['store_id'],$datas[$i]['goods_commonid'], $datas[$i]['goods_score'], $datas[$i]['rank'],$datas[$i]['goods_name'],$datas[$i]['goods_image']);
$insertAllSql .= $addSql; $insertAllSql .= $addSql;
if ($i % 1000 == 0 && $i != 0) { if ($i % 1000 == 0 && $i != 0) {
$insertAllSql = rtrim($insertAllSql, ','); $insertAllSql = rtrim($insertAllSql, ',');
......
...@@ -36,6 +36,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{ ...@@ -36,6 +36,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
public function insert($data){ public function insert($data){
$this->setDb(\Our\DbNameConst::masterDBConnectName); $this->setDb(\Our\DbNameConst::masterDBConnectName);
$data['gmt_create'] = TIMESTAMP; $data['gmt_create'] = TIMESTAMP;
$data['gmt_update'] = TIMESTAMP;
$result = $this->db->insert($this->_tableName)->rows($data)->execute(); $result = $this->db->insert($this->_tableName)->rows($data)->execute();
if($result){ if($result){
$storeId = $data['store_id']; $storeId = $data['store_id'];
...@@ -47,9 +48,11 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{ ...@@ -47,9 +48,11 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
public function del($where){ public function del($where){
$this->setDb(\Our\DbNameConst::masterDBConnectName); $this->setDb(\Our\DbNameConst::masterDBConnectName);
$temp = $this->findByWhere($where);
$result = $this->db->delete($this->_tableName)->where($where)->execute(); $result = $this->db->delete($this->_tableName)->where($where)->execute();
if($result){
$storeId = $where['store_id'];
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$this, 'getList'),array(),array($storeId));
}
return $result; return $result;
} }
...@@ -130,7 +133,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{ ...@@ -130,7 +133,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
$this->addChangedGoodsClass(serialize($goodsClass),$type); $this->addChangedGoodsClass(serialize($goodsClass),$type);
if($goodsCommon['goods_class_t_id']){ if($goodsCommon['goods_class_t_id']){
$goodsClass['gc_id_3'] = $goodsCommon['goods_class_t_id']; $goodsClass['gc_id_3'] = $goodsCommon['goods_class_t_id'];
$goodsClass['gc_from'] = \Our\ApiConst::zero; $goodsClass['gc_from'] = \Our\ApiConst::one;
$this->addChangedGoodsClass(serialize($goodsClass),$type); $this->addChangedGoodsClass(serialize($goodsClass),$type);
} }
return true; return true;
......
...@@ -800,7 +800,10 @@ class OrderModel extends \DAO\AbstractModel ...@@ -800,7 +800,10 @@ class OrderModel extends \DAO\AbstractModel
if ($deleteGetFavoritesCountByStoreId) { if ($deleteGetFavoritesCountByStoreId) {
$favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance(); $favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance();
$favoritesStoreDao->deleteGetFavoritesCountByStoreId($stroeId); $favoritesStoreDao->deleteGetFavoritesCountByStoreId($stroeId);
} }
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao->deleteOrderGoodsCache($memberId, $orderId,$stroeId);
} }
if(!empty($diliverymanId)){ if(!empty($diliverymanId)){
......
...@@ -28,6 +28,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -28,6 +28,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
*/ */
protected $_primaryKey = 'rec_id'; protected $_primaryKey = 'rec_id';
public $orderGoodsGoodsNumCountField=" sum(goods_num) as goodsNum";
public function init(){ public function init(){
...@@ -57,10 +58,16 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -57,10 +58,16 @@ class OrderGoodsModel extends \DAO\AbstractModel {
} }
public function getOrderGoods($where,$field,$db=DbNameConst::salveDBConnectName){ public function getOrderGoods($where,$field,$db=DbNameConst::salveDBConnectName){
$this->setDb($db); $this->setDb($this->dbName);
$list = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll(); $list = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
return $list; return $list;
} }
public function getOrderGoodsCountByStoreId($storeId){
$this->setDb($this->dbName);
$where['store_id']=$storeId;
$goodsCount = $this->db->select($this->orderGoodsGoodsNumCountField)->from($this->_tableName)->where($where)->fetchNum();
return $goodsCount;
}
/** /**
* 获取单条数据 * 获取单条数据
* @param $where * @param $where
...@@ -100,13 +107,21 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -100,13 +107,21 @@ class OrderGoodsModel extends \DAO\AbstractModel {
return $this->getOrderGoods($where,$field); return $this->getOrderGoods($where,$field);
} }
public function deleteOrderGoodsCache($memberId,$orderIds){ public function deleteOrderGoodsCache($memberId,$orderIds,$storeId=false){
if($memberId){ if($memberId){
return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsByOrderIds'), array($memberId)); // return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::get:Instance(), array(&$this, 'getOrderGoodsByOrderIds'), array($memberId));
// \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getO:rderGoodsByOrderIds'), array($memberId));
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsByOrderIds'),array(),array($memberId));
} }
if($orderIds){ if($orderIds){
return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsByOrderIds'), array($orderIds)); //return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsByOrderIds'), array(),array($orderIds));
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsByOrderIds'), array(),array($orderIds));
}
if(!empty($storeId)){
// return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsCountByStoreId'), array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsCountByStoreId'), array(),array($storeId));
} }
return true;
} }
public function getIsRefundMoney($orderGoodses,$promotionsId){ public function getIsRefundMoney($orderGoodses,$promotionsId){
$isRefundMoney=ApiConst::zero; $isRefundMoney=ApiConst::zero;
...@@ -130,7 +145,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -130,7 +145,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
public function getRefundOrderGoodsIds($orderGoods){ public function getRefundOrderGoodsIds($orderGoods){
$orderGoods=array_values($orderGoods); $orderGoods=array_values($orderGoods);
for($i=ApiConst::zero;$i<count($orderGoods);$i++){ for($i=ApiConst::zero;$i<count($orderGoods);$i++){
if($orderGoods[$i]['isRefund']==ApiConst::refundSuccess){ if($orderGoods[$i]['refundId']==ApiConst::zero){
unset($orderGoods[$i]); unset($orderGoods[$i]);
} }
} }
......
...@@ -105,8 +105,9 @@ class StoreModel extends \DAO\AbstractModel ...@@ -105,8 +105,9 @@ class StoreModel extends \DAO\AbstractModel
if ($img) { if ($img) {
$storeLabel = \Our\Common::getStaticFile($img, \Our\ImageConst::storeLabel, 'ossHost'); $storeLabel = \Our\Common::getStaticFile($img, \Our\ImageConst::storeLabel, 'ossHost');
} else { } else {
$storeLabel = \Our\Common::getStaticFile(ImageConst::defaultStoreLabelName, ImageConst::defaultPath); $storeLabel = \Our\Common::getStaticFile(ImageConst::defaultStoreBannerName, ImageConst::defaultPath);
} }
$storeLabel .= "?x-oss-process=image/resize,m_fill,h_314,w_750";
return $storeLabel; return $storeLabel;
} }
/** /**
......
...@@ -354,6 +354,7 @@ const notAllowDelete=300114; ...@@ -354,6 +354,7 @@ const notAllowDelete=300114;
const emptyCityId = 140019; const emptyCityId = 140019;
const emptyDistrictId = 140020; const emptyDistrictId = 140020;
const emptyAddressAndName = 140021; const emptyAddressAndName = 140021;
const wrongAddressTagType = 140022;
//消息,推送等 //消息,推送等
const removeMessage=150001; const removeMessage=150001;
...@@ -580,6 +581,7 @@ const notAllowDelete=300114; ...@@ -580,6 +581,7 @@ const notAllowDelete=300114;
self::emptyCityId => '找不到对应城市', self::emptyCityId => '找不到对应城市',
self::emptyDistrictId => '找不到对应区', self::emptyDistrictId => '找不到对应区',
self::emptyAddressAndName => '地址和具体街道不能为空', self::emptyAddressAndName => '地址和具体街道不能为空',
self::wrongAddressTagType => '地址标签传输错误',
self::emptyLatLng => '经纬度不能为空', self::emptyLatLng => '经纬度不能为空',
self::emptyCityCode => '高德地图城市编码不能为空', self::emptyCityCode => '高德地图城市编码不能为空',
...@@ -755,7 +757,7 @@ const notAllowDelete=300114; ...@@ -755,7 +757,7 @@ const notAllowDelete=300114;
self::updateMobileMembmerFailed => '更新手机号对应会员信息失败', self::updateMobileMembmerFailed => '更新手机号对应会员信息失败',
self::updateMobileMembmerMappingFailed => '更新手机号码对应会员mapping信息失败', self::updateMobileMembmerMappingFailed => '更新手机号码对应会员mapping信息失败',
self::currentMobileHasBeenBind => '当前手机号码已经绑定其他微信,如需绑定,请先手机号码登录app进行微信解绑', self::currentMobileHasBeenBind => '当前手机号码已经绑定其他微信,如需绑定,请先手机号码登录app进行微信解绑',
self::otherDriverLogin=>'当前用户已被其他设备登录,请重新登录', self::otherDriverLogin=>'当前帐户在其他设备登录,假如不是您本人操作,请尽快修改密码',
self::elasticsError=>'全文索引连接出错', self::elasticsError=>'全文索引连接出错',
self::emptyLog => '日志内容不能为空', self::emptyLog => '日志内容不能为空',
self::writeLogFailed => '日志写入失败', self::writeLogFailed => '日志写入失败',
......
...@@ -96,7 +96,8 @@ class AbstractModel extends \Redis\AbstractModel { ...@@ -96,7 +96,8 @@ class AbstractModel extends \Redis\AbstractModel {
return $this->lpush($this->calcKey($h),$value); return $this->lpush($this->calcKey($h),$value);
} }
public function tableLPop($h){ public function tableLPop($h){
return $this->lpop($this->calcKey($h)); $res=$this->lpop($this->calcKey($h));
return $res;
} }
public function tableSRandMember($h,$count = null){ public function tableSRandMember($h,$count = null){
return $this->sRandMember($this->calcKey($h),$count); return $this->sRandMember($this->calcKey($h),$count);
......
...@@ -9,6 +9,7 @@ if(APP_ENV=='develop'){ ...@@ -9,6 +9,7 @@ if(APP_ENV=='develop'){
} }
if(APP_ENV=='test' || APP_ENV=='pre' ||APP_ENV=='ccwdevelop'){ if(APP_ENV=='test' || APP_ENV=='pre' ||APP_ENV=='ccwdevelop'){
if(isset($_POST['data']['debug'])&&!empty($_POST['data']['debug'])){ if(isset($_POST['data']['debug'])&&!empty($_POST['data']['debug'])){
// define("DEBUG",1);
error_reporting(E_ALL); error_reporting(E_ALL);
}else{ }else{
error_reporting(0); error_reporting(0);
......
<?php <?php
$redis =new Redis();
$redis->connect('192.168.134.18','6379');
$redis->rPush('test',0);
$res=$redis->lPop('test');
var_dump($res);
$res1=$redis->lPop('test');
var_dump($res1);
exit;
function is_https() { function is_https() {
if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
return true; return true;
......
...@@ -82,7 +82,7 @@ class cliStoreOnlineGoodsClass extends basecli ...@@ -82,7 +82,7 @@ class cliStoreOnlineGoodsClass extends basecli
} }
} }
$oCli = new cliShopkeeperIndex(TRUE); $oCli = new cliStoreOnlineGoodsClass(TRUE);
EXIT; 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