Commit f4a1222c authored by liuyuzhen's avatar liuyuzhen

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

parents 2d9e230d 1e5974db
......@@ -174,6 +174,8 @@ class ApiConst
const shippingStatusSendingFail = 4;
//平台介入
const platIn = 1;
const platAgree = 1;
const platRefuse = 2;
const platNotIn = 0;
//平台介入中
const platProccess=2;
......
......@@ -118,6 +118,11 @@ class ArrayConst
'href'=>'',
'price'=>0
);
const orderCloseAndCancel=array(
0,
-1
);
//确认收货按钮0为未操作过,1为操作过,
const reachRemindButtons=array(
array(
......
......@@ -237,7 +237,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$firstClassId = intval($param['firstClassId']);
$secondClassId = intval($param['secondClassId']);
$thirdClassId = intval($param['thirdClassId']);
$keyword = trim($param['keyword']);
$keyword = (string)trim($param['keyword']);
$minPrice = intval($param['minPrice']);
$maxPrice = intval($param['maxPrice']);
$goodsSort = intval($param['goodsSort']);
......@@ -247,7 +247,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$secondClassId && $where[] = "gc_id_2 = {$secondClassId}";
$thirdClassId && $where[] = "gc_id_3 = {$thirdClassId}";
$storeThirdClassId && $where[] = "goods_class_t_id = {$storeThirdClassId}";
$keyword && $where[] = "goods_name like '%{$keyword}%'";
$keyword !== '' && $where[] = "goods_name like '%{$keyword}%'";
list($_where,$order,$attrStr,$saleSort) = $this->getParam($attrValue,$minPrice,$maxPrice,$goodsSort);
$where = array_merge($where,$_where);
......@@ -803,7 +803,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$thirdClassId = (int)($param['thirdClassId']);
$storeThirdClassId = (int)($param['storeThirdClassId']);
$couponId = (int)$param['couponId'];
$keyword = trim($param['keyword']);
$keyword = (string)trim($param['keyword']);
$couponDao = \DAO\Coupon\CouponModel::getInstance();
$couponId && $coupon = $couponDao->findById($couponId);
......@@ -832,7 +832,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$productData = [];
$attributeRedis = \Redis\Db4\GoodsAttributeRedisModel::getInstance();
$attrbuteDAO = \DAO\GoodsAttributeModel::getInstance();
if(!empty($keyword)){
if($keyword !== ''){
// if($where){
// $where = implode(' AND ',$where);
// }
......
......@@ -104,7 +104,7 @@ class OrderServiceModel extends \Business\AbstractModel
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$goodsDao = \DAO\GoodsModel::getInstance(DbNameConst::salveDBConnectName);
$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
//$refundReturnDao = \DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
if ($keyWord !== false) {
$where = $this->getOrderIndexWhere($memberId, $keyWord, $pageIndex, $pageSize);
if($where===false){
......@@ -128,7 +128,7 @@ class OrderServiceModel extends \Business\AbstractModel
}
//获得订单列表
$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($memberId));
$orders = \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$orderDao, 'getList'), array($where, $this->orderField, $pageIndex, $pageSize, $order = array('gmt_update' => 'desc')), \Our\ApiConst::oneDaySecond, array($memberId));
if (!empty($orders['list'])) {
$orderIds = array_column($orders['list'], 'orderId');
//获得订单商品列表
......@@ -561,6 +561,13 @@ class OrderServiceModel extends \Business\AbstractModel
if(!$update || !$res){
echo '订单:'.$order['orderId'].'没取消成功!';
}
//$orderGoodsUpdateData['refund_state_name']='退款成功';
$orderGoodsUpdateData['is_refund']=1;
$whereOrderGoods['order_id']=$order['orderId'];
$orderGoodsUpdateRes=$orderGoodsDao->update($whereOrderGoods,$orderGoodsUpdateData);
if(!$orderGoodsUpdateRes){
echo '订单:'.$order['order_id'].'is_refund'.'没更新成功';
}
$orderDao->deleteOrderCache($order['buyerId'],(string)$order['orderId'],$order['storeId'],true);
}
$orderIds = array_column($orders, 'orderId');
......@@ -730,7 +737,7 @@ class OrderServiceModel extends \Business\AbstractModel
if (empty($diliverymanIds)) {
ErrorModel::throwException(CodeConfigModel::commonError);
}
$qmDeliveryLogList = $qmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanIds, $type, $pageIndex, $pageSize,$memberId);
$qmDeliveryLogList = $qmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanIds, $type, $pageIndex, $pageSize,array('get_time' => 'desc'),$memberId);
$orderIds = array_column($qmDeliveryLogList['list'], 'orderId');
// echo json_encode($orderIds);exit;
// $where['delete_state'] = ApiConst::undeleteOrder;
......@@ -765,7 +772,7 @@ class OrderServiceModel extends \Business\AbstractModel
$delivery['mobPhone'] = $delivery['mobPhone'] ? $delivery['mobPhone'] : '';
$delivery['finishTime'] = $delivery['finishTime'] ? $delivery['finishTime'] : ApiConst::zero;
$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['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'] : '';
......@@ -833,6 +840,7 @@ class OrderServiceModel extends \Business\AbstractModel
if($delivery['deliveryState']==ApiConst::deliveryStateWait||$delivery['deliveryState']==ApiConst::deliveryStateWaitTen){
$delivery['deliveryState']=ApiConst::deliveryStateWait;
}
// $reciverInfo['sub_address']
$returnData = array(
'orderId' => $this->order['orderId'],
'storeName' => $this->order['storeName'],
......@@ -845,10 +853,10 @@ class OrderServiceModel extends \Business\AbstractModel
'getTime' => $delivery['getTime'],
'reciverName' => $this->orderCommon['reciverName'],
'mobPhone' => $reciverInfo['mob_phone'],
'street' => $reciverInfo['street'],
'street' => $reciverInfo['address'],
'lng' => isset($reciverInfo['lng']) ? $reciverInfo['lng'] : ApiConst::zero,
'lat' => isset($reciverInfo['lat']) ? $reciverInfo['lat'] : ApiConst::zero,
'subAddress' => isset($reciverInfo['sub_address']) ? $reciverInfo['sub_address'] : '',
'subAddress' => isset($reciverInfo['sub_address'])?$reciverInfo['sub_address']:'',
'orderGoods' => $orderGoods,
'shippingFee' => $this->order['shippingFee'],
......@@ -871,7 +879,7 @@ class OrderServiceModel extends \Business\AbstractModel
$push = Push::getInstance();
$push->reacheRemind($order['buyerId'], $order['orderId'], $order['orderSn']);
}
$orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId'], $order['storeId'],true);
$orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId'], $order['storeId'],true,true,true,$memberid);
$qmDeliverymanLogDao->deleteOrderCache($memberid, $id);
return $updateResult;
} else {
......
......@@ -491,7 +491,6 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$this->taskIndex = PageConst::taskPageBegin;
$this->taskSize = PageConst::taskPageSize;
do {
$addDatas = array();
$storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize);
$storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false;
if($storeMemberStatisticData){
......@@ -506,7 +505,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
if(!empty($ordersCount) && !empty($refundLists)){
foreach($ordersCount as &$order){
foreach($refundLists as $refund){
if($order['buyerId']==$refund['buyerId'] and $order['storeId']==$refund['storeId']){
if($order['buyerId']==$refund['buyerId'] && $order['storeId']==$refund['storeId']){
$order['orderTotal']=$order['orderTotal']-$refund['refundTotal'];
}
}
......
......@@ -386,6 +386,20 @@ class OrderModel extends \DAO\AbstractModel
}
}
public function getFieldByWhere($where,$filed){
$this->setDb($this->dbName);
if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where);
}
$res=$this->db->from($this->_tableName)->select($filed)->where($where)->fetchAll();
if($res){
$fie=array_column($res,$filed);
return $fie;
}else{
return [];
}
}
public function getSumAmountCountByMemberAndStoreId($storeIds,$memberIds)
{
$this->setDb($this->dbName);
......
......@@ -2,6 +2,7 @@
namespace DAO\Order;
use Our\ApiConst;
use Our\ArrayConst;
use Our\Common;
use Our\DbNameConst;
use Our\ImageConst;
......@@ -65,8 +66,15 @@ class OrderGoodsModel extends \DAO\AbstractModel {
}
public function getOrderGoodsCountByStoreId($storeId){
$this->setDb($this->dbName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$where['store_id']=$storeId;
$where['is_refund']=array('neq',ApiConst::refundSuccess);
$whereOrder['store_id']=array('eq',$storeId);
$whereOrder['order_state']=array('in',ArrayConst::orderCloseAndCancel);
$orderIds=$orderDao->getFieldByWhere($whereOrder,'order_id');
if($orderIds){
$where['order_id']=array('notin',$orderIds);
}
if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where);
}
......@@ -235,9 +243,17 @@ class OrderGoodsModel extends \DAO\AbstractModel {
}
public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
$this->setDb($this->dbName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$whereOrder['store_id']=array('in',$storeIds);
$whereOrder['buyer_id']=array('in',$memberIds);
$whereOrder['order_state']=array('in',ArrayConst::orderCloseAndCancel);
$orderIds=$orderDao->getFieldByWhere($whereOrder,'order_id');
$where['store_id']=array('in',$storeIds);
$where['buyer_id']=array('in',$memberIds);
$where['is_refund']=array('neq',ApiConst::refundSuccess);
if($orderIds){
$where['order_id']=array('notin',$orderIds);
}
$where=$this->db->getSqlWhereByArray($where);
$res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchAll();
return $res;
......
......@@ -164,7 +164,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
}
public function getStatusExtent($returnRefund){
if($returnRefund['refundState']!=ApiConst::refundCompleted){
// if($returnRefund['refundState']!=ApiConst::refundCompleted){
if($returnRefund['sellerState']==ApiConst::refundSellerAgree){
if($returnRefund['isSucRefund']==ApiConst::refundSuccess){
return OrderConst::refoundSuccess;
......@@ -184,6 +184,12 @@ class RefundReturnModel extends \DAO\AbstractModel {
if($returnRefund['isSucRefund']==ApiConst::refundSuccess){
return OrderConst::refoundSuccess;
}
if($returnRefund['platformState']==ApiConst::platAgree){
return OrderConst::platFormAgree;
}
if($returnRefund['platformState']==ApiConst::platRefuse){
return OrderConst::platFormRefuse;
}
if($returnRefund['isPlatformIn']==ApiConst::platIn){
return OrderConst::platFromProccess;
}
......@@ -193,10 +199,11 @@ class RefundReturnModel extends \DAO\AbstractModel {
if($returnRefund['refundType']==ApiConst::refundTypeGoods){
return OrderConst::sellerRefuseGoods;
}
}
}else{
return OrderConst::refoundSuccess;
}
// }else{
// return OrderConst::refoundSuccess;
// }
}
......@@ -207,9 +214,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
case ApiConst::refundSellerAgree:$refundText=$this->getStatusExtent($refundReturn);break;
case ApiConst::refundSellerRefuse:$refundText=$this->getStatusExtent($refundReturn);break;
}
if($refundReturn['']){
}
return $refundText;
}
public function getStatusText($orderId){
......@@ -225,7 +230,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
*/
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;
}else{
return FALSE;
......@@ -394,7 +399,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
//删除订单详情缓存
public function deleteFindByOrderIdCache($refundId)
{
return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'findByRefundId'), array($refundId));
return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'findByRefundId'), array(),array($refundId));
}
//删除订单列表缓存
......@@ -435,7 +440,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
public function getMemberStoreStaticsByGmtUpdate($gmtUpdate,$pageIndex,$pageSize){
$this->setDb($this->dbName);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} and refund_state={2}',$gmtUpdate,TIMESTAMP,ApiConst::refundStateComplete);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} and refund_state={2}',$gmtUpdate,TIMESTAMP,ApiConst::refundStateComplete);
$res=$this->lists($where,array('gmt_update'=>'asc'),$this->sumField,$pageIndex,$pageSize);
return $res['list']?$res:false;
}
......
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