Commit c4670ee8 authored by zhz's avatar zhz

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

parents 99e283e3 823946bb
...@@ -136,7 +136,9 @@ class UserController extends \Our\Controller_AbstractIndex { ...@@ -136,7 +136,9 @@ class UserController extends \Our\Controller_AbstractIndex {
$member = $this->memberService->loginWithThirdPlatformInfo($where); $member = $this->memberService->loginWithThirdPlatformInfo($where);
if($member){ if($member){
$userToken=$this->memberService->findMbUserTokenByMemberId($member['member_id']); $userToken=$this->memberService->findMbUserTokenByMemberId($member['member_id']);
$this->memberService->clearKey($userToken['token']); if(!empty($userToken['token'])){
$this->updateOldLoginKey($userToken['token']);
}
$this->memberService->clearKey($this->key); $this->memberService->clearKey($this->key);
$this->key=Common::bulidToken('', '', '', \Our\ApiConst::wechatDeviceType); $this->key=Common::bulidToken('', '', '', \Our\ApiConst::wechatDeviceType);
session_id($this->key); session_id($this->key);
......
...@@ -312,7 +312,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -312,7 +312,7 @@ class OrderServiceModel extends \Business\AbstractModel
if($resultRefund){ if($resultRefund){
$where['order_id']=$order['orderId']; $where['order_id']=$order['orderId'];
//$orderGoodsUpdateData['refund_state_name']='退款成功'; //$orderGoodsUpdateData['refund_state_name']='退款成功';
$orderGoodsUpdateData['is_refund']=1; $orderGoodsUpdateData['is_refund']=ApiConst::refundSuccess;
$orderGoodsDao->update($where,$orderGoodsUpdateData); $orderGoodsDao->update($where,$orderGoodsUpdateData);
} }
} }
......
...@@ -93,7 +93,7 @@ FROM han_goods_common t1 where t1.goods_state={1} and t1.goods_verify={2} and t1 ...@@ -93,7 +93,7 @@ FROM han_goods_common t1 where t1.goods_state={1} and t1.goods_verify={2} and t1
) a ) a
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,\Our\ApiConst::onlineGoodsState); WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\ApiConst::onlineGoodsState,\Our\ApiConst::onlineGoodsVerify,$storeId,\Our\ApiConst::onlineGoodsDel);
$list = $this->db->query($sql)->rows; $list = $this->db->query($sql)->rows;
return $list; return $list;
} }
......
...@@ -83,13 +83,18 @@ class OrderModel extends \DAO\AbstractModel ...@@ -83,13 +83,18 @@ class OrderModel extends \DAO\AbstractModel
public function getShopKeeperCountByStoreId($storeId) public function getShopKeeperCountByStoreId($storeId)
{ {
$refundReturnDao=\DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
$begin = strtotime(date("Y-m-d"), time()); $begin = strtotime(date("Y-m-d"), time());
$end = TIMESTAMP; $end = TIMESTAMP;
$notInState=ApiConst::orderStateCancel.','.ApiConst::orderStateClose; $notInState=ApiConst::orderStateCancel.','.ApiConst::orderStateClose;
$where = Common::format(" store_id={0} and order_state not in ({1})", $storeId,$notInState); $where = Common::format(" store_id={0} and order_state not in ({1})", $storeId,$notInState);
$orderTotal = $this->getOrderCounts($where, $this->countField); $orderTotal = $this->getOrderCounts($where, $this->countField);
$where .= Common::format(" and add_time between {0} and {1}", $begin, $end); $refundAmount=$refundReturnDao->getRefundSuccessMoneyByStoreId($storeId);
$orderTotal['orderTotal']=$orderTotal['orderTotal']-$refundAmount;
$where .= Common::format(" and gmt_update between {0} and {1}", $begin, $end);
$todayTotal = $this->getOrderCounts($where, $this->countField); $todayTotal = $this->getOrderCounts($where, $this->countField);
$todayRefund=$refundReturnDao->getRefundSuccessMoneyByStoreId($storeId,$begin,$end);
$todayTotal['orderTotal']=$todayTotal['orderTotal']-$todayRefund;
$total['todayOrderTotal'] = isset($todayTotal['orderTotal']) ? $todayTotal['orderTotal'] : ApiConst::zero; $total['todayOrderTotal'] = isset($todayTotal['orderTotal']) ? $todayTotal['orderTotal'] : ApiConst::zero;
$total['todayOrderCount'] = isset($todayTotal['orderCount']) ? $todayTotal['orderCount'] : ApiConst::zero; $total['todayOrderCount'] = isset($todayTotal['orderCount']) ? $todayTotal['orderCount'] : ApiConst::zero;
$total['orderTotal'] = isset($orderTotal['orderTotal']) ? (int)$orderTotal['orderTotal'] : ApiConst::zero; $total['orderTotal'] = isset($orderTotal['orderTotal']) ? (int)$orderTotal['orderTotal'] : ApiConst::zero;
...@@ -227,6 +232,7 @@ class OrderModel extends \DAO\AbstractModel ...@@ -227,6 +232,7 @@ class OrderModel extends \DAO\AbstractModel
public function insert($data) public function insert($data)
{ {
$this->setDb(\Our\DbNameConst::masterDBConnectName); $this->setDb(\Our\DbNameConst::masterDBConnectName);
$data['gmt_update']=TIMESTAMP;
$result = $this->db->insert($this->_tableName)->rows($data)->execute(); $result = $this->db->insert($this->_tableName)->rows($data)->execute();
return $result; return $result;
} }
......
...@@ -65,6 +65,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -65,6 +65,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
public function getOrderGoodsCountByStoreId($storeId){ public function getOrderGoodsCountByStoreId($storeId){
$this->setDb($this->dbName); $this->setDb($this->dbName);
$where['store_id']=$storeId; $where['store_id']=$storeId;
$where['is_refund']=array('neq',ApiConst::refundSuccess);
$goodsCount = $this->db->select($this->orderGoodsGoodsNumCountField)->from($this->_tableName)->where($where)->fetchNum(); $goodsCount = $this->db->select($this->orderGoodsGoodsNumCountField)->from($this->_tableName)->where($where)->fetchNum();
return $goodsCount; return $goodsCount;
} }
...@@ -230,15 +231,9 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -230,15 +231,9 @@ class OrderGoodsModel extends \DAO\AbstractModel {
} }
public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){ public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
$this->setDb($this->dbName); $this->setDb($this->dbName);
// if(is_array($storeIds)){
// $storeIds=implode(',',$storeIds);
// }
// if(is_array($memberIds)){
// $memberIds=implode($memberIds);
// }
$where['store_id']=array('in',$storeIds); $where['store_id']=array('in',$storeIds);
$where['buyer_id']=array('in',$memberIds); $where['buyer_id']=array('in',$memberIds);
$where['is_refund']=array('neq',ApiConst::one); $where['is_refund']=array('neq',ApiConst::refundSuccess);
$where=$this->db->getSqlWhereByArray($where); $where=$this->db->getSqlWhereByArray($where);
$res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchAll(); $res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchAll();
return $res; return $res;
......
...@@ -26,6 +26,7 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -26,6 +26,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
public $refundDetailField='is_platform_in as isPlatformIn,seller_state as sellerState,platform_state as platformState,refund_id as refundId,order_id as orderId,store_id as storeId,order_goods_id as orderGoodsId'; public $refundDetailField='is_platform_in as isPlatformIn,seller_state as sellerState,platform_state as platformState,refund_id as refundId,order_id as orderId,store_id as storeId,order_goods_id as orderGoodsId';
public $refundReturnField="seller_state,refund_state,is_platform_in,platform_state"; public $refundReturnField="seller_state,refund_state,is_platform_in,platform_state";
private $sumField="order_id as orderId,buyer_id as buyerId,store_id as storeId,goods_num as goodsNum,refund_amount as refundAmount,is_suc_refund as isSucRefund,gmt_update as gmtUpdate"; private $sumField="order_id as orderId,buyer_id as buyerId,store_id as storeId,goods_num as goodsNum,refund_amount as refundAmount,is_suc_refund as isSucRefund,gmt_update as gmtUpdate";
private $sumRefundAmount=" sum(refund_amount) as sumRefundAmont";
/** /**
* 主键 * 主键
* *
...@@ -47,6 +48,18 @@ class RefundReturnModel extends \DAO\AbstractModel { ...@@ -47,6 +48,18 @@ class RefundReturnModel extends \DAO\AbstractModel {
return $list; return $list;
} }
public function getRefundSuccessMoneyByStoreId($storeId,$beginTime=false,$endTime=false){
$this->setDb($this->dbName);
if($beginTime){
$where=\Our\Common::format(" store_id={0} and is_suc_refund={1} and gmt_update between {2} and {3}",$storeId,ApiConst::refundSuccess,$beginTime,$endTime);
}else{
$where=\Our\Common::format(" store_id={0} and is_suc_refund={1}",$storeId,ApiConst::refundSuccess);
}
$res=$this->db->from($this->_tableName)->select($this->sumRefundAmount)->where($where)->fetchValue();
return !empty($res)?$res:ApiConst::zero;
}
/** /**
* 更新数据 * 更新数据
* @param $data * @param $data
......
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