diff --git a/common/models/Category.php b/common/models/Category.php index d9d6ddb..77ed1c0 100644 --- a/common/models/Category.php +++ b/common/models/Category.php @@ -66,6 +66,10 @@ class Category extends \yii\db\ActiveRecord ]; } + /** + * @return array + * 列格式 + */ public static function columns() { return [ diff --git a/common/models/CategorySearch.php b/common/models/CategorySearch.php index 63aab51..e49e616 100644 --- a/common/models/CategorySearch.php +++ b/common/models/CategorySearch.php @@ -12,7 +12,10 @@ use yii\helpers\ArrayHelper; */ class CategorySearch extends Category { - + /** + * @return array + * 增加创建时间查询字段 + */ public function attributes() { return ArrayHelper::merge(['created_at_range'], parent::attributes()); @@ -38,9 +41,13 @@ class CategorySearch extends Category return Model::scenarios(); } + /** + * @param $params + * @return ActiveDataProvider + * 不分页的所有数据 + */ public function allData($params) { - $query = Category::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, @@ -79,6 +86,12 @@ class CategorySearch extends Category return $this->filter($query, $dataProvider); } + /** + * @param $query + * @param $dataProvider + * @return ActiveDataProvider + * 条件筛选 + */ private function filter($query, $dataProvider) { diff --git a/kcadmin/controllers/CategoryController.php b/kcadmin/controllers/CategoryController.php index 5dea5bc..29d0dea 100644 --- a/kcadmin/controllers/CategoryController.php +++ b/kcadmin/controllers/CategoryController.php @@ -42,6 +42,10 @@ class CategoryController extends Controller ]; } + /** + * @author iron + * 文件导出 + */ public function actionExport() { $searchModel = new CategorySearch(); diff --git a/vendor/blobt/grid/GridView.php b/vendor/blobt/grid/GridView.php index ff0a507..b57b575 100644 --- a/vendor/blobt/grid/GridView.php +++ b/vendor/blobt/grid/GridView.php @@ -400,22 +400,22 @@ SCRIPT; protected function registerExportJs() { $js = <<