Browse Source

更新店铺休息状态

master
Lemon 5 years ago
parent
commit
8dd6905a19
  1. 7
      app/Controller/v3/StoreController.php
  2. 8
      app/Service/v3/Implementations/StoreService.php
  3. 1
      app/Service/v3/Interfaces/StoreServiceInterface.php
  4. 1
      config/routes.php

7
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);
}
}

8
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();
}
}

1
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);
}

1
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]]);
// 微信支付回调

Loading…
Cancel
Save