From 3d897d5ddafecd1ada922502c3515ba3a2b0ebd4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 9 Jan 2025 15:10:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E4=BC=98=E5=8C=96=E4=BA=A7?= =?UTF-8?q?=E5=93=81=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 - 在 StoreProductGroupPriceLists 中添加按产品名称搜索的功能 - 使用 $request->get() 获取 store_name 参数,实现模糊搜索 - 在 IndexController 中添加注释,便于后续开发调试 --- .../StoreProductGroupPriceLists.php | 11 ++++++----- app/api/controller/IndexController.php | 10 ++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/admin/lists/store_product_group_price/StoreProductGroupPriceLists.php b/app/admin/lists/store_product_group_price/StoreProductGroupPriceLists.php index 7fbbb9103..9bd49c77f 100644 --- a/app/admin/lists/store_product_group_price/StoreProductGroupPriceLists.php +++ b/app/admin/lists/store_product_group_price/StoreProductGroupPriceLists.php @@ -44,11 +44,11 @@ class StoreProductGroupPriceLists extends BaseAdminDataLists implements ListsSea public function lists(): array { $query = StoreProduct::field('id,store_name,purchase,cost,vip_price,price,unit'); - if ($this->params['product_id']) { - $query->where('id|store_name', $this->params['product_id']); + $store_name=$this->request->get('store_name',''); + if ($store_name!='') { + $query->where('store_name', 'like', '%'.$store_name.'%'); } return $query->limit($this->limitOffset, $this->limitLength) - ->field('id,store_name,purchase,cost,vip_price,price,unit') ->order(['id' => 'desc']) ->select()->each(function ($item) { $item['lists'] =StoreProductGroupPrice::where('product_id',$item['id'])->field('id,group_id,price') @@ -75,8 +75,9 @@ class StoreProductGroupPriceLists extends BaseAdminDataLists implements ListsSea public function count(): int { $query = StoreProduct::field('id,store_name,purchase,cost,vip_price,price,unit'); - if ($this->params['product_id']) { - $query->where('id|store_name', $this->params['product_id']); + $store_name=$this->request->get('store_name',''); + if ($store_name!='') { + $query->where('store_name', 'like', '%'.$store_name.'%'); } return $query->count(); } diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 2aa3f0e1c..1cded3f70 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -9,11 +9,13 @@ use app\admin\logic\store_product\StoreProductLogic; use app\admin\validate\tools\GenerateTableValidate; use app\admin\logic\tools\GeneratorLogic; use app\api\lists\purchase_product_offer\PurchaseProductOfferListsTwo; +use app\api\logic\DemoLogic; use app\api\logic\order\OrderLogic as OrderOrderLogic; use app\common\cache\ExportCache; use app\common\logic\ChangeLogLogic; use app\common\logic\PayNotifyLogic; use app\common\logic\store_order\StoreOrderLogic; +use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo; use app\common\model\beforehand_order_record\BeforehandOrderRecord; use app\common\model\Config as ModelConfig; use app\common\model\purchase_product_offer\PurchaseProductOffer; @@ -59,6 +61,14 @@ class IndexController extends BaseApiController public function index() { + // $arr=BeforehandOrderCartInfo::where('bhoid',1284)->select(); + // foreach ($arr as $k=>$v){ + // $product_id=StoreBranchProduct::where('id',$v['product_id'])->value('product_id'); + // BeforehandOrderCartInfo::where('id',$v['id'])->update(['product_id'=>$product_id]); + // } + // $a=StoreOrderCartInfo::where('store_id',2)->whereBetweenTime('create_time','2025-01-01','2025-01-8')->select()->toArray(); + // d($a); + // DemoLogic::test(); d(1); $arr = Db::name('ceshi_copy')->select(); foreach ($arr as $k => $v) {