1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace app\Admin\controller;
- use think\Db;
- class Base
- {
- public $post="";
- public $userinfo="";
- public function __construct()
- {
- if(request()->isOptions()){
- echo '';
- die();
- }
- $post=request()->post();
- $token = isset($post['token']) && $post['token']!=""?$post['token']:"";
- if($token==""){
- return error_show(104,"参数token 不能为空");
- }
- $verify = verifyToken($token);
- if($verify['code']!=0){
- return error_show($verify['code'],$verify['msg']);
- }
- $tokeninfo = Db::name("admin_token")->where(["token"=>$token])->find();
- if(!isset($tokeninfo['adminid'])){
- return error_show(1004,"未找到账户id");
- }
- $userinfo = Db::name("admin")->where(["id"=>$tokeninfo['adminid']])->find();
- if(empty($userinfo)){
- return error_show(1004,"未找到账户数据");
- }
- $this->userinfo=$userinfo;
- $this->post=$post;
- }
- }
|