1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\Home\controller;
- use think\Db;
- class Base
- {
- public $post="";
- public $userinfo="";
- public function __construct()
- {
- if(request()->isOptions()){
- echo '';
- die();
- }
- $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")->alias('a')->where(["a.id"=>$tokeninfo['accountid'],'a.is_del'=>0])
- ->join("fc_rela_account b", "a.id = b.accountid", "left")
- ->join("fc_account_info c", "b.account_info= c.id", "left")
- ->field("`a`.`id` AS `id`,
- `a`.`username` AS `username`,
- `a`.`account_type` AS `type`,
- `a`.`status` AS `status`,
- `a`.`is_del` AS `is_del`,
- `a`.`starttime` AS `starttime`,
- `a`.`expiretime` AS `expiretime`,
- `a`.`activetime` AS `activetime`,
- `a`.`addtime` AS `addtime`,
- `c`.`nickname` AS `nickname`,
- `c`.`avatar` AS `avatar`,
- `c`.`mobile` AS `mobile`,
- `c`.`remark` AS `remark`,
- `c`.`sex` AS `sex`")
- ->find();
- if(empty($userinfo)){
- return error_show(1004,"未找到账户数据");
- }
- $this->userinfo=$userinfo;
- }
- }
|