diff --git a/addons/unishop/controller/User.php b/addons/unishop/controller/User.php index a4dbcd3..550e5bd 100644 --- a/addons/unishop/controller/User.php +++ b/addons/unishop/controller/User.php @@ -38,18 +38,32 @@ class User extends Base $ret = $this->auth->login($mobile, $password); if ($ret) { $data = $this->auth->getUserinfo(); - $ordinary_user_start=Config::getByName('ordinary_user_start')['value']; - $ordinary_user_end=Config::getByName('ordinary_user_end')['value']; - $ordinary_user_start=strtotime($ordinary_user_start); - $ordinary_user_end=strtotime($ordinary_user_end); - if (time()<$ordinary_user_end && time()>$ordinary_user_start){ + $privilege_user_list=Config::getByName('privilege_user_list')['value']; + $privilege_user_list=explode(",",$privilege_user_list); + if (!in_array($data['id'],$privilege_user_list)){ + //普通用户 //普通用户受限制时间 - $privilege_user_list=Config::getByName('privilege_user_list')['value']; - $privilege_user_list=explode(",",$privilege_user_list); - if (!in_array($data['id'],$privilege_user_list)){ - $this->success('It\'s not time to open', $data); + $ordinary_user_start=Config::getByName('ordinary_user_start')['value']; + $ordinary_user_end=Config::getByName('ordinary_user_end')['value']; + $ordinary_user_start=strtotime($ordinary_user_start); + $ordinary_user_end=strtotime($ordinary_user_end); + if (time()<$ordinary_user_end && time()>$ordinary_user_start){ + $this->auth->logout(); + $this->error('It\'s not time to open', $data); + } + }else{ + //特权用户 + $privilege_user_start=Config::getByName('privilege_user_start')['value']; + $privilege_user_end=Config::getByName('privilege_user_end')['value']; + $privilege_user_start=strtotime($privilege_user_start); + $privilege_user_end=strtotime($privilege_user_end); + if (time()<$privilege_user_end && time()>$privilege_user_start){ + $this->auth->logout(); + $this->error('It\'s not time to open', $data); } } + + $data['avatar'] = \addons\unishop\model\Config::getImagesFullUrl($data['avatar']); $this->success('Logged in successful', $data); } else {