diff --git a/app/Controller/v3/StoreController.php b/app/Controller/v3/StoreController.php index 269c3b3..9afaf4a 100644 --- a/app/Controller/v3/StoreController.php +++ b/app/Controller/v3/StoreController.php @@ -111,6 +111,7 @@ class StoreController extends BaseController $page = $this->request->input('page',1); $pagesize = $this->request->input('pagesize',10); $ids = $this->request->input('ids',''); + $ids = explode(',',$ids); $employees = Employees::query() ->where('user_id',$userId) ->whereJsonContains('position', '30') diff --git a/app/Service/v3/Implementations/StoreService.php b/app/Service/v3/Implementations/StoreService.php index d4a214c..5707954 100644 --- a/app/Service/v3/Implementations/StoreService.php +++ b/app/Service/v3/Implementations/StoreService.php @@ -58,19 +58,18 @@ class StoreService implements StoreServiceInterface ->first(); } - public function getList($marketId,$ids, $page=1, $pagesize=10) + public function getList($marketId,$ids = [], $page=1, $pagesize=10) { $market = Market::query()->withoutGlobalScope('normal')->find($marketId); $builder = Store::query()->where('market_id',$marketId); if(!is_null($ids)){ - $ids = explode(',',$ids); $builder->whereNotIn('id',$ids); } $paginate = $builder->orderBy('is_rest', 'asc')->paginate($pagesize); $stores = $paginate->toArray(); $market->stores = $stores['data']; $newIds = array_values(array_column($stores['data'], 'id')); - $ids = array_merge($ids,$newIds); + $ids = array_merge($newIds,$ids); $ids = implode(',',$ids); return ['has_more_pages' => $paginate->hasMorePages(), 'market' => $market,'ids' => $ids]; } diff --git a/app/Service/v3/Interfaces/StoreServiceInterface.php b/app/Service/v3/Interfaces/StoreServiceInterface.php index 35b7de5..c9ed1ea 100644 --- a/app/Service/v3/Interfaces/StoreServiceInterface.php +++ b/app/Service/v3/Interfaces/StoreServiceInterface.php @@ -8,7 +8,7 @@ interface StoreServiceInterface public function check($storeId); public function undo(); public function detail($storeId); - public function getList($marketId ,$ids,$page=1, $pagesize=10); + public function getList($marketId ,$ids = [],$page=1, $pagesize=10); public function getListByMarketId($marketId ,$page=1, $pagesize=10); public function updateIsRest($storeId); } \ No newline at end of file