diff --git a/app/controller/api/dataview/Login.php b/app/controller/api/dataview/Login.php index b010fcea..a33cd145 100644 --- a/app/controller/api/dataview/Login.php +++ b/app/controller/api/dataview/Login.php @@ -5,29 +5,20 @@ use app\common\repositories\user\UserRepository; use crmeb\basic\BaseController; use think\App; +use think\facade\Cache; use think\facade\Db; use think\exception\ValidateException; class Login extends BaseController { - /** - * @var repository - */ - protected $repository; - - public $areaCode; // 区县地区码 - - public $streetCode; // 镇街道地区码 - - public function __construct(App $app) { parent::__construct($app); } - public function login(UserRepository $repository) + public function login() { $account = $this->request->post('account', ''); $password = $this->request->post('password', ''); @@ -47,6 +38,8 @@ class Login extends BaseController $expire = time()+ 3600 * 24; $token = md5($expire); + // 缓存token + Cache::set($token.'_'.$user['uid'], $expire); return app('json')->success(compact('user','token', 'expire')); }