Base.php 724 B

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