Browse Source

处理店铺为空情况

master
Lemon 5 years ago
parent
commit
f5c46a8209
  1. 7
      app/Controller/v3/StoreController.php

7
app/Controller/v3/StoreController.php

@ -2,6 +2,8 @@
namespace App\Controller\v3;
use App\Constants\v3\ErrorCode;
use App\Exception\ErrorCodeException;
use App\Controller\BaseController;
use App\Model\v3\ServicePersonnel;
use App\Request\v3\StoreIndexRequest;
@ -58,8 +60,11 @@ class StoreController extends BaseController
public function index(StoreIndexRequest $request)
{
$params = $this->request->all();
$data = $this->storeService->detail($params['store_id']);
if(empty($data)){
$msg = ['plat'=>'/v3/store/index/',"data"=>$params];
throw new ErrorCodeException(ErrorCode::STORE_NOT_AVAILABLE,'',$msg);
}
$data['is_collected'] = (bool)$this->collectService->check($params['user_id'],$params['store_id']);
$data['goods_types'] = $this->categoryService->allForStore($params['store_id']);
$data['in_business'] = $this->storeService->check($params['store_id']);

Loading…
Cancel
Save