优化项目目录结构
This commit is contained in:
@@ -8,12 +8,10 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\api;
|
||||
|
||||
use app\controller\Api as ApiBase;
|
||||
|
||||
/**
|
||||
* @title 接口功能
|
||||
*/
|
||||
class Api extends ApiBase {
|
||||
class Api extends Base {
|
||||
|
||||
public $filter_method = ['__construct'];
|
||||
|
||||
|
||||
39
app/controller/api/Base.php
Normal file
39
app/controller/api/Base.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\api;
|
||||
|
||||
class Base {
|
||||
|
||||
public $middleware = [
|
||||
'\app\http\middleware\Validate',
|
||||
// 'sent\jwt\middleware\JWTAuth' => ['except' => ['login']],
|
||||
'\app\http\middleware\ApiAuth',
|
||||
'\app\http\middleware\Api',
|
||||
// '\app\http\middleware\AllowCrossDomain',
|
||||
];
|
||||
|
||||
protected $data = ['data' => [], 'code' => 0, 'msg' => ''];
|
||||
|
||||
protected function initialize() {
|
||||
}
|
||||
|
||||
protected function success($msg, $url = '') {
|
||||
$this->data['code'] = 1;
|
||||
$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() : '';
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,12 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\api;
|
||||
|
||||
use app\controller\Api;
|
||||
use app\model\Config as ConfigM;
|
||||
|
||||
/**
|
||||
* @title 基础功能
|
||||
*/
|
||||
class Config extends Api {
|
||||
class Config extends Base {
|
||||
|
||||
/**
|
||||
* @title 配置数据
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\api;
|
||||
|
||||
use app\controller\Api;
|
||||
use app\model\Department as DepartmentM;
|
||||
use app\model\Role;
|
||||
use sent\tree\Tree;
|
||||
@@ -16,7 +15,7 @@ use sent\tree\Tree;
|
||||
/**
|
||||
* @title 部门管理
|
||||
*/
|
||||
class Department extends Api {
|
||||
class Department extends Base {
|
||||
|
||||
/**
|
||||
* @title 部门列表
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\api;
|
||||
|
||||
use app\controller\Api;
|
||||
use app\model\Member;
|
||||
use app\model\MemberLog;
|
||||
use app\model\Role;
|
||||
@@ -18,7 +17,7 @@ use xin\helper\Str;
|
||||
/**
|
||||
* @title 用户管理
|
||||
*/
|
||||
class User extends Api {
|
||||
class User extends Base {
|
||||
|
||||
/**
|
||||
* @title 用户列表
|
||||
|
||||
Reference in New Issue
Block a user