Base.php 699 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\admin\controller;
  3. use think\App;
  4. class Base extends \app\BaseController
  5. {
  6. public $post=[];
  7. public $uid='';
  8. public function __construct(App $app)
  9. {
  10. parent::__construct($app);
  11. $this->post =$this->request->post();
  12. $this->validateToken();
  13. }
  14. public function validateToken()
  15. {
  16. $token = isset($this->post['token']) ? trim($this->post['token']) : "";
  17. if($token==""){
  18. return error_show(101,'token不能为空');
  19. }
  20. $effetc = VerifyTokens($token);
  21. if(!empty($effetc) && $effetc['code']!=0) {
  22. return error_show($effetc['code'], $effetc['message']);
  23. }
  24. }
  25. }