From b7f9a3b5ee18cef9af3c6d2aec22cddc619c2416 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 10 Jan 2025 17:50:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(change=5Fprice=5Flog):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=B7=E6=A0=BC=E5=8F=98=E6=9B=B4=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加商品名称和会员组名称字段 - 优化 store_name 搜索条件 - 调整列表数据返回格式,增加创建时间和关联信息 --- .../change_price_log/ChangePriceLogLists.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/store/lists/change_price_log/ChangePriceLogLists.php b/app/store/lists/change_price_log/ChangePriceLogLists.php index 00edc68ed..c8c461e58 100644 --- a/app/store/lists/change_price_log/ChangePriceLogLists.php +++ b/app/store/lists/change_price_log/ChangePriceLogLists.php @@ -7,6 +7,7 @@ use app\common\lists\BaseDataLists; use app\common\model\change_price_log\ChangePriceLog; use app\common\lists\ListsSearchInterface; use app\common\model\store_product\StoreProduct; +use app\common\model\user_ship\UserShip; /** * 价格变更记录列表 @@ -44,7 +45,7 @@ class ChangePriceLogLists extends BaseDataLists implements ListsSearchInterface { if ($this->request->get('store_name')) { $store_name = $this->request->get('store_name'); - $ids = StoreProduct::where('store_name', 'like', '%' . $store_name . '%')->where('status',1)->column('id'); + $ids = StoreProduct::where('store_name', 'like', '%' . $store_name . '%')->where('status', 1)->column('id'); if ($ids) { $this->searchWhere[] = ['product_id', 'in', $ids]; $this->ids = $ids; @@ -53,10 +54,14 @@ class ChangePriceLogLists extends BaseDataLists implements ListsSearchInterface } } return ChangePriceLog::where($this->searchWhere) - ->field(['id', 'product_id', 'group_id', 'before_price', 'after_price']) + ->field(['id', 'product_id', 'group_id', 'before_price', 'after_price','create_time']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) - ->select() + ->select()->each(function ($item) { + $store_name= StoreProduct::where('id', $item['product_id'])->value('store_name'); + $item->store_name = $store_name; + $item->group_name=UserShip::where('id',$item['group_id'])->value('title'); + }) ->toArray(); } @@ -69,12 +74,11 @@ class ChangePriceLogLists extends BaseDataLists implements ListsSearchInterface */ public function count(): int { - if($this->request->get('store_name')){ - if($this->ids<=0){ + if ($this->request->get('store_name')) { + if ($this->ids <= 0) { return 0; } } return ChangePriceLog::where($this->searchWhere)->count(); } - -} \ No newline at end of file +}