This commit is contained in:
mkm 2024-01-13 10:30:27 +08:00
parent b1b89e5a26
commit 49c48f02b0
2 changed files with 16 additions and 9 deletions

View File

@ -628,7 +628,7 @@ class StoreOrderRepository extends BaseRepository
* @author xaboy * @author xaboy
* @day 2020/6/10 * @day 2020/6/10
*/ */
public function userOrderNumber(int $uid, $product_type = 0) public function userOrderNumber(int $uid, $product_type = 0,$source=2)
{ {
//activity_type0普通订单 98采购订单 99委托商品 //activity_type0普通订单 98采购订单 99委托商品
//$noPay = app()->make(StoreGroupOrderRepository::class)->orderNumber($uid, $product_type); //$noPay = app()->make(StoreGroupOrderRepository::class)->orderNumber($uid, $product_type);
@ -636,14 +636,20 @@ class StoreOrderRepository extends BaseRepository
if ($product_type == 98 || $product_type == 99) { if ($product_type == 98 || $product_type == 99) {
$isUser = 0; $isUser = 0;
} }
$noPay = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(1))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->count(); $where['activity_type']=$product_type;
$noPostage = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(2))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); if($source==103){
$noDeliver = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(3))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); $where['activity_type']=[0,98];
$noComment = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(4))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); $where['source']=[2,103];
$done = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(5))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); }
$noComment = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(4))->where($where)->where('StoreOrder.is_del', 0)->count();
$noPay = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(1))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where($where)->where('StoreOrder.is_del', 0)->count();
$noPostage = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(2))->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
$noDeliver = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(3))->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
$noComment = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(4))->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
$done = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(5))->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
$refund = StoreRefundOrder::alias('t1')->join('store_order t2', 't1.order_id=t2.order_id')->where('t1.uid', $uid)->where('t1.status', 3)->where('t2.activity_type', $product_type)->count(); $refund = StoreRefundOrder::alias('t1')->join('store_order t2', 't1.order_id=t2.order_id')->where('t1.uid', $uid)->where('t1.status', 3)->where('t2.activity_type', $product_type)->count();
$orderPrice = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(8))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->sum('pay_price'); $orderPrice = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(8))->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->sum('pay_price');
$orderCount = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count(); $orderCount = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($where)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
return compact('noComment', 'done', 'refund', 'noDeliver', 'noPay', 'noPostage', 'orderPrice', 'orderCount'); return compact('noComment', 'done', 'refund', 'noDeliver', 'noPay', 'noPostage', 'orderPrice', 'orderCount');
} }

View File

@ -164,7 +164,8 @@ class StoreOrder extends BaseController
public function number() public function number()
{ {
$productType = $this->request->param('product_type', 0); $productType = $this->request->param('product_type', 0);
return app('json')->success($this->repository->userOrderNumber($this->request->uid(), $productType)); $source = $this->request->param('source', 2);
return app('json')->success($this->repository->userOrderNumber($this->request->uid(), $productType,$source));
} }
/** /**