From 18b54c46e1395602e7901b8e1d0a57a538dc6505 Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Sun, 26 Sep 2021 21:29:21 +0800 Subject: [PATCH] add-api-licheb-biz_status --- api/controllers/wxapp/licheb/User.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/api/controllers/wxapp/licheb/User.php b/api/controllers/wxapp/licheb/User.php index 6ab51187..eea818c9 100644 --- a/api/controllers/wxapp/licheb/User.php +++ b/api/controllers/wxapp/licheb/User.php @@ -52,6 +52,14 @@ class User extends Wxapp{ if(!$user['status']){ throw new Exception('该账号已停用', API_CODE_FAIL); } + //判断门店是否存在 + if($user['group_id']<4){ + $biz_id = intval($user['biz_id']); + $biz = $this->biz_model->get(['id'=>$biz_id,'status'=>1]); + if(!$biz){ + throw new Exception('门店不存在', API_CODE_FAIL); + } + } $session = $this->wx_session($code); //print_r($session); if(!$session['session_key']){ @@ -87,7 +95,12 @@ class User extends Wxapp{ $user = $this->app_user_model->get(array('id' => $uid)); //获取所属店铺字段 - $biz = $this->biz_model->get(['id'=>$biz_id],'biz_name'); + $biz = $this->biz_model->get(['id'=>$biz_id,'status'=>1],'biz_name'); + //判断门店是否存在 + if(!$biz){ + $this->logout(); + throw new Exception('门店不存在', API_CODE_FAIL); + } $group_arr = $this->app_user_model->get_group(); $group_name = $group_arr[$user['group_id']] ? $group_arr[$user['group_id']] : '';