解决api接口bug
设置token过期时间为24小时
This commit is contained in:
@@ -8,7 +8,20 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\api;
|
||||
|
||||
use think\App;
|
||||
|
||||
class Base {
|
||||
/**
|
||||
* Request实例
|
||||
* @var \think\Request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* 应用实例
|
||||
* @var \think\App
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
public $middleware = [
|
||||
'\app\http\middleware\Validate',
|
||||
@@ -20,20 +33,27 @@ class Base {
|
||||
|
||||
protected $data = ['data' => [], 'code' => 0, 'msg' => ''];
|
||||
|
||||
protected function initialize() {
|
||||
/**
|
||||
* 构造方法
|
||||
* @access public
|
||||
* @param App $app 应用对象
|
||||
*/
|
||||
public function __construct(App $app) {
|
||||
$this->app = $app;
|
||||
$this->request = $this->app->request;
|
||||
}
|
||||
|
||||
protected function success($msg, $url = '') {
|
||||
$this->data['code'] = 1;
|
||||
$this->data['msg'] = $msg;
|
||||
$this->data['url'] = $url ? $url->__toString() : '';
|
||||
$this->data['msg'] = $msg;
|
||||
$this->data['url'] = $url ? $url->__toString() : '';
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
protected function error($msg, $url = '') {
|
||||
$this->data['code'] = 0;
|
||||
$this->data['msg'] = $msg;
|
||||
$this->data['url'] = $url ? $url->__toString() : '';
|
||||
$this->data['msg'] = $msg;
|
||||
$this->data['url'] = $url ? $url->__toString() : '';
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user