12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace app\Home\controller;
- use think\Db;
- class Base
- {
- public $post="";
- public $userinfo="";
- public function __construct()
- {
- $this->post=request()->post();
- $token = isset($this->post['token'])&&$this->post['token']!="" ? trim($this->post['token']):"";
- if($token==""){
- return error_show(102,"token不能为空");
- }
- $verify = verifyToken($token);
- if($verify['code']!=0){
- return error_show($verify['code'],$verify['msg']);
- }
- $tokeninfo = Db::name("account_token")->where(["token"=>$token])->find();
- if(!isset($tokeninfo['accountid'])){
- return error_show(1004,"未找到账户id");
- }
- $userinfo = Db::name("account_list")->where(["id"=>$tokeninfo['accountid']])->field("id,username,status,starttime,expiretime,activetime,addtime,nickname,avatar,mobile,remark")->find();
- if(empty($userinfo)){
- return error_show(1004,"未找到账户数据");
- }
- $this->userinfo=$userinfo;
- }
- }
|