diff --git a/app/Controller/v3/StoreController.php b/app/Controller/v3/StoreController.php index 11edf2d..7e21afd 100644 --- a/app/Controller/v3/StoreController.php +++ b/app/Controller/v3/StoreController.php @@ -132,4 +132,11 @@ class StoreController extends BaseController $res = $this->storeService->getListByMarketId($marketId,$page,$pagesize); return $this->success($res); } + + public function updateIsRest() + { + $storeId = $this->request->input('store_id'); + $res = $this->storeService->updateIsRest($storeId); + return $this->success($res); + } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/StoreService.php b/app/Service/v3/Implementations/StoreService.php index ffec425..ed131dd 100644 --- a/app/Service/v3/Implementations/StoreService.php +++ b/app/Service/v3/Implementations/StoreService.php @@ -103,4 +103,12 @@ class StoreService implements StoreServiceInterface return ['has_more_pages' => $paginate->hasMorePages(), 'stores' => $stores]; } + + public function updateIsRest($storeId) + { + $store = Store::query()->withoutGlobalScope('normal')->find($storeId); + $isRest = $store->is_rest + 1; + $store->is_rest = $isRest % 2; + return $store->save(); + } } \ No newline at end of file diff --git a/app/Service/v3/Interfaces/StoreServiceInterface.php b/app/Service/v3/Interfaces/StoreServiceInterface.php index 4b03641..e8c79cd 100644 --- a/app/Service/v3/Interfaces/StoreServiceInterface.php +++ b/app/Service/v3/Interfaces/StoreServiceInterface.php @@ -10,4 +10,5 @@ interface StoreServiceInterface public function detail($storeId); public function getList($marketId ,$page=1, $pagesize=10); public function getListByMarketId($marketId ,$page=1, $pagesize=10); + public function updateIsRest($storeId); } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index 66697cc..53455dc 100644 --- a/config/routes.php +++ b/config/routes.php @@ -164,6 +164,7 @@ Router::addGroup('/v3/', function () { Router::post('category/third', 'App\Controller\v3\CategoryController@third'); Router::post('goods/create', 'App\Controller\v3\GoodsController@create'); Router::post('goods/updateOnSale', 'App\Controller\v3\GoodsController@updateOnSale'); + Router::post('store/updateIsRest', 'App\Controller\v3\StoreController@updateIsRest'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class, \App\Middleware\Auth\UserMiddleware::class]]); // 微信支付回调