user = $user->data(); $this->data['config'] = Dever::db('main/config')->one(1); $this->data['time'] = time(); $this->data['uid'] = -1; if ($this->user) { $this->data['uid'] = $this->user['id']; } } /** * 检测用户信息 * * @return mixed */ protected function checkUser($state = false) { if ($this->data['uid'] <= 0) { # 需要登录 $login = new Login(); $login->location(); } $where['uid'] = $this->data['uid']; # 获取用户积分 $this->data['user_score'] = Dever::db('task/user_score')->one($where); if (!$this->data['user_score']) { $this->data['user_score'] = array(); $this->data['user_score']['num'] = 0; $this->data['user_score']['uid'] = $where['uid']; $this->data['user_score']['id'] = Dever::db('task/user_score')->insert($this->data['user_score']); } # 检测用户是否认证 $this->data['user_info'] = Dever::db('task/user_info')->one($where); if ($this->data['user_info'] && $this->data['user_info']['status'] == 2) { # 已认证 return true; } else { if ($state == true) { # 未认证 code = 110 就是需要认证,需要跳转到认证页面 Dever::alert('资料认证通过后才能领取任务', 110); } return false; } } public function token($request) { return http_build_query(Dever::token($request)); } public function url($method, $request) { return Dever::proxy($method, $this->token($request)); } }