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{
//获取地址相关信息
$currentAddress = $this->setAddressAction(true);
if(!isset($currentAddress['addresses'])){
$currentAddress['addresses'] = array();
}
$returnData['currentAddress'] = $currentAddress;
$currentAddress = $this->sess->get('currentAddress');
......
......@@ -15,8 +15,6 @@ class StoreController extends \Our\Controller_AbstractIndex {
public function getStoreInfoAction(){
$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['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']);
$this->success($storeInfo);
}
......
......@@ -921,7 +921,7 @@ class OrderConfirmUtil {
if($tempOrder['coupon_id']>\Our\ApiConst::zero){
$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);
}
//送券、送礼品
......
......@@ -11,7 +11,7 @@ class ApiConst
const randLengh = 8;
//10天数秒
const tenDaySecond = 86400;
const tenDaySecond = 864000;
//const tenDaySecond = 300;
//一天
const oneDaySecond = 86400;
......
......@@ -140,7 +140,7 @@ class DescribeConst
const payOnlineName = '线上支付'; //线上支付
const payOfflineName = '线下支付'; //线下支付
const payAogName = '到店自提'; //到店自提
const payAogName = '货到付款'; //货到付款
const refund='退款';
const refundRetund='退货';
......
......@@ -48,6 +48,7 @@ class ImageConst{
const defaultStoreLabelName = 'default_store_avatar.jpg';
const defaultStoreBannerName = 'default_store_banner.jpg';
//图片指向的域名
const imageDomain="ossHost";
......
......@@ -156,7 +156,7 @@ class NameConst {
const rightBracket = ']';
const elasticName='elastic.master';
const shopkeeper='orders';
const shopkeeper='shenbdindex';
const cancelUnPayedOrderTimePrefix = 'cancelUnPayedOrderTime';
const cancelUnReceivedOrderTimePrefix = 'cancelUnReceivedOrderTime';
......
......@@ -61,7 +61,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$maxPrice = intval($param['maxPrice']);
$goodsSort = intval($param['goodsSort']);
$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}%'";
$commonDAO = \DAO\GoodsCommonModel::getInstance();
$couponDao = \DAO\Coupon\CouponModel::getInstance();
......@@ -80,11 +80,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where[] = 'goods_commonid in('.trim($ids,',').')';
}
}
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
if($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';
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{
$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
$field = 'han_goods_common.'.$field;
}
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{
$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
}elseif ($maxPrice){
$where[] = "goods_price <= {$maxPrice}";
}
$saleSort = false;
$order = [];
switch ($goodsSort){
case 1:
$order[] = ['sale_num','DESC'];
$order[] = ['eval_score','DESC'];
$saleSort = true;
break;
case 2:
$order[] = ['sale_num','DESC'];
$saleSort = true;
break;
case 3:
$order[] = ['goods_selltime','DESC'];
......@@ -206,7 +210,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$order[] = ['eval_score','DESC'];
break;
}
return array($where,$order,$attrStr);
return array($where,$order,$attrStr,$saleSort);
}
/**
* 获取商品列表
......@@ -244,20 +248,21 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$thirdClassId && $where[] = "gc_id_3 = {$thirdClassId}";
$storeThirdClassId && $where[] = "goods_class_t_id = {$storeThirdClassId}";
$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);
$commonDAO = \DAO\GoodsCommonModel::getInstance();
$saleSort ? $ttl = \Our\ApiConst::oneHour : \Our\ApiConst::oneDaySecond;
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';
if($attrStr){
$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{
$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';
$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 = [];
if(is_array($list) && !empty($list)){
......@@ -345,14 +350,24 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
//商品图片表
$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));
$attrImage = [];
$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)){
$i = 0;
foreach ($image as $k=>$v){
$image[$k]['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::SpecSelectGoodsImgSize);
$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);
}
$i += 1;
......@@ -1105,14 +1120,27 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/
public function storeOnlineGoodsClass(){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
$plusFlag = false;
$minusFlag = false;
for($i=0;$i<2000;$i++){
$goodsClassStr = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::plus);
if($goodsClassStr&&$plusFlag==false){
$goodsClass = unserialize($goodsClassStr);
$this->checkExistOnlineGoodsClass($goodsClass);
}else{
$plusFlag=true;
}
$goodsClassStrMinus = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::minus);
if($goodsClassStrMinus&&$minusFlag==false){
$goodsClassMinus = unserialize($goodsClassStrMinus);
$this->checkRemoveOnlineGoodsClass($goodsClassMinus);
}else{
$minusFlag = true;
}
if($plusFlag&&$minusFlag){
break;
}
}
}
......@@ -1123,7 +1151,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/
public function checkExistOnlineGoodsClass($goodsClass){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
$oldTemp = $storeOnlineGoodsClassDao->find($goodsClass);
$oldTemp = $storeOnlineGoodsClassDao->findByWhere($goodsClass);
if(!$oldTemp){
$storeOnlineGoodsClassDao->insert($goodsClass);
}
......@@ -1157,19 +1185,24 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$topSaleList = array();
for($i=0;$i<2000;$i++){
$storeId = $storeTopSaleGoodsModel->getChangedSaleStoreId();
if(!$storeId){
if($storeId===false){
break;
}
if(!($storeIds&&in_array($storeId,$storeIds))){
$topSaleList=$storeTopSaleGoodsModel->getStoreTopSaleGoodsListByStoreId($storeId);
$storeTopSaleList = $this->getNewStoreTopSaleGoodsList($topSaleList,$storeId);
if($storeId){
if(($storeIds&&in_array($storeId,$storeIds))){
continue;
}
$topSaleListTemp=$storeTopSaleGoodsModel->getStoreTopSaleGoodsListByStoreId($storeId);
$storeTopSaleList = $this->getNewStoreTopSaleGoodsList($topSaleListTemp,$storeId);
$topSaleList = $topSaleList?array_merge($topSaleList,$storeTopSaleList):$storeTopSaleList;
}
}
\Our\Log::getInstance()->write(json_encode($topSaleList));
if($topSaleList){
$result = $storeTopSaleGoodsModel->insertAllOrUpdate($topSaleList);
\Our\Log::getInstance()->write('店铺销量更新'.($result?'success':'fail'));
}
\Our\Log::getInstance()->write('本次没有店铺数据需要更新');
}
/**
* 获取店铺热销前三的商品,没有也补齐
......
......@@ -255,7 +255,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
public function getStorePBundlingList($storeId,$dbName = \Our\DbNameConst::salveDBConnectName,$withKeyFlag= false,$limit = ''){
$pbundlingInstance = \DAO\PBundlingModel::getInstance($dbName);
$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);
return $newGroupList;
}
......
......@@ -25,7 +25,7 @@ use Our\Push;
*/
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 $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
$orderGoodsDao->update($where,$orderGoodsUpdateData);
}
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);
}
}
......@@ -315,7 +315,7 @@ class OrderServiceModel extends \Business\AbstractModel
if ($isAllowConfirm) {
$res = $orderDao->updateStatusByOrderId($orderId, ApiConst::orderStateComplete, TRUE);
if ($res) {
$orderDao->deleteOrderCache($memberId, $orderId, $order['store_id']);
$orderDao->deleteOrderCache($memberId, $orderId, $order['store_id'],true);
return true;
} else {
ErrorModel::throwException(CodeConfigModel::receiveError);
......@@ -520,7 +520,7 @@ class OrderServiceModel extends \Business\AbstractModel
if(!$update || !$res){
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');
//更新商品库存
......@@ -571,7 +571,7 @@ class OrderServiceModel extends \Business\AbstractModel
$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');
......@@ -623,13 +623,13 @@ class OrderServiceModel extends \Business\AbstractModel
if ($order['shippingType'] == ApiConst::bySeller) {
if (isset($qmDeliverymanLogsOrderIds[$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 {
$limitTime = TIMESTAMP - ApiConst::orderWaitRecieveThreeDays;
if ($order['acceptTime'] < $limitTime) {
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);
......@@ -702,19 +702,21 @@ class OrderServiceModel extends \Business\AbstractModel
$orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(DbNameConst::salveDBConnectName);
$memberDao = \DAO\MemberModel::getInstance(DbNameConst::salveDBConnectName);
$diliverymanId = $memberDao->getInfo($memberId, 'diliveryman_id');
$diliverymanId=46;
if (empty($diliverymanId)) {
ErrorModel::throwException(CodeConfigModel::commonError);
}
$qmDeliveryLogList = $QmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanId, $type, $pageIndex, $pageSize);
$orderIds = array_column($qmDeliveryLogList['list'], 'orderId');
$where['delete_state'] = ApiConst::undeleteOrder;
//$orderIds=implode(',',$orderIds);
$where['order_id'] = array('in', $orderIds);
$where['lock_state'] = ApiConst::zero;
// echo json_encode($orderIds);exit;
// $where['delete_state'] = ApiConst::undeleteOrder;
$orderIds=implode(',',$orderIds);
$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));
$goodsDao = \DAO\GoodsModel::getInstance();
$orderIds = array_column($orders['list'], 'orderId');
......@@ -722,7 +724,7 @@ class OrderServiceModel extends \Business\AbstractModel
//获得订单商品列表
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::intergrateOneToOne($orderMerge, $orderCommons, 'orderId', 'orderId');
$orderMerge = $orderDao->convertOrderList($orderMerge);
......@@ -737,13 +739,13 @@ class OrderServiceModel extends \Business\AbstractModel
$delivery['finishTime'] = $value['finishTime'];
$delivery['mobPhone'] = $delivery['mobPhone'] ? $delivery['mobPhone'] : '';
$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['lng'] = $delivery['reciverInfo']['lng'] ? $delivery['reciverInfo']['lng'] : 0.0;
$delivery['lat'] = $delivery['reciverInfo']['lat'] ? $delivery['reciverInfo']['lat'] : 0.0;
$delivery['subAddress'] = isset($delivery['reciverInfo']['sub_address']) ? $delivery['reciverInfo']['sub_address'] : '';
unset($delivery['goodsAmount']);
unset($delivery['orderState']);
// unset($delivery['orderState']);
unset($delivery['refundState']);
unset($delivery['goodsAmount']);
unset($delivery['reciverInfo']);
......@@ -841,7 +843,7 @@ class OrderServiceModel extends \Business\AbstractModel
$push = Push::getInstance();
$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);
return $updateResult;
} else {
......@@ -886,6 +888,7 @@ class OrderServiceModel extends \Business\AbstractModel
$orderContent['payway'] = \Our\DescribeConst::afterPay;
}
$orderContent['orderAmount'] = $order['order_amount'];
$orderContents[]=$orderContent;
}
$orderIds[] = $order['order_id'];
}
......
......@@ -397,15 +397,17 @@ class RefundServiceModel extends \Business\AbstractModel
$refundArray['refund_shipping_type']=isset($refund['refundShippingType'])?$refund['refundShippingType']:ApiConst::zero;
$refundArrayUnLine=Common::convertUnderline($refundArray);
$state = $refundReturnDao->addRefundReturn($refundArray,$orderInfo,$orderGoods);
if ($state) {
$orderDao->deleteOrderCache($memberId,$refund['orderId']);
$orderDao->deleteOrderCache($memberId,$orderInfo['orderId'],$orderInfo['storeId'],true);
$refundReturnDao->deleteRefundCache($memberId);
if ($state) {
$refundStateName=$refundReturnDao->getRefundTextStatus($refundArrayUnLine);
$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']);
if ($orderInfo['orderState'] == ApiConst::orderStateWaitRecieve) {
$orderDao->editOrderLock($orderInfo['orderId']);
}
return $state;
} else {
ErrorModel::throwException(CodeConfigModel::refundRefuseByStore);
......@@ -446,8 +448,13 @@ class RefundServiceModel extends \Business\AbstractModel
} else {
$address = $addressDao->getAddressByStoreId($refundReturn['storeId'], $this->daddressField);
}
if(!empty($address)){
$address['isDefault'] = (int)$address['isDefault'];
$info['dAddressInfo'] = $address;
}else{
$info['dAddressInfo'] =new \stdClass();
}
} else {
$info['dAddressInfo'] = new \stdClass();
}
......
......@@ -53,6 +53,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
// $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance();
$orderDao=\DAO\Order\OrderModel::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;
//获取店铺信息
$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
$data['storeId'] = $store['store_id'];
$data['storeName'] = $store['store_name'];
$data['storeLabel'] = $store['store_label'];
$data['goodsCount'] = ApiConst::zero;
$data['goodsCount'] = $goodsCount;
$data['orderCount'] =$storeStats['orderCount'];
$data['orderTotal'] = $storeStats['orderTotal'];
$data['favCount'] = $storeFavariteCount['favCount'];
......@@ -237,7 +239,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} else {
$update_data['order_state'] = ApiConst::orderStateWaitSend;
$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);
return $result;
}
......@@ -527,7 +529,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
{
$elasticsTool = ElasticsToolModel::getInstance('orders');
// $elasticsTool->deleteIndex();
$elasticsTool->deleteIndex();
$indexsFiled = array(
'goodsName' => array(
'type' => 'string',
......@@ -537,6 +539,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
'type' => 'string',
"analyzer" => "ik_max_word"
),
'orderSn' => array(
'type' => 'string',
"index" => "not_analyzed"
),
);
$elasticsTool->createIkField($indexsFiled);
}
......
......@@ -454,6 +454,9 @@ class AddressServiceModel extends \Business\AbstractModel {
if(!($address['address']&&$address['name'])){
\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){
$province = mb_substr($province,0,2);
$provinceList = $areaList[\Our\ApiConst::zero];
......
......@@ -84,6 +84,7 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{
* @return mixed
*/
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
FROM
(
......@@ -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
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);
$list = $this->db->query($sql)->fetchAll();
$list = $this->db->query($sql)->rows;
return $list;
}
......@@ -101,6 +102,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\Api
* @return mixed
*/
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
FROM
(
......@@ -111,7 +113,7 @@ on t1.goods_commonid = t2.goods_commonid
where t1.
) 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';
$list = $this->db->query($sql)->fetchAll();
$list = $this->db->query($sql)->rows;
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
$baseSql = "insert into {$this->_tableName}(store_id,goods_commonid,goods_score,rank,goods_name,goods_image) values";
$insertAllSql = $baseSql;
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;
if ($i % 1000 == 0 && $i != 0) {
$insertAllSql = rtrim($insertAllSql, ',');
......
......@@ -36,6 +36,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
public function insert($data){
$this->setDb(\Our\DbNameConst::masterDBConnectName);
$data['gmt_create'] = TIMESTAMP;
$data['gmt_update'] = TIMESTAMP;
$result = $this->db->insert($this->_tableName)->rows($data)->execute();
if($result){
$storeId = $data['store_id'];
......@@ -47,9 +48,11 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
public function del($where){
$this->setDb(\Our\DbNameConst::masterDBConnectName);
$temp = $this->findByWhere($where);
$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;
}
......@@ -130,7 +133,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
$this->addChangedGoodsClass(serialize($goodsClass),$type);
if($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);
}
return true;
......
......@@ -800,7 +800,10 @@ class OrderModel extends \DAO\AbstractModel
if ($deleteGetFavoritesCountByStoreId) {
$favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance();
$favoritesStoreDao->deleteGetFavoritesCountByStoreId($stroeId);
}
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao->deleteOrderGoodsCache($memberId, $orderId,$stroeId);
}
if(!empty($diliverymanId)){
......
......@@ -28,6 +28,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
*/
protected $_primaryKey = 'rec_id';
public $orderGoodsGoodsNumCountField=" sum(goods_num) as goodsNum";
public function init(){
......@@ -57,10 +58,16 @@ class OrderGoodsModel extends \DAO\AbstractModel {
}
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();
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
......@@ -100,13 +107,21 @@ class OrderGoodsModel extends \DAO\AbstractModel {
return $this->getOrderGoods($where,$field);
}
public function deleteOrderGoodsCache($memberId,$orderIds){
public function deleteOrderGoodsCache($memberId,$orderIds,$storeId=false){
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){
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){
$isRefundMoney=ApiConst::zero;
......@@ -130,7 +145,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
public function getRefundOrderGoodsIds($orderGoods){
$orderGoods=array_values($orderGoods);
for($i=ApiConst::zero;$i<count($orderGoods);$i++){
if($orderGoods[$i]['isRefund']==ApiConst::refundSuccess){
if($orderGoods[$i]['refundId']==ApiConst::zero){
unset($orderGoods[$i]);
}
}
......
......@@ -105,8 +105,9 @@ class StoreModel extends \DAO\AbstractModel
if ($img) {
$storeLabel = \Our\Common::getStaticFile($img, \Our\ImageConst::storeLabel, 'ossHost');
} 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;
}
/**
......
......@@ -354,6 +354,7 @@ const notAllowDelete=300114;
const emptyCityId = 140019;
const emptyDistrictId = 140020;
const emptyAddressAndName = 140021;
const wrongAddressTagType = 140022;
//消息,推送等
const removeMessage=150001;
......@@ -580,6 +581,7 @@ const notAllowDelete=300114;
self::emptyCityId => '找不到对应城市',
self::emptyDistrictId => '找不到对应区',
self::emptyAddressAndName => '地址和具体街道不能为空',
self::wrongAddressTagType => '地址标签传输错误',
self::emptyLatLng => '经纬度不能为空',
self::emptyCityCode => '高德地图城市编码不能为空',
......@@ -755,7 +757,7 @@ const notAllowDelete=300114;
self::updateMobileMembmerFailed => '更新手机号对应会员信息失败',
self::updateMobileMembmerMappingFailed => '更新手机号码对应会员mapping信息失败',
self::currentMobileHasBeenBind => '当前手机号码已经绑定其他微信,如需绑定,请先手机号码登录app进行微信解绑',
self::otherDriverLogin=>'当前用户已被其他设备登录,请重新登录',
self::otherDriverLogin=>'当前帐户在其他设备登录,假如不是您本人操作,请尽快修改密码',
self::elasticsError=>'全文索引连接出错',
self::emptyLog => '日志内容不能为空',
self::writeLogFailed => '日志写入失败',
......
......@@ -96,7 +96,8 @@ class AbstractModel extends \Redis\AbstractModel {
return $this->lpush($this->calcKey($h),$value);
}
public function tableLPop($h){
return $this->lpop($this->calcKey($h));
$res=$this->lpop($this->calcKey($h));
return $res;
}
public function tableSRandMember($h,$count = null){
return $this->sRandMember($this->calcKey($h),$count);
......
......@@ -9,6 +9,7 @@ if(APP_ENV=='develop'){
}
if(APP_ENV=='test' || APP_ENV=='pre' ||APP_ENV=='ccwdevelop'){
if(isset($_POST['data']['debug'])&&!empty($_POST['data']['debug'])){
// define("DEBUG",1);
error_reporting(E_ALL);
}else{
error_reporting(0);
......
<?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() {
if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
return true;
......
......@@ -82,7 +82,7 @@ class cliStoreOnlineGoodsClass extends basecli
}
}
$oCli = new cliShopkeeperIndex(TRUE);
$oCli = new cliStoreOnlineGoodsClass(TRUE);
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