diff --git a/application/admin/view/home/media_matrix/add.html b/application/admin/view/home/media_matrix/add.html
index 5202666..6423f26 100644
--- a/application/admin/view/home/media_matrix/add.html
+++ b/application/admin/view/home/media_matrix/add.html
@@ -3,7 +3,7 @@
diff --git a/application/admin/view/home/media_matrix/edit.html b/application/admin/view/home/media_matrix/edit.html
index 6c3090d..ff7bc5f 100644
--- a/application/admin/view/home/media_matrix/edit.html
+++ b/application/admin/view/home/media_matrix/edit.html
@@ -3,7 +3,7 @@
diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php
index 27e3332..6655e8c 100644
--- a/application/api/controller/Index.php
+++ b/application/api/controller/Index.php
@@ -22,6 +22,7 @@ class Index extends Base
* @ApiMethod(GET)
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
+ * @ApiParams(name = "status", type = "string",required=true,description = "放置类型:1=顶部,2=服务青年专栏")
* @ApiReturn({
*
*})
@@ -31,14 +32,15 @@ class Index extends Base
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
-
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
+ $params=[];
+ $page = $this->request->get('page/d', 0); //页数
+ $limit = $this->request->get('limit/d', 0); //条数
+ $params["status"] = $this->request->get('status/s', ""); //条数
try{
//当前申请状态
- $res = Images::allList($page, $limit);
+ $res = Images::allList($page, $limit,$params);
}catch (\Exception $e){
diff --git a/application/api/controller/home/Encyclopedia.php b/application/api/controller/home/Encyclopedia.php
index 5321e07..b5033d1 100644
--- a/application/api/controller/home/Encyclopedia.php
+++ b/application/api/controller/home/Encyclopedia.php
@@ -5,7 +5,7 @@ namespace app\api\controller\home;
use app\common\model\home\Encyclopedia as EncyclopediaModel;
use app\common\model\home\News as NewsModel;
-use app\common\model\home\NewsCate;
+use app\common\model\home\EncyclopediaCate;
/**
* 团务百科接口
@@ -30,6 +30,44 @@ class Encyclopedia extends Base
+
+ /**
+ * @ApiTitle( 团务百科分类)
+ * @ApiSummary(团务百科分类)
+ * @ApiMethod(GET)
+ * @ApiParams(name = "page", type = "string",required=true,description = "页数")
+ * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
+ * @ApiParams(name = "flag", type = "string",required=false,description = "分类标识")
+ * @ApiReturn({
+ *
+ *})
+ */
+ public function cate()
+ {
+ $user_id = 0;
+ $user = $this->auth->getUser();//登录用户
+ if($user)$user_id = $user['id'];
+ $params=[];
+ $page = $this->request->param('page/d', 0); //页数
+ $limit = $this->request->param('limit/d', 0); //条数
+
+ $params["flag"] = $this->request->param('flag/s', ''); //搜索关键字
+// $params["hot"] = $this->request->param('hot/s', ''); //搜索关键字
+// $params["home"] = $this->request->param('home/s', ''); //搜索关键字
+// $params["isnews"] = $this->request->param('isnews/s', ''); //搜索关键字
+
+ try{
+ //当前申请状态
+ $res = EncyclopediaCate::allList($page, $limit,$params);
+
+ }catch (\Exception $e){
+
+ $this->error($e->getMessage());
+ }
+ $this->success('查询成功', $res);
+ }
+
+
/**
* @ApiTitle( 团务百科文章列表)
* @ApiSummary(团务百科文章列表)
@@ -38,6 +76,7 @@ class Encyclopedia extends Base
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
* @ApiParams(name = "recommend", type = "string",required=false,description = "置顶:0=否,1=是")
+ * @ApiParams(name = "cate_id", type = "int",required=false,description = "团务百科类目id")
* @ApiReturn({
*
*})
diff --git a/application/api/controller/home/MediaMatrix.php b/application/api/controller/home/MediaMatrix.php
index 890d5b3..398d1c2 100644
--- a/application/api/controller/home/MediaMatrix.php
+++ b/application/api/controller/home/MediaMatrix.php
@@ -72,6 +72,7 @@ class MediaMatrix extends Base
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
+ * @ApiParams(name = "cate_id", type = "string",required=true,description = "分类id")
* @ApiReturn({
*
*})
diff --git a/application/common/model/home/EncyclopediaCate.php b/application/common/model/home/EncyclopediaCate.php
new file mode 100644
index 0000000..ab35abe
--- /dev/null
+++ b/application/common/model/home/EncyclopediaCate.php
@@ -0,0 +1,151 @@
+getPk();
+ $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+ }
+ });
+ }
+
+
+ public function getStatusList()
+ {
+ return ['1' => __('Status 1'), '2' => __('Status 2')];
+ }
+
+
+ public function getStatusTextAttr($value, $data)
+ {
+ $value = $value ?: ($data['status'] ?? '');
+ $list = $this->getStatusList();
+ return $list[$value] ?? '';
+ }
+
+ public function getImageAttr($value, $data)
+ {
+ if (!empty($value)) return cdnurl($value, true);
+ }
+
+
+
+
+ /**得到基础条件
+ * @param $status
+ * @param null $model
+ * @param string $alisa
+ */
+ public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false)
+ {
+
+ if (!$model) {
+ $model = new static;
+ if ($alisa&&!$with) $model = $model->alias($alisa);
+ }
+ if ($alisa) $alisa = $alisa . '.';
+ $tableFields = (new static)->getTableFields();
+ foreach ($tableFields as $fields)
+ {
+// if(in_array($fields, ["hot","home"]))continue;
+// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
+
+ if (isset($whereData[$fields]) && $whereData[$fields]){
+ if(is_array($whereData[$fields])){
+ $model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]);
+ }else{
+ $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
+ }
+
+ }
+
+
+ }
+
+// if (isset($whereData['hot']) && $whereData['hot']!=="" && $whereData['hot']!==null){
+// $model = $model->where("{$alisa}hot", 'in', $whereData['hot'] );
+// }
+//
+// if (isset($whereData['home']) && $whereData['home']!=="" && $whereData['home']!==null){
+// $model = $model->where("{$alisa}home", 'in', $whereData['home'] );
+// }
+
+
+
+
+ if (isset($whereData['keywords'])&&$whereData['keywords']){
+ $model = $model->where("{$alisa}name|{$alisa}flag", 'LIKE', "%{$whereData['keywords']}%" );
+ }
+
+
+
+ if (isset($whereData['time'])&&$whereData['time']){
+
+ $model = $model->time(["{$alisa}createtime",$whereData['time']]);
+ }
+
+// if (isset($whereData['has_evaluate'])&&$whereData['has_evaluate']){
+// //1查已评价 2查未评价
+// if($whereData['has_evaluate'] == 1){
+// //1查已评价
+// $model = $model->where("{$alisa}classes_evaluate_id", '<>', 0);
+// }else{
+// //2查未评价
+// $model = $model->whereExists(function ($query) use ($alisa) {
+// $order_table_name = (new \app\common\model\school\classes\hourorder\Order())->getQuery()->getTable();
+// $query->table($order_table_name)->where($order_table_name . '.classes_order_id=' . $alisa . 'id')->where('status', '=', '3');
+// })->where("{$alisa}classes_evaluate_id", '=', 0);
+//
+// }
+// }
+
+ return $model;
+ }
+
+
+
+
+
+ public static function allList($page, $limit,$params=[]){
+
+
+ $sort = "weigh desc,id desc";
+// if(!empty($params['status'])){
+// $params['status'] = '1';
+// }
+ return (new self)->getBaseList($params, $page, $limit,$sort);
+ }
+
+
+}
diff --git a/public/assets/js/backend/home/encyclopedia.js b/public/assets/js/backend/home/encyclopedia.js
index c53edeb..13b6ae8 100644
--- a/public/assets/js/backend/home/encyclopedia.js
+++ b/public/assets/js/backend/home/encyclopedia.js
@@ -28,6 +28,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[
{checkbox: true},
{field: 'id', title: __('Id')},
+ {field: 'cate_id', title: __('Cate_id')},
+ {field: 'cate.name', title: __('Cate.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'subtitle', title: __('Subtitle'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
diff --git a/public/assets/js/backend/home/encyclopedia_cate.js b/public/assets/js/backend/home/encyclopedia_cate.js
new file mode 100644
index 0000000..1afda2e
--- /dev/null
+++ b/public/assets/js/backend/home/encyclopedia_cate.js
@@ -0,0 +1,118 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+ var Controller = {
+ index: function () {
+ // 初始化表格参数配置
+ Table.api.init({
+ extend: {
+ index_url: 'home/encyclopedia_cate/index' + location.search,
+ add_url: 'home/encyclopedia_cate/add',
+ edit_url: 'home/encyclopedia_cate/edit',
+ del_url: 'home/encyclopedia_cate/del',
+ multi_url: 'home/encyclopedia_cate/multi',
+ import_url: 'home/encyclopedia_cate/import',
+ table: 'encyclopedia_cate',
+ }
+ });
+
+ var table = $("#table");
+
+ // 初始化表格
+ table.bootstrapTable({
+ url: $.fn.bootstrapTable.defaults.extend.index_url,
+ pk: 'id',
+ sortName: 'weigh',
+ columns: [
+ [
+ {checkbox: true},
+ {field: 'id', title: __('Id')},
+ {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+ {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+ {field: 'flag', title: __('Flag'), operate: 'LIKE', formatter: Table.api.formatter.flag},
+ {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
+ {field: 'weigh', title: __('Weigh'), operate: false},
+ {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+ ]
+ ]
+ });
+
+ // 为表格绑定事件
+ Table.api.bindevent(table);
+ },
+ recyclebin: function () {
+ // 初始化表格参数配置
+ Table.api.init({
+ extend: {
+ 'dragsort_url': ''
+ }
+ });
+
+ var table = $("#table");
+
+ // 初始化表格
+ table.bootstrapTable({
+ url: 'home/encyclopedia_cate/recyclebin' + location.search,
+ pk: 'id',
+ sortName: 'id',
+ columns: [
+ [
+ {checkbox: true},
+ {field: 'id', title: __('Id')},
+ {field: 'name', title: __('Name'), align: 'left'},
+ {
+ field: 'deletetime',
+ title: __('Deletetime'),
+ operate: 'RANGE',
+ addclass: 'datetimerange',
+ formatter: Table.api.formatter.datetime
+ },
+ {
+ field: 'operate',
+ width: '140px',
+ title: __('Operate'),
+ table: table,
+ events: Table.api.events.operate,
+ buttons: [
+ {
+ name: 'Restore',
+ text: __('Restore'),
+ classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
+ icon: 'fa fa-rotate-left',
+ url: 'home/encyclopedia_cate/restore',
+ refresh: true
+ },
+ {
+ name: 'Destroy',
+ text: __('Destroy'),
+ classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
+ icon: 'fa fa-times',
+ url: 'home/encyclopedia_cate/destroy',
+ refresh: true
+ }
+ ],
+ formatter: Table.api.formatter.operate
+ }
+ ]
+ ]
+ });
+
+ // 为表格绑定事件
+ Table.api.bindevent(table);
+ },
+
+ add: function () {
+ Controller.api.bindevent();
+ },
+ edit: function () {
+ Controller.api.bindevent();
+ },
+ api: {
+ bindevent: function () {
+ Form.api.bindevent($("form[role=form]"));
+ }
+ }
+ };
+ return Controller;
+});
diff --git a/public/assets/js/backend/home/images.js b/public/assets/js/backend/home/images.js
index d5637d5..98d5ecd 100644
--- a/public/assets/js/backend/home/images.js
+++ b/public/assets/js/backend/home/images.js
@@ -63,7 +63,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
}},
+ {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'type', title: __('Type'), searchList: {"in":__('Type in'),"out":__('Type out')}, formatter: Table.api.formatter.normal},
+
{field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},