From 5bbf06488c9c12aad6a51896e0f8351499a66576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A8=84=E6=A2=A6=E5=AE=81?= Date: Sun, 21 Jan 2018 22:11:22 +0800 Subject: [PATCH] checkredis --- addons/unishop/controller/User.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) 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 {