diff --git a/library/traits/think/controller/ajax.php b/library/traits/controller/ajax.php similarity index 92% rename from library/traits/think/controller/ajax.php rename to library/traits/controller/ajax.php index 8aed19e2..586e34c1 100644 --- a/library/traits/think/controller/ajax.php +++ b/library/traits/controller/ajax.php @@ -1,17 +1,17 @@ -result(); * } * } */ -namespace traits\think\controller; -use think\Config; +namespace traits\controller; trait Ajax { @@ -64,4 +64,4 @@ trait Ajax return $this->result('', $message, 1, $jumpUrl, $wait); } -} \ No newline at end of file +} diff --git a/library/traits/think/controller/view.php b/library/traits/controller/view.php similarity index 91% rename from library/traits/think/controller/view.php rename to library/traits/controller/view.php index a0910d6d..6b10e0a9 100644 --- a/library/traits/think/controller/view.php +++ b/library/traits/controller/view.php @@ -1,23 +1,25 @@ -assign(); * $this->show(); * } * } */ -namespace traits\think\controller; +namespace traits\controller; + use think\Config; trait View { // 视图类实例 - protected $view = null; + protected $view = null; /** * 架构函数 初始化视图类 并采用内置模板引擎 @@ -26,8 +28,8 @@ trait View public function initView() { // 模板引擎参数 - if(is_null($this->view)){ - $this->view = new \think\View(Config::get()); // 只能这样写,不然view会冲突 + if (is_null($this->view)) { + $this->view = new \think\View(Config::get()); // 只能这样写,不然view会冲突 } } @@ -125,4 +127,4 @@ trait View return $this->result('', $message, 1, $jumpUrl, $wait); } -} \ No newline at end of file +} diff --git a/library/traits/think/model/adv.php b/library/traits/model/adv.php similarity index 99% rename from library/traits/think/model/adv.php rename to library/traits/model/adv.php index 3c991557..a15e4e75 100644 --- a/library/traits/think/model/adv.php +++ b/library/traits/model/adv.php @@ -9,7 +9,7 @@ // | Author: liu21st // +---------------------------------------------------------------------- -namespace traits\think\model; +namespace traits\model; use think\Lang; use think\Loader; diff --git a/library/traits/think/model/auto.php b/library/traits/model/auto.php similarity index 99% rename from library/traits/think/model/auto.php rename to library/traits/model/auto.php index 617e55c1..81d025d9 100644 --- a/library/traits/think/model/auto.php +++ b/library/traits/model/auto.php @@ -9,7 +9,7 @@ // | Author: liu21st // +---------------------------------------------------------------------- -namespace traits\think\model; +namespace traits\model; define('EXISTS_VALIDATE', 0); define('MUST_VALIDATE', 1); @@ -62,8 +62,8 @@ trait Auto $fields = explode(',', $fields); } // 判断令牌验证字段 - if (C('TOKEN_ON')) { - $fields[] = C('TOKEN_NAME'); + if (Config::get('token_on')) { + $fields[] = Config::get('token_name'); } foreach ($data as $key => $val) { diff --git a/library/traits/think/model/query.php b/library/traits/model/query.php similarity index 98% rename from library/traits/think/model/query.php rename to library/traits/model/query.php index 9c9601c7..c4784262 100644 --- a/library/traits/think/model/query.php +++ b/library/traits/model/query.php @@ -9,7 +9,7 @@ // | Author: liu21st // +---------------------------------------------------------------------- -namespace traits\think\model; +namespace traits\model; trait Query { diff --git a/library/traits/think/model/relation.php b/library/traits/model/relation.php similarity index 99% rename from library/traits/think/model/relation.php rename to library/traits/model/relation.php index 2c1dc527..0c9ee72d 100644 --- a/library/traits/think/model/relation.php +++ b/library/traits/model/relation.php @@ -9,7 +9,7 @@ // | Author: liu21st // +---------------------------------------------------------------------- -namespace traits\think\model; +namespace traits\model; define('HAS_ONE', 1); define('BELONGS_TO', 2); @@ -288,7 +288,7 @@ trait Relation $pk = $model->getPk(); foreach ($mappingData as $vo) { if (isset($vo[$pk])) { -// 更新数据 + // 更新数据 $mappingCondition = "$pk ={$vo[$pk]}"; $result = $model->where($mappingCondition)->save($vo); } else { diff --git a/library/traits/think/model/view.php b/library/traits/model/view.php similarity index 99% rename from library/traits/think/model/view.php rename to library/traits/model/view.php index 6607b9a8..797cc954 100644 --- a/library/traits/think/model/view.php +++ b/library/traits/model/view.php @@ -9,7 +9,7 @@ // | Author: liu21st // +---------------------------------------------------------------------- -namespace traits\think\model; +namespace traits\model; trait View { @@ -92,7 +92,7 @@ trait View private function _checkFields($name, $fields) { if (false !== $pos = array_search('*', $fields)) { -// 定义所有字段 + // 定义所有字段 $fields = array_merge($fields, M($name)->getDbFields()); unset($fields[$pos]); }