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 +}