| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\index\controller;
- use think\Controller;
- /**
- * 分组类
- */
- class Common extends Controller
- {
- /**
- * 构造函数
- *
- * @access public
- * @return array JsonString
- */
- public function __construct()
- {
- $request = \think\Request::instance();
- $getApiToken = input('server.HTTP_apiToken');
- $action = $request->action();
- $controller = $request->controller();
- $module = $request->module();
- $apiToken = md5($action.'Customer-Service'.$controller.strtotime(date('Y-m-d')).$module);
- if ($getApiToken !== $apiToken) {
- $code = -2;
- $msg = 'token错误';
- return json(['code' => $code, 'data' => [], 'msg' => $msg]);
- }
- }//end __construct()
- }
|