12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * Created by PhpStorm.
- * User: yckj_lzj
- * Date: 2020-05-21
- * Time: 11:45
- */
- namespace app\index\controller;
- use app\index\ErrorCode;
- use think\exception\HttpResponseException;
- use think\exception\ValidateException;
- use think\facade\Log;
- use think\Response;
- /**
- * 控制器基类,所有控制器要继承
- * Class Base
- * @package app\index\controller
- */
- class Base extends \app\common\controller\Base
- {
- private $apikey = "32a1ff74699ff2d6ce4c497cb94cb5c8";//密钥
- /**
- * 构造函数
- * Base constructor.
- */
- public function __construct()
- {
- parent::__construct();//继承父类构造函数
- $this->checkSignOpen=true;
- if ($this->checkSignOpen) {
- $checkRes=$this->checkApiSign();
- if($checkRes['code']!==0){
- //如果签名校验未通过
- $msg=$checkRes['msg']?$checkRes['msg']:ErrorCode::getError($checkRes['code']);
- $this->error($checkRes['code'],$msg);
- }
- }
- }
- }
|