diff --git a/app/BaseController.php b/app/BaseController.php index c6b98c28..bf62275a 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -6,11 +6,8 @@ namespace app; use think\App; use think\exception\ValidateException; use think\Validate; -use app\middleware\UserLogin; -use app\middleware\Auth; use app\middleware\Online; - /** * 控制器基础类 */ @@ -40,8 +37,7 @@ abstract class BaseController * @var array */ protected $middleware = [ - 'login' - ,'auth' + 'online' ]; /** diff --git a/app/admin/validate/RuleGroup.php b/app/admin/validate/RuleGroup.php new file mode 100644 index 00000000..dafd4067 --- /dev/null +++ b/app/admin/validate/RuleGroup.php @@ -0,0 +1,28 @@ + ['规则1','规则2'...] + * + * @var array + */ + protected $rule = [ + 'title|规则名' => 'require|chs|length:2,100', + 'rules|规则' => 'require|length:1,10000', + 'miaoshu|排序' => 'require|length:2,180', + ]; + + /** + * 定义错误信息 + * 格式:'字段名.规则名' => '错误信息' + * + * @var array + */ + protected $message = []; +} diff --git a/app/base/controller/ToolsBase.php b/app/base/controller/AdminBase.php similarity index 76% rename from app/base/controller/ToolsBase.php rename to app/base/controller/AdminBase.php index 0faca213..da5e4fe3 100644 --- a/app/base/controller/ToolsBase.php +++ b/app/base/controller/AdminBase.php @@ -7,13 +7,13 @@ use app\BaseController; /** * 控制器基础类 */ -abstract class ToolsBase extends BaseController +abstract class AdminBase extends BaseController { /** * 控制器中间件 * @var array */ protected $middleware = [ - 'online' + 'login' ]; } diff --git a/app/common.php b/app/common.php index 937aa3f2..f6a3f864 100644 --- a/app/common.php +++ b/app/common.php @@ -122,7 +122,7 @@ function array_cover($cover = array(), $covered = array()) { $tools = new \app\tools\controller\Index; - $arr = $tools->($cover, $covered); + $arr = $tools->array_cover($cover, $covered); return $arr; } diff --git a/app/kaoshi/model/Kaoshi.php b/app/kaoshi/model/Kaoshi.php index 3f368813..08880778 100644 --- a/app/kaoshi/model/Kaoshi.php +++ b/app/kaoshi/model/Kaoshi.php @@ -3,10 +3,10 @@ namespace app\kaoshi\model; // 引用数据模型基类 -use \app\kaoshi\model\KaoshiBase; +use \app\BaseModel; -class Kaoshi extends KaoshiBase +class Kaoshi extends BaseModel { // 查询所有考试 public function search($srcfrom) diff --git a/app/kaoshi/model/KaoshiBase.php b/app/kaoshi/model/KaoshiBase.php deleted file mode 100644 index 5c47dcf2..00000000 --- a/app/kaoshi/model/KaoshiBase.php +++ /dev/null @@ -1,19 +0,0 @@ -isAjax(); if ($category != 'admin') diff --git a/app/system/controller/Category.php b/app/system/controller/Category.php index b2aff0f8..ecc7dfa6 100644 --- a/app/system/controller/Category.php +++ b/app/system/controller/Category.php @@ -3,14 +3,12 @@ namespace app\system\controller; // 引用控制器基类 -use app\BaseController; +use app\base\controller\AdminBase; // 引用类别数据模型类 use app\system\model\Category as CG; -class Category extends BaseController +class Category extends AdminBase { - - // 类别列表 public function index() { diff --git a/app/system/controller/Fields.php b/app/system/controller/Fields.php index f7762ed0..e0760ee9 100644 --- a/app/system/controller/Fields.php +++ b/app/system/controller/Fields.php @@ -3,11 +3,11 @@ namespace app\system\controller; // 引用控制器基类 -use app\BaseController; +use app\base\controller\AdminBase; // 引用单位数据模型类 use app\system\model\Fields as FL; -class Fields extends BaseController +class Fields extends AdminBase { /** * 显示资源列表 diff --git a/app/system/controller/School.php b/app/system/controller/School.php index f2e6d63e..0f6c049d 100644 --- a/app/system/controller/School.php +++ b/app/system/controller/School.php @@ -3,11 +3,11 @@ namespace app\system\controller; // 引用控制器基类 -use app\BaseController; +use app\base\controller\AdminBase; // 引用单位数据模型类 use app\system\model\School as sch; -class School extends BaseController +class School extends AdminBase { // 单位列表 public function index() diff --git a/app/system/controller/SystemBase.php b/app/system/controller/SystemBase.php index faa025b8..232003b1 100644 --- a/app/system/controller/SystemBase.php +++ b/app/system/controller/SystemBase.php @@ -3,12 +3,12 @@ namespace app\system\controller; // 引用控制器基类 -use app\BaseController; +use app\base\controller\AdminBase; // 引用与此控制器同名的数据模型 use app\system\model\SystemBase as sysbasemod; -class SystemBase extends BaseController +class SystemBase extends AdminBase { // 系统设置 public function edit() diff --git a/app/system/view/fields/index.html b/app/system/view/fields/index.html index 02ba27b7..6e283b86 100644 --- a/app/system/view/fields/index.html +++ b/app/system/view/fields/index.html @@ -61,7 +61,7 @@ } return str; }}, - {field: 'userid', title: '上传人', minWidth:150,sort: true,templet:function(d){ + {field: 'user_id', title: '上传人', minWidth:150,sort: true,templet:function(d){ var str=''; if(d.flUser) { diff --git a/app/tools/controller/Index.php b/app/tools/controller/Index.php index 9c28b4a0..4ccd03cd 100644 --- a/app/tools/controller/Index.php +++ b/app/tools/controller/Index.php @@ -3,9 +3,7 @@ declare (strict_types = 1); namespace app\tools\controller; -use \app\base\controller\ToolsBase - -class Index extends ToolsBase +class Index { // // 将关联学生成绩转换成以学科列名为key得分为value的数组 // public function subjectChengjiKeyAndValue($array = array()) @@ -113,7 +111,7 @@ class Index extends ToolsBase $obj = $obj->order($src['field'], $src['order']); $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; + $limit_length = $src['limit'] * 1; $obj = $obj->slice($limit_start, $limit_length); $data = [ 'code' => 0 // ajax请求次数,作为标识符 diff --git a/app/tools/middleware.php b/app/tools/middleware.php index 49ebf797..a6dbc6fb 100644 --- a/app/tools/middleware.php +++ b/app/tools/middleware.php @@ -1,5 +1,5 @@