12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace app\api\controller\energy;
- use app\hander\HelpHander;
- use think\Controller;
- use think\Db;
- class Base extends Controller
- {
- protected $userId;
- protected $orgId;
- protected function initialize()
- {
- parent::initialize();
- $token = think_decrypt(input('token','','trim'));
- if(!$token){
- HelpHander::error('token不正确');
- }
- $tdata = json_decode($token,true);
- if(!$tdata || !isset($tdata['userId']) || !isset($tdata['orgId'])){
- HelpHander::error('token不正确');
- }
- $this->userId = $tdata['userId'];
- $this->orgId = $tdata['orgId'];
- }
- }
|