feat(StoreOrderCartInfoTwoLists): 添加根据店铺名称搜索商品功能

This commit is contained in:
mkm 2024-08-21 10:52:41 +08:00
parent 219c372ca8
commit 2742da2640

View File

@ -23,6 +23,7 @@ use app\common\model\system_store\SystemStore;
class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
{ {
public $ids;
/** /**
* @notes 设置搜索条件 * @notes 设置搜索条件
* @return \string[][] * @return \string[][]
@ -49,6 +50,16 @@ class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSear
*/ */
public function lists(): array public function lists(): array
{ {
if ($this->request->get('store_name')) {
$store_name = $this->request->get('store_name');
$ids = StoreProduct::where('store_name', 'like', '%' . $store_name . '%')->column('id');
if ($ids) {
$this->searchWhere[] = ['product_id', 'in', $ids];
$this->ids = $ids;
} else {
return [];
}
}
if ($this->request->get('start_time') == '') { if ($this->request->get('start_time') == '') {
$this->searchWhere[] = ['create_time', 'between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]]; $this->searchWhere[] = ['create_time', 'between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]];
} }