From 00fb209800efd6900ac454342b72dac7615ac027 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 10 Oct 2024 16:19:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AE=A2=E5=8D=95=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=8F=8A=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA=EF=BC=9B=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E4=BA=A7=E5=93=81=E6=8A=A5=E4=BB=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7ID=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 BeforehandOrderLists 类的 lists 方法中添加 order_type 字段,并增加对应的订单类型名称显示 - 在 PurchaseProductOfferController 类的 lists 方法中设置 uid 参数为当前用户 ID - 在 PurchaseProductOfferLists 类的 lists 方法中根据 uid 进行搜索条件设置,并在 count 方法中添加对应逻辑 --- .../beforehand_order/BeforehandOrderLists.php | 9 ++++++++- .../PurchaseProductOfferController.php | 1 + .../PurchaseProductOfferLists.php | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index 0026a05de..9e2e1ea79 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -43,7 +43,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte public function lists(): array { return BeforehandOrder::where($this->searchWhere) - ->field(['id','order_id', 'uid','total_num','total_price','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark']) + ->field(['id','order_id', 'uid','order_type','total_num','total_price','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item){ @@ -52,6 +52,13 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte }else{ $item->admin_name=''; } + if($item->order_type==1){ + $item->order_type_name='普通订单'; + }elseif($item->order_type==2){ + $item->order_type_name='商贩订单'; + }elseif($item->order_type==3){ + $item->order_type_name='一条龙订单'; + } }) ->toArray(); } diff --git a/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php b/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php index 658a806f7..ff5b04181 100644 --- a/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php +++ b/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php @@ -26,6 +26,7 @@ class PurchaseProductOfferController extends BaseApiController */ public function lists() { + $this->request->__set('uid',$this->userId); return $this->dataLists(new PurchaseProductOfferLists()); } diff --git a/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php b/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php index d80f67758..73ef2ef1d 100644 --- a/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php +++ b/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php @@ -18,7 +18,7 @@ use app\api\lists\BaseApiDataLists; class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchInterface { - + public $userId; /** * @notes 设置搜索条件 * @return \string[][] @@ -44,6 +44,12 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI */ public function lists(): array { + $uid=$this->request->__get('uid'); + if($uid){ + $this->searchWhere[]=['buyer_id','=',$uid]; + }else{ + return []; + } return PurchaseProductOffer::where($this->searchWhere) ->field(['id', 'order_id', 'product_id', 'price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', ]) ->limit($this->limitOffset, $this->limitLength) @@ -81,7 +87,11 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI */ public function count(): int { - return PurchaseProductOffer::where($this->searchWhere)->count(); + if($this->userId){ + return 0; + }else{ + return PurchaseProductOffer::where($this->searchWhere)->count(); + } } } \ No newline at end of file