From e10e8ffe95dd9ff8878ad61ac1cd1a3b2557717a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 14 Nov 2024 17:21:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(purchase=5Fproduct=5Foffer):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=87=87=E8=B4=AD=E4=BA=A7=E5=93=81=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E5=8D=95=E6=8D=AE=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 PurchaseProductOfferLists 中添加订单号字段 - 在 PurchaseProductOfferLogic 中修改采购信息设置权限验证逻辑 --- .../purchase_product_offer/PurchaseProductOfferLists.php | 2 ++ .../purchase_product_offer/PurchaseProductOfferLogic.php | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php b/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php index b03722382..1844286e2 100644 --- a/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php +++ b/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php @@ -7,6 +7,7 @@ use app\admin\lists\BaseAdminDataLists; use app\common\lists\ListsExcelInterface; use app\common\model\purchase_product_offer\PurchaseProductOffer; use app\common\lists\ListsSearchInterface; +use app\common\model\beforehand_order\BeforehandOrder; use app\common\model\delivery_service\DeliveryService; use app\common\model\store_category\StoreCategory; use app\common\model\store_product\StoreProduct; @@ -62,6 +63,7 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item) use($job_ids){ + $item->order_sn=BeforehandOrder::where('id',$item['order_id'])->value('order_id'); $find=StoreProduct::where('id',$item->product_id)->withTrashed()->find(); $item->store_name=$find->store_name; $item->store_info=$find->store_info; diff --git a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php index 985b39ec5..df4a11ef0 100644 --- a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php +++ b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php @@ -5,8 +5,10 @@ namespace app\admin\logic\purchase_product_offer; use app\common\model\purchase_product_offer\PurchaseProductOffer; use app\common\logic\BaseLogic; +use app\common\model\auth\Admin; use app\common\model\beforehand_order\BeforehandOrder; use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo; +use app\common\model\delivery_service\DeliveryService; use app\common\model\dict\DictData; use app\common\model\store_product\StoreProduct; use app\common\model\store_product_price\StoreProductPrice; @@ -112,8 +114,11 @@ class PurchaseProductOfferLogic extends BaseLogic public static function setProcureInfo(array $params): bool { $offer = PurchaseProductOffer::where(['id' => $params['id']])->find(); - if($offer['buyer_id']!=$params['admin_id']){ - throw new BusinessException('您不是当事采购员,无法设置采购信息'); + $uid=Admin::where('id',$params['admin_id'])->value('uid'); + if($params['admin_id']!=1){ + if($offer['buyer_id']!=$uid){ + throw new BusinessException('您不是当事采购员,无法设置采购信息'); + } } Db::startTrans(); try { From 597554b854bf90706a3832094c01d7a0f026475b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 14 Nov 2024 17:57:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(admin):=20=E9=87=87=E8=B4=AD=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=8A=A5=E4=BB=B7=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=BC=96=E5=8F=B7=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 PurchaseProductOfferLists 类中添加订单编号模糊搜索逻辑 - 通过获取请求参数 order_sn,查询匹配的订单 ID 列表 - 将匹配的订单 ID 添加到搜索条件中,实现模糊搜索功能 --- .../purchase_product_offer/PurchaseProductOfferLists.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php b/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php index 1844286e2..5d72a652f 100644 --- a/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php +++ b/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php @@ -59,6 +59,12 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc } } $job_ids=$this->adminInfo['job_ids']??[]; + if($this->request->get('order_sn')){ + $ids=BeforehandOrder::where('order_id','like','%'.$this->request->get('order_sn'))->column('id'); + if($ids){ + $this->searchWhere[]=['order_id','in',$ids]; + } + } return PurchaseProductOffer::where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc'])