// +---------------------------------------------------------------------- declare (strict_types=1); namespace crmeb\basic; use think\facade\App; /** * 控制器基础类 */ abstract class BaseController { /** * Request实例 * @var \app\Request */ protected $request; /** * 应用实例 * @var \think\App */ protected $app; /** * 控制器中间件 * @var array */ protected $middleware = []; /** * @var */ protected $services; /** * 需要授权的接口地址 * @var string[] */ private $authRule = []; /** * 构造方法 * @access public * @param App $app 应用对象 */ public function __construct($app = '') { $this->app = $app?:app(); $this->request = app('request'); $this->initialize(); } /** * @return mixed */ protected function initialize(){} /*** * 获取页码 * @return array */ public function getPage() { $page = $this->request->param('page',1); $limit = $this->request->param('limit',20); return [ $page, $limit ]; } public function auth(){ return app('json')->success(['day'=>9999,'status'=>1]); } }