Commit d65aaa3d authored by wwccw0591's avatar wwccw0591

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

parents e67efb4a beee3c78
...@@ -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');
......
...@@ -39,6 +39,8 @@ class OrderConfirmUtil { ...@@ -39,6 +39,8 @@ class OrderConfirmUtil {
private $saleGoodsIds = array(); //参与销售活动结算的goodsId 列表 private $saleGoodsIds = array(); //参与销售活动结算的goodsId 列表
private $storeMemos = array();
public function addOrder($data,$memberId,$currentAddress){ public function addOrder($data,$memberId,$currentAddress){
$storeCartData = $this->checkPostData($data,$memberId,$currentAddress); $storeCartData = $this->checkPostData($data,$memberId,$currentAddress);
$storeCartData = $this->checkDeliveryTypeAndPayway($storeCartData); $storeCartData = $this->checkDeliveryTypeAndPayway($storeCartData);
...@@ -84,6 +86,7 @@ class OrderConfirmUtil { ...@@ -84,6 +86,7 @@ class OrderConfirmUtil {
$gcIds = isset($cartList['gcIds'])?$cartList['gcIds']:array(); $gcIds = isset($cartList['gcIds'])?$cartList['gcIds']:array();
$storeCartData = array('cartList'=>$cartList['list'],'storeIds'=>array_keys($cartList['list']),'goodsIds'=>$cartList['goodsIds'],'goodsCommonIds'=>$cartList['goodsCommonIds'],'blIds'=>$cartList['blIds'],'gcIds'=>$gcIds); $storeCartData = array('cartList'=>$cartList['list'],'storeIds'=>array_keys($cartList['list']),'goodsIds'=>$cartList['goodsIds'],'goodsCommonIds'=>$cartList['goodsCommonIds'],'blIds'=>$cartList['blIds'],'gcIds'=>$gcIds);
$this->storeIds= array_keys($cartList['list']); $this->storeIds= array_keys($cartList['list']);
$this->storeMemos[$this->postData['storeId']] = isset($this->postData['storeMemo'])?$this->postData['storeMemo']:\Our\NameConst::emptyString;
}else{ }else{
foreach($this->postData as $temp){ foreach($this->postData as $temp){
$this->checkOneStoreData($temp); $this->checkOneStoreData($temp);
...@@ -98,6 +101,7 @@ class OrderConfirmUtil { ...@@ -98,6 +101,7 @@ class OrderConfirmUtil {
$this->storeIds[]= $temp['storeId']; $this->storeIds[]= $temp['storeId'];
$this->storeCartIds[$temp['storeId']] =$temp['cartIds']; $this->storeCartIds[$temp['storeId']] =$temp['cartIds'];
$this->postFormatData[$temp['storeId']] = $temp; $this->postFormatData[$temp['storeId']] = $temp;
$this->storeMemos[$temp['storeId']] = isset($temp['storeMemo'])?$temp['storeMemo']:\Our\NameConst::emptyString;
} }
if($this->couponIds){ if($this->couponIds){
if(count($this->couponIds)!= count(array_unique($this->couponIds))){ if(count($this->couponIds)!= count(array_unique($this->couponIds))){
...@@ -216,7 +220,7 @@ class OrderConfirmUtil { ...@@ -216,7 +220,7 @@ class OrderConfirmUtil {
if($temp['expressDistribution']!=\Our\ApiConst::one){ if($temp['expressDistribution']!=\Our\ApiConst::one){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::noExpressDeliveryForOrder); \Error\ErrorModel::throwException(\Error\CodeConfigModel::noExpressDeliveryForOrder);
} }
if(!($tempStore['is_transport']&&$tempStore['transport_id']>\Our\ApiConst::zero&&isset($temp['shippingFee']))){ if($tempStore['goodsFreight']==\Our\ApiConst::zero&&!($tempStore['is_transport']&&$tempStore['transport_id']>\Our\ApiConst::zero&&isset($temp['shippingFee']))){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::noExpressDeliveryForOrder); \Error\ErrorModel::throwException(\Error\CodeConfigModel::noExpressDeliveryForOrder);
} }
$deliveryFee = $temp['shippingFee']; $deliveryFee = $temp['shippingFee'];
...@@ -257,7 +261,7 @@ class OrderConfirmUtil { ...@@ -257,7 +261,7 @@ class OrderConfirmUtil {
$orderDao = \DAO\Order\OrderModel::getInstance($dbName); $orderDao = \DAO\Order\OrderModel::getInstance($dbName);
$newPaySn = $this->makePaySn($memberId); $newPaySn = $this->makePaySn($memberId);
$orderDao->db->doTransaction(); $orderDao->db->doTransaction();
$orderPay['pay_sn'] = $paySn; $orderPay['pay_sn'] = $newPaySn;
$orderPay['buyer_id'] = $memberId; $orderPay['buyer_id'] = $memberId;
$orderPay['api_pay_state'] = \Our\ApiConst::zero; $orderPay['api_pay_state'] = \Our\ApiConst::zero;
$orderPayModel = \DAO\Order\OrderPayModel::getInstance($dbName); $orderPayModel = \DAO\Order\OrderPayModel::getInstance($dbName);
...@@ -411,7 +415,7 @@ class OrderConfirmUtil { ...@@ -411,7 +415,7 @@ class OrderConfirmUtil {
$orderCommon = array(); $orderCommon = array();
$orderCommon['order_id'] = $orderId; $orderCommon['order_id'] = $orderId;
$orderCommon['store_id'] = $storeId; $orderCommon['store_id'] = $storeId;
$orderCommon['order_message'] = isset($this->postFormatData[$storeId]['storeMemo'])?$this->postFormatData[$storeId]['storeMemo']:\Our\NameConst::emptyString; $orderCommon['order_message'] = isset($this->storeMemos[$storeId])?$this->storeMemos[$storeId]:\Our\NameConst::emptyString;
$orderCommon['reciver_info'] = $reciverInfo; $orderCommon['reciver_info'] = $reciverInfo;
$orderCommon['reciver_name'] = $reciverName; $orderCommon['reciver_name'] = $reciverName;
$orderCommon['reciver_city_id'] = $this->address['city_id']; $orderCommon['reciver_city_id'] = $this->address['city_id'];
...@@ -908,7 +912,7 @@ class OrderConfirmUtil { ...@@ -908,7 +912,7 @@ class OrderConfirmUtil {
$updateOrder['is_receive_payment'] = \Our\ApiConst::one; $updateOrder['is_receive_payment'] = \Our\ApiConst::one;
$updateOrder['payment_time'] = (isset($data['payment_time'])? strtotime($data['payment_time']) : TIMESTAMP); $updateOrder['payment_time'] = (isset($data['payment_time'])? strtotime($data['payment_time']) : TIMESTAMP);
$updateOrder['payment_type'] = $this->getOrderPaymentType($data['pay_type']); $updateOrder['payment_type'] = $this->getOrderPaymentType($data['pay_type']);
$orderUpdateResult = $orderModel->update($orderCon,$updateOrder); $orderUpdateResult = $orderModel->update($orderCon,$updateOrder);
if(!$orderUpdateResult){ if(!$orderUpdateResult){
$orderModel->db->doRollback(); $orderModel->db->doRollback();
$errorCode = \Error\CodeConfigModel::updateOrderPayedStatusFailed; $errorCode = \Error\CodeConfigModel::updateOrderPayedStatusFailed;
......
...@@ -201,6 +201,7 @@ class ApiConst ...@@ -201,6 +201,7 @@ class ApiConst
//配送表deliveryState //配送表deliveryState
//当购买的时候是待送货,当退货的时候是待收货 //当购买的时候是待送货,当退货的时候是待收货
const deliveryStateWaitTen = 10;
const deliveryStateWait = 20; const deliveryStateWait = 20;
const deliveryStateComplete = 30; const deliveryStateComplete = 30;
......
...@@ -151,8 +151,6 @@ class TencentPay { ...@@ -151,8 +151,6 @@ class TencentPay {
//运行curl //运行curl
$data = curl_exec($ch); $data = curl_exec($ch);
curl_close($ch); curl_close($ch);
\Our\Log::getInstance()->write(json_encode($data));
\Our\Log::getInstance()->write($data);
//返回结果 //返回结果
if($data) if($data)
{ //var_dump($data);die('||'); { //var_dump($data);die('||');
......
...@@ -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";
...@@ -714,26 +714,29 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -714,26 +714,29 @@ class OrderServiceModel extends \Business\AbstractModel
$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);
$where['lock_state'] = ApiConst::zero; $orderIds=implode(',',$orderIds);
//获得订单列表
//$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');
$orderCommons = $orderCommonDao->getAllByOrderIdsCache($orderIds, $diliverymanId, $orderCommonDao->orderCommonField);
//获得订单商品列表 //获得订单商品列表
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)); $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 = \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');
$orderCommons = $orderCommonDao->getAllByOrderIdsCache($orderIds, $diliverymanId, $orderCommonDao->orderCommonField);
$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);
$convertResult = array(); $convertResult = array();
$orderGoods = $goodsDao->convert($orderGoods); //$orderGoods = $goodsDao->convert($orderGoods);
foreach ($qmDeliveryLogList['list'] as &$value) { foreach ($qmDeliveryLogList['list'] as &$value) {
$delivery = $orderMerge[$value['orderId']]; $delivery = $orderMerge[$value['orderId']];
$delivery['id'] = $value['id']; $delivery['id'] = $value['id'];
...@@ -743,13 +746,13 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -743,13 +746,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']);
...@@ -809,6 +812,9 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -809,6 +812,9 @@ class OrderServiceModel extends \Business\AbstractModel
if (empty($orderGoods)) { if (empty($orderGoods)) {
$orderGoods = array(); $orderGoods = array();
} }
if($delivery['deliveryState']==ApiConst::deliveryStateWait||$delivery['deliveryState']==ApiConst::deliveryStateWaitTen){
$delivery['deliveryState']=ApiConst::deliveryStateWait;
}
$returnData = array( $returnData = array(
'orderId' => $this->order['orderId'], 'orderId' => $this->order['orderId'],
'storeName' => $this->order['storeName'], 'storeName' => $this->order['storeName'],
...@@ -838,15 +844,15 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -838,15 +844,15 @@ class OrderServiceModel extends \Business\AbstractModel
$memberDao = \DAO\MemberModel::getInstance(DbNameConst::masterDBConnectName); $memberDao = \DAO\MemberModel::getInstance(DbNameConst::masterDBConnectName);
$qmDeliverymanLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::masterDBConnectName); $qmDeliverymanLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::masterDBConnectName);
$deliverymanId = $memberDao->getInfo($memberid, 'diliveryman_id'); $deliverymanId = $memberDao->getInfo($memberid, 'diliveryman_id');
$qmDeliveryManLog = $qmDeliverymanLogDao->findByIdCache($id); $qmDeliveryManLog = $qmDeliverymanLogDao->findById($id);
if ($qmDeliveryManLog['deliveryState'] == ApiConst::deliveryStateWait && $qmDeliveryManLog['id'] == $id) { if ($qmDeliveryManLog['deliveryState'] == ApiConst::deliveryStateWait && $qmDeliveryManLog['id'] == $id) {
$updateResult = $qmDeliverymanLogDao->updateStatusById($id); $updateResult = $qmDeliverymanLogDao->updateStatusById($id);
$orderDao = \DAO\Order\OrderModel::getInstance(); $orderDao = \DAO\Order\OrderModel::getInstance();
$order = $orderDao->findByOrderId($qmDeliveryManLog['orderId'], $orderDao->getOrderDetailField()); $order = $orderDao->findByOrderId($qmDeliveryManLog['orderId'], $orderDao->getOrderDetailField());
if ($updateResult) { if ($updateResult) {
$push = Push::getInstance(); $push = Push::getInstance();
$push->reacheRemind($order['buyerId'], $order['orderId'], $order['orderSn']); $push->reacheRemind($order['buyerId'], $order['orderId'], $order['orderSn']);
} }
$orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId'], $order['storeId'],true); $orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId'], $order['storeId'],true);
$qmDeliverymanLogDao->deleteOrderCache($deliverymanId, $id); $qmDeliverymanLogDao->deleteOrderCache($deliverymanId, $id);
return $updateResult; return $updateResult;
......
...@@ -80,7 +80,8 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -80,7 +80,8 @@ class RefundServiceModel extends \Business\AbstractModel
$value['canSendShippingType'] = $refundReturnDao->checkIsAddReturnShipping($value) ? ApiConst::one : ApiConst::zero; $value['canSendShippingType'] = $refundReturnDao->checkIsAddReturnShipping($value) ? ApiConst::one : ApiConst::zero;
$value['goodsImage'] = ImageUtil::getGoodsImgUrl($value['goodsImage'], ApiConst::goodsSmallSize); $value['goodsImage'] = ImageUtil::getGoodsImgUrl($value['goodsImage'], ApiConst::goodsSmallSize);
$value['goodsAttr']=$goodsDao->getFormatGoodsAttr($value['goodsSpec']); $value['goodsAttr']=$goodsDao->getFormatGoodsAttr($value['goodsSpec']);
$value['goodsGroup']=unserialize($value['goodsGroup']); $goodGroup=unserialize($value['goodsGroup']);
$value['goodsGroup']=!empty($goodGroup)?$goodGroup:[];
unset($value['goodsSpec']); unset($value['goodsSpec']);
unset($value['picInfo']); unset($value['picInfo']);
} }
...@@ -448,8 +449,13 @@ class RefundServiceModel extends \Business\AbstractModel ...@@ -448,8 +449,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();
} }
......
...@@ -240,7 +240,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -240,7 +240,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$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'],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);
return $result; return $result;
} }
} }
...@@ -539,6 +539,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -539,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);
} }
......
...@@ -59,9 +59,15 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -59,9 +59,15 @@ class StoreServiceModel extends \Business\AbstractModel{
if($param['sid']) { if($param['sid']) {
$sale = \DAO\SaleModel::getInstance()->getOne(array('sale_id'=>$param['sid']),'sale_act_id,member_id'); $sale = \DAO\SaleModel::getInstance()->getOne(array('sale_id'=>$param['sid']),'sale_act_id,member_id');
if($sale) { if($sale) {
\DAO\SaleMemberModel::getInstance()->insertOrUpdate(array('sale_id'=>$sale['member_id'],'sale_act_id'=>$sale['sale_act_id'],'member_id'=>$memberId,'storeId'=>$storeId)); \DAO\SaleMemberModel::getInstance()->insertOrUpdate(array('sale_id'=>$sale['member_id'],'sale_act_id'=>$sale['sale_act_id'],'member_id'=>$memberId,'store_id'=>$storeId));
} }
} }
// $storeMember['storeId'] = $storeId;
// $storeMember['memberId'] = $memberId;
// $storeMember['type'] = \Our\ApiConst::storeQrcodeMember;
// $storeMembers[] = $storeMember;
// $storeMemberDao = \DAO\StoreMemberModel::getInstance(\Our\DbNameConst::masterDBConnectName);
// $result = $storeMemberDao->addBatch($storeMembers);
}else{ }else{
$sess=\Yaf\Session::getInstance(); $sess=\Yaf\Session::getInstance();
$scan_store_ids = $sess->get('scan_store_ids'); $scan_store_ids = $sess->get('scan_store_ids');
......
...@@ -75,6 +75,9 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -75,6 +75,9 @@ class AddressServiceModel extends \Business\AbstractModel {
$address['address'] = $currentAddress['address']; $address['address'] = $currentAddress['address'];
$address['name'] = $currentAddress['name']; $address['name'] = $currentAddress['name'];
$address['tagType'] = $currentAddress['tagType']; $address['tagType'] = $currentAddress['tagType'];
$address['lat'] = $currentAddress['lat'];
$address['lng'] = $currentAddress['lng'];
$address['cityCode'] = $currentAddress['cityCode'];
$addresses[] = $address; $addresses[] = $address;
$returnAddress = array('returnAddressId'=>$currentAddress['addressId'],'choosedAddressFlag'=>$currentAddress['chooseFlag'],'addresses'=>$addresses); $returnAddress = array('returnAddressId'=>$currentAddress['addressId'],'choosedAddressFlag'=>$currentAddress['chooseFlag'],'addresses'=>$addresses);
}else{ }else{
...@@ -118,12 +121,12 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -118,12 +121,12 @@ class AddressServiceModel extends \Business\AbstractModel {
$newAddress['address'] = $address['address']; $newAddress['address'] = $address['address'];
$newAddress['name'] = $address['name']; $newAddress['name'] = $address['name'];
$newAddress['tagType'] = $address['tagType']; $newAddress['tagType'] = $address['tagType'];
$returnAddresses[] = $newAddress;
$choosedAddressId = $address['addressId'];
$newAddress = $address;
$newAddress['lng'] = $address['lng']; $newAddress['lng'] = $address['lng'];
$newAddress['lat'] = $address['lat']; $newAddress['lat'] = $address['lat'];
$newAddress['cityCode'] = $address['cityCode']; $newAddress['cityCode'] = $address['cityCode'];
$returnAddresses[] = $newAddress;
$choosedAddressId = $address['addressId'];
$newAddress = $address;
$newAddress['chooseFlag'] = \Our\ApiConst::one; $newAddress['chooseFlag'] = \Our\ApiConst::one;
$sess['currentAddress'] = $newAddress; $sess['currentAddress'] = $newAddress;
return array('returnAddressId'=>$choosedAddressId,'choosedAddressFlag'=>\Our\ApiConst::one,'addresses'=>$returnAddresses); return array('returnAddressId'=>$choosedAddressId,'choosedAddressFlag'=>\Our\ApiConst::one,'addresses'=>$returnAddresses);
...@@ -196,11 +199,11 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -196,11 +199,11 @@ class AddressServiceModel extends \Business\AbstractModel {
$address['address']= $newAddressList[$pos]['address']; $address['address']= $newAddressList[$pos]['address'];
$address['name'] = $newAddressList[$pos]['name']; $address['name'] = $newAddressList[$pos]['name'];
$address['tagType']= $newAddressList[$pos]['tag_type']; $address['tagType']= $newAddressList[$pos]['tag_type'];
$address['lng'] = $newAddressList[$pos]['lng'];
$address['lat'] = $newAddressList[$pos]['lat'];
$address['cityCode'] = $newAddressList[$pos]['citycode'];
$choosedAddressId = $address['addressId']; $choosedAddressId = $address['addressId'];
$newAddress = $address; $newAddress = $address;
$newAddress['lng'] = $newAddressList[$pos]['lng'];
$newAddress['lat'] = $newAddressList[$pos]['lat'];
$newAddress['cityCode'] = $newAddressList[$pos]['citycode'];
$newAddress['chooseFlag'] = \Our\ApiConst::one; $newAddress['chooseFlag'] = \Our\ApiConst::one;
$sess['currentAddress'] = $newAddress; $sess['currentAddress'] = $newAddress;
$returnAddresses[] = $address; $returnAddresses[] = $address;
...@@ -260,6 +263,9 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -260,6 +263,9 @@ class AddressServiceModel extends \Business\AbstractModel {
$temp['address'] = $tempAddr['address']; $temp['address'] = $tempAddr['address'];
$temp['name'] = $tempAddr['name']; $temp['name'] = $tempAddr['name'];
$temp['tagType'] = $tempAddr['tagType']; $temp['tagType'] = $tempAddr['tagType'];
$temp['cityCode'] = $tempAddr['citycode'];
$temp['lat'] = $tempAddr['lat'];
$temp['lng'] = $tempAddr['lng'];
$returnAddressList[] = $temp; $returnAddressList[] = $temp;
} }
return array('returnAddressId'=>$choosedAddressId,'choosedAddressFlag'=>$choosedAddressFlag,'addresses'=>$returnAddressList); return array('returnAddressId'=>$choosedAddressId,'choosedAddressFlag'=>$choosedAddressFlag,'addresses'=>$returnAddressList);
...@@ -300,6 +306,9 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -300,6 +306,9 @@ class AddressServiceModel extends \Business\AbstractModel {
$temp['address'] = $tempAddr['address']; $temp['address'] = $tempAddr['address'];
$temp['name'] = $tempAddr['name']; $temp['name'] = $tempAddr['name'];
$temp['tagType'] = $tempAddr['tagType']; $temp['tagType'] = $tempAddr['tagType'];
$temp['lat'] = $tempAddr['lat'];
$temp['lng'] = $tempAddr['lng'];
$temp['cityCode'] = $tempAddr['cityCode'];
$returnAddressList[] = $temp; $returnAddressList[] = $temp;
} }
return $returnAddressList; return $returnAddressList;
......
...@@ -67,6 +67,9 @@ class GoodsCommonModel extends \DAO\AbstractModel { ...@@ -67,6 +67,9 @@ class GoodsCommonModel extends \DAO\AbstractModel {
*/ */
public function getGoodsList($where,$field,$limit=array(),$order=array(),$attrStr=''){ public function getGoodsList($where,$field,$limit=array(),$order=array(),$attrStr=''){
$this->setDb($this->dbName); $this->setDb($this->dbName);
if($attrStr) {
$field = 'DISTINCT '.$field;
}
$str = '$data = $this->db->select($field)->from($this->_tableName)'; $str = '$data = $this->db->select($field)->from($this->_tableName)';
if($attrStr){ if($attrStr){
$str .="->join('han_goods_attribute_value','han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid')"; $str .="->join('han_goods_attribute_value','han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid')";
...@@ -99,6 +102,10 @@ class GoodsCommonModel extends \DAO\AbstractModel { ...@@ -99,6 +102,10 @@ class GoodsCommonModel extends \DAO\AbstractModel {
*/ */
public function getListWithSale($where,$field,$actIds,$limit=array(),$order=array(),$attrStr='',$online = true){ public function getListWithSale($where,$field,$actIds,$limit=array(),$order=array(),$attrStr='',$online = true){
$this->setDb($this->dbName); $this->setDb($this->dbName);
if($attrStr) {
$attrStr = '('.$attrStr.')';
$field = ' DISTINCT '.$field;
}
$str = "select ".$field." FROM ".$this->_tableName." LEFT JOIN (SELECT MIN(discount_price) discount_price,goods_commonid,goods_id FROM han_sale_goods where sale_act_id in(".implode(',',$actIds).") GROUP BY goods_commonid) a on (han_goods_common.goods_commonid = a.goods_commonid)"; $str = "select ".$field." FROM ".$this->_tableName." LEFT JOIN (SELECT MIN(discount_price) discount_price,goods_commonid,goods_id FROM han_sale_goods where sale_act_id in(".implode(',',$actIds).") GROUP BY goods_commonid) a on (han_goods_common.goods_commonid = a.goods_commonid)";
if($attrStr){ if($attrStr){
$str .= "INNER JOIN han_goods_attribute_value ON han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid "; $str .= "INNER JOIN han_goods_attribute_value ON han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid ";
......
...@@ -307,9 +307,10 @@ class OrderModel extends \DAO\AbstractModel ...@@ -307,9 +307,10 @@ class OrderModel extends \DAO\AbstractModel
public function getFreightFeeName($type) public function getFreightFeeName($type)
{ {
if ($type != ApiConst::express) { if ($type != ApiConst::express) {
return DescribeConst::freightFee;
} else {
return DescribeConst::serviceFee; return DescribeConst::serviceFee;
} else {
return DescribeConst::freightFee;
} }
} }
...@@ -791,6 +792,7 @@ class OrderModel extends \DAO\AbstractModel ...@@ -791,6 +792,7 @@ class OrderModel extends \DAO\AbstractModel
if (!empty($memberId)) { if (!empty($memberId)) {
$this->deleteGetListByMemberId($memberId); $this->deleteGetListByMemberId($memberId);
\DAO\MemberModel::getInstance()->deleteTotalCache($memberId);
} }
if (!empty($stroeId)) { if (!empty($stroeId)) {
...@@ -810,22 +812,18 @@ class OrderModel extends \DAO\AbstractModel ...@@ -810,22 +812,18 @@ class OrderModel extends \DAO\AbstractModel
$this->deleteGetListByMemberId($diliverymanId); $this->deleteGetListByMemberId($diliverymanId);
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao->deleteOrderGoodsCache($diliverymanId, $orderId); $orderGoodsDao->deleteOrderGoodsCache($diliverymanId, $orderId);
$QmDeliveryLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::salveDBConnectName);
$QmDeliveryLogDao->deleteOrderCache($diliverymanId,$orderId);
} }
if (!empty($orderId)) { if (!empty($orderId)) {
$this->deleteFindByOrderIdCache($orderId); $this->deleteFindByOrderIdCache($orderId);
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName); $orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao->deleteOrderGoodsCache($memberId, $orderId); $orderGoodsDao->deleteOrderGoodsCache($memberId, $orderId);
\DAO\MemberModel::getInstance()->deleteTotalCache($memberId);
$orderCommonDao= \DAO\Order\OrderCommonModel::getInstance(DbNameConst::masterDBConnectName); $orderCommonDao= \DAO\Order\OrderCommonModel::getInstance(DbNameConst::masterDBConnectName);
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderCommonDao, 'findByOrderId'), array($orderId, $orderCommonDao->orderCommonField)); \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderCommonDao, 'findByOrderId'), array($orderId, $orderCommonDao->orderCommonField));
} }
if(!empty($diliverymanId)){
$this->deleteGetListByMemberId($diliverymanId);
$QmDeliveryLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::salveDBConnectName);
$QmDeliveryLogDao->deleteOrderCache($diliverymanId,$orderId);
}
return true; return true;
} }
...@@ -954,6 +952,7 @@ class OrderModel extends \DAO\AbstractModel ...@@ -954,6 +952,7 @@ class OrderModel extends \DAO\AbstractModel
'orderType' => 'order_type', 'orderType' => 'order_type',
'buyerId' => 'buyer_id', 'buyerId' => 'buyer_id',
'deliveryTime' => 'delivery_time', 'deliveryTime' => 'delivery_time',
'evaluationState'=>'evaluation_state',
); );
} }
......
...@@ -108,15 +108,20 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -108,15 +108,20 @@ class OrderGoodsModel extends \DAO\AbstractModel {
} }
public function deleteOrderGoodsCache($memberId,$orderIds,$storeId=false){ 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(),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)){ if(!empty($storeId)){
return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsCountByStoreId'), array(),array($storeId)); // return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsCountByStoreId'), array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::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;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace DAO\Order; namespace DAO\Order;
use Our\ApiConst; use Our\ApiConst;
use Our\Common;
use Our\DbNameConst; use Our\DbNameConst;
use Our\ImageConst; use Our\ImageConst;
...@@ -93,8 +94,9 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel ...@@ -93,8 +94,9 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel
$where['delivery_state'] = ApiConst::deliveryStateWait; $where['delivery_state'] = ApiConst::deliveryStateWait;
} }
if ($type == ApiConst::orderTypeRefund) { if ($type == ApiConst::orderTypeRefund) {
$where['order_type'] = ApiConst::orderTypeRefund; $where=Common::format(" diliveryman_id={0} and order_type={1} and (delivery_state={2} or delivery_state={3})",$diliveryId,ApiConst::orderTypeRefund,ApiConst::deliveryStateWait,ApiConst::deliveryStateWaitTen);
$where['delivery_state'] = ApiConst::deliveryStateWait; // $where['order_type'] = ApiConst::orderTypeRefund;
// $where['delivery_state'] = ApiConst::deliveryStateWait;
} }
if ($type == ApiConst::deliveryStateWait) { if ($type == ApiConst::deliveryStateWait) {
$where['delivery_state'] = ApiConst::deliveryStateComplete; $where['delivery_state'] = ApiConst::deliveryStateComplete;
......
...@@ -82,10 +82,10 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -82,10 +82,10 @@ class RefundReturnModel extends \DAO\AbstractModel {
$this->errorCode=CodeConfigModel::isNotExpressType; $this->errorCode=CodeConfigModel::isNotExpressType;
$isReturn=FALSE; $isReturn=FALSE;
} }
if($refundReturn['addressId']>ApiConst::zero){ // if($refundReturn['addressId']>ApiConst::zero){
$this->errorCode=CodeConfigModel::isNotExpressType; // $this->errorCode=CodeConfigModel::isNotExpressType;
$isReturn=FALSE; // $isReturn=FALSE;
} // }
return $isReturn; return $isReturn;
} }
/** /**
...@@ -187,7 +187,8 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -187,7 +187,8 @@ class RefundReturnModel extends \DAO\AbstractModel {
* @return array * @return array
*/ */
public function isPlatformIn($refundInfo){ public function isPlatformIn($refundInfo){
if(($refundInfo['isPlatformIn']==ApiConst::platNotIn&&$refundInfo['sellerState']==ApiConst::refundSellerRefuse) || $refundInfo['buyerRefundAmount']>$refundInfo['refundAmount']){
if(($refundInfo['isPlatformIn']==ApiConst::platNotIn && $refundInfo['sellerState']==ApiConst::refundSellerRefuse) || $refundInfo['buyerRefundAmount']>$refundInfo['refundAmount']){
return TRUE; return TRUE;
}else{ }else{
return FALSE; return FALSE;
......
...@@ -270,7 +270,7 @@ class CodeConfigModel { ...@@ -270,7 +270,7 @@ class CodeConfigModel {
const notExsitDeliver=300111; const notExsitDeliver=300111;
const notExsitOrder=300112; const notExsitOrder=300112;
const alreadyExsitRefundGoods=300113; const alreadyExsitRefundGoods=300113;
const notAllowDelete=300114; const notAllowDelete=300114;
//店铺相关错误码 //店铺相关错误码
//商品分类 //商品分类
...@@ -694,7 +694,7 @@ const notAllowDelete=300114; ...@@ -694,7 +694,7 @@ const notAllowDelete=300114;
self::wrongDeliveryTimeRangeForOrder => '下单时配送时间格式', self::wrongDeliveryTimeRangeForOrder => '下单时配送时间格式',
self::noBuyerDeliveryTypeForOrder => '该店铺配置到店自提', self::noBuyerDeliveryTypeForOrder => '该店铺配置到店自提',
self::noDeliveryFeeForBuyerType => '到店自提不收取配送费', self::noDeliveryFeeForBuyerType => '到店自提不收取配送费',
self::noExpressDeliveryForOrder => '该店铺配置快递配送', self::noExpressDeliveryForOrder => '该店铺配置快递配送',
self::wrongPaywayForStoreForOrder => '店铺暂未配置您选择的支付方式', self::wrongPaywayForStoreForOrder => '店铺暂未配置您选择的支付方式',
self::emptyDeliveryFeeForOrder => '下单时配送费不能为空', self::emptyDeliveryFeeForOrder => '下单时配送费不能为空',
self::saveOrderPayFailed => '订单支付信息保存失败', self::saveOrderPayFailed => '订单支付信息保存失败',
...@@ -757,7 +757,7 @@ const notAllowDelete=300114; ...@@ -757,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 => '日志写入失败',
......
...@@ -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);
......
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