feat(change_price_log): 优化价格变更记录列表接口

- 添加商品名称和会员组名称字段
- 优化 store_name 搜索条件
- 调整列表数据返回格式,增加创建时间和关联信息
This commit is contained in:
mkm 2025-01-10 17:50:29 +08:00
parent dbb7b9e4c8
commit b7f9a3b5ee

View File

@ -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;
/**
* 价格变更记录列表
@ -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();
}
@ -76,5 +81,4 @@ class ChangePriceLogLists extends BaseDataLists implements ListsSearchInterface
}
return ChangePriceLog::where($this->searchWhere)->count();
}
}