diff --git a/application/admin/controller/home/AboutUs.php b/application/admin/controller/home/AboutUs.php new file mode 100644 index 0000000..493239d --- /dev/null +++ b/application/admin/controller/home/AboutUs.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\home\AboutUs; + $this->view->assign("statusList", $this->model->getStatusList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/controller/home/FriendshipLink.php b/application/admin/controller/home/FriendshipLink.php new file mode 100644 index 0000000..2bff91c --- /dev/null +++ b/application/admin/controller/home/FriendshipLink.php @@ -0,0 +1,38 @@ +model = new \app\admin\model\home\FriendshipLink; + $this->view->assign("statusList", $this->model->getStatusList()); + $this->view->assign("typeList", $this->model->getTypeList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/controller/home/Information.php b/application/admin/controller/home/Information.php index 085717d..0e5f147 100644 --- a/application/admin/controller/home/Information.php +++ b/application/admin/controller/home/Information.php @@ -36,4 +36,44 @@ class Information extends Backend */ + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + + $this->searchFields = ["id","title","subtitle","source","cate.name","cate.flag"]; + + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['cate']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('cate')->visible(['name']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + + + } diff --git a/application/admin/controller/home/InformationCate.php b/application/admin/controller/home/InformationCate.php new file mode 100644 index 0000000..9ac3644 --- /dev/null +++ b/application/admin/controller/home/InformationCate.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\home\InformationCate; + $this->view->assign("statusList", $this->model->getStatusList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/lang/zh-cn/home/about_us.php b/application/admin/lang/zh-cn/home/about_us.php new file mode 100644 index 0000000..52154ba --- /dev/null +++ b/application/admin/lang/zh-cn/home/about_us.php @@ -0,0 +1,22 @@ + '介绍类型', + 'Status 1' => '领导班子', + 'Set status to 1'=> '设为领导班子', + 'Status 2' => '机构职能', + 'Set status to 2'=> '设为机构职能', + 'Status 3' => '部门设置', + 'Set status to 3'=> '设为部门设置', + 'Status 4' => '直属单位', + 'Set status to 4'=> '设为直属单位', + 'Status 5' => '下属部门', + 'Set status to 5'=> '设为下属部门', + 'Tabtitle' => 'tab标题', + 'Title' => '文章标题', + 'Content' => '内容', + 'Weigh' => '权重', + 'Createtime' => '创建时间', + 'Updatetime' => '修改时间', + 'Deletetime' => '删除时间' +]; diff --git a/application/admin/lang/zh-cn/home/encyclopedia.php b/application/admin/lang/zh-cn/home/encyclopedia.php index 8f140d8..0388b43 100644 --- a/application/admin/lang/zh-cn/home/encyclopedia.php +++ b/application/admin/lang/zh-cn/home/encyclopedia.php @@ -2,6 +2,8 @@ return [ 'Title' => '标题', + 'Cate_id' => '类目', + 'Cate.name' => '类目名', 'Subtitle' => '副标题', 'Source' => '来源', 'Image' => '封面', diff --git a/application/admin/lang/zh-cn/home/friendship_link.php b/application/admin/lang/zh-cn/home/friendship_link.php new file mode 100644 index 0000000..cb3c9e2 --- /dev/null +++ b/application/admin/lang/zh-cn/home/friendship_link.php @@ -0,0 +1,21 @@ + '友链类型', + 'Status 1' => '省级共青团网站', + 'Set status to 1'=> '设为省级共青团网站', + 'Status 2' => '各地共青团网站', + 'Set status to 2'=> '设为各地共青团网站', + 'Status 3' => '其他', + 'Set status to 3'=> '设为其他', + 'Status 4' => '办公入口', + 'Set status to 4'=> '设为办公入口', + 'Title' => '友情链接标题', + 'Type' => '跳转类型', + 'Type in' => '内部跳转', + 'Type out' => '外部跳转', + 'Url' => '跳转链接', + 'Weigh' => '权重', + 'Createtime' => '创建时间', + 'Deletetime' => '删除时间' +]; diff --git a/application/admin/lang/zh-cn/home/information.php b/application/admin/lang/zh-cn/home/information.php index 8f140d8..0388b43 100644 --- a/application/admin/lang/zh-cn/home/information.php +++ b/application/admin/lang/zh-cn/home/information.php @@ -2,6 +2,8 @@ return [ 'Title' => '标题', + 'Cate_id' => '类目', + 'Cate.name' => '类目名', 'Subtitle' => '副标题', 'Source' => '来源', 'Image' => '封面', diff --git a/application/admin/lang/zh-cn/home/information_cate.php b/application/admin/lang/zh-cn/home/information_cate.php new file mode 100644 index 0000000..5ed72f9 --- /dev/null +++ b/application/admin/lang/zh-cn/home/information_cate.php @@ -0,0 +1,16 @@ + 'icon', + 'Name' => '类目名', + 'Flag' => '分类标识', + 'Status' => '状态', + 'Status 1' => '上架', + 'Set status to 1'=> '设为上架', + 'Status 2' => '下架', + 'Set status to 2'=> '设为下架', + 'Weigh' => '权重', + 'Createtime' => '创建时间', + 'Updatetime' => '修改时间', + 'Deletetime' => '删除时间' +]; diff --git a/application/admin/lang/zh-cn/home/news.php b/application/admin/lang/zh-cn/home/news.php index 6f5f5fc..7fe1cc0 100644 --- a/application/admin/lang/zh-cn/home/news.php +++ b/application/admin/lang/zh-cn/home/news.php @@ -1,7 +1,7 @@ '新闻类目', + 'Flag' => '分类标识', 'Title' => '新闻标题', 'Subtitle' => '新闻副标题', @@ -28,5 +28,6 @@ return [ 'Createtime' => '创建时间', 'Updatetime' => '修改时间', 'Deletetime' => '删除时间', + 'Cate_id' => '新闻类目', 'Cate.name' => '类目名' ]; diff --git a/application/admin/model/home/AboutUs.php b/application/admin/model/home/AboutUs.php new file mode 100644 index 0000000..dcf14ba --- /dev/null +++ b/application/admin/model/home/AboutUs.php @@ -0,0 +1,59 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getStatusList() + { + return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5')]; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ?: ($data['status'] ?? ''); + $list = $this->getStatusList(); + return $list[$value] ?? ''; + } + + + + +} diff --git a/application/admin/model/home/FriendshipLink.php b/application/admin/model/home/FriendshipLink.php new file mode 100644 index 0000000..851f63d --- /dev/null +++ b/application/admin/model/home/FriendshipLink.php @@ -0,0 +1,73 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getStatusList() + { + return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4')]; + } + + public function getTypeList() + { + return ['in' => __('Type in'), 'out' => __('Type out')]; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ?: ($data['status'] ?? ''); + $list = $this->getStatusList(); + return $list[$value] ?? ''; + } + + + public function getTypeTextAttr($value, $data) + { + $value = $value ?: ($data['type'] ?? ''); + $list = $this->getTypeList(); + return $list[$value] ?? ''; + } + + + + +} diff --git a/application/admin/model/home/Information.php b/application/admin/model/home/Information.php index 3e97a4c..28be55a 100644 --- a/application/admin/model/home/Information.php +++ b/application/admin/model/home/Information.php @@ -80,5 +80,10 @@ class Information extends Model return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } + public function cate() + { + return $this->belongsTo(InformationCate::class, 'cate_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + } diff --git a/application/admin/model/home/InformationCate.php b/application/admin/model/home/InformationCate.php new file mode 100644 index 0000000..39365ae --- /dev/null +++ b/application/admin/model/home/InformationCate.php @@ -0,0 +1,59 @@ +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] ?? ''; + } + + + + +} diff --git a/application/admin/validate/home/AboutUs.php b/application/admin/validate/home/AboutUs.php new file mode 100644 index 0000000..105612a --- /dev/null +++ b/application/admin/validate/home/AboutUs.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/home/FriendshipLink.php b/application/admin/validate/home/FriendshipLink.php new file mode 100644 index 0000000..d25eba6 --- /dev/null +++ b/application/admin/validate/home/FriendshipLink.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/home/InformationCate.php b/application/admin/validate/home/InformationCate.php new file mode 100644 index 0000000..0684a5f --- /dev/null +++ b/application/admin/validate/home/InformationCate.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/home/about_us/add.html b/application/admin/view/home/about_us/add.html new file mode 100644 index 0000000..64cff0a --- /dev/null +++ b/application/admin/view/home/about_us/add.html @@ -0,0 +1,45 @@ +
+ +
+ +
+ +
+ {foreach name="statusList" item="vo"} + + {/foreach} +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/home/about_us/edit.html b/application/admin/view/home/about_us/edit.html new file mode 100644 index 0000000..fadf1cc --- /dev/null +++ b/application/admin/view/home/about_us/edit.html @@ -0,0 +1,45 @@ +
+ +
+ +
+ +
+ {foreach name="statusList" item="vo"} + + {/foreach} +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/home/about_us/index.html b/application/admin/view/home/about_us/index.html new file mode 100644 index 0000000..327573a --- /dev/null +++ b/application/admin/view/home/about_us/index.html @@ -0,0 +1,46 @@ +
+ +
+ {:build_heading(null,FALSE)} + +
+ + +
+
+
+
+
+ + + {:__('Edit')} + + + + + + + + + + + + + +
+ +
+
+
+ +
+
+
diff --git a/application/admin/view/home/about_us/recyclebin.html b/application/admin/view/home/about_us/recyclebin.html new file mode 100644 index 0000000..94bb991 --- /dev/null +++ b/application/admin/view/home/about_us/recyclebin.html @@ -0,0 +1,25 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/application/admin/view/home/friendship_link/add.html b/application/admin/view/home/friendship_link/add.html new file mode 100644 index 0000000..0232671 --- /dev/null +++ b/application/admin/view/home/friendship_link/add.html @@ -0,0 +1,51 @@ +
+ +
+ +
+ +
+ {foreach name="statusList" item="vo"} + + {/foreach} +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/home/friendship_link/edit.html b/application/admin/view/home/friendship_link/edit.html new file mode 100644 index 0000000..ec40207 --- /dev/null +++ b/application/admin/view/home/friendship_link/edit.html @@ -0,0 +1,51 @@ +
+ +
+ +
+ +
+ {foreach name="statusList" item="vo"} + + {/foreach} +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
diff --git a/application/admin/view/home/friendship_link/index.html b/application/admin/view/home/friendship_link/index.html new file mode 100644 index 0000000..3cbc65b --- /dev/null +++ b/application/admin/view/home/friendship_link/index.html @@ -0,0 +1,46 @@ +
+ +
+ {:build_heading(null,FALSE)} + +
+ + +
+
+
+
+
+ + {:__('Add')} + {:__('Edit')} + {:__('Delete')} + + + + + {:__('Recycle bin')} +
+ +
+
+
+ +
+
+
diff --git a/application/admin/view/home/friendship_link/recyclebin.html b/application/admin/view/home/friendship_link/recyclebin.html new file mode 100644 index 0000000..801b813 --- /dev/null +++ b/application/admin/view/home/friendship_link/recyclebin.html @@ -0,0 +1,25 @@ +
+ {:build_heading()} + +
+
+
+ +
+ +
+
+
diff --git a/application/admin/view/home/information/add.html b/application/admin/view/home/information/add.html index af71e0f..51a33b7 100644 --- a/application/admin/view/home/information/add.html +++ b/application/admin/view/home/information/add.html @@ -1,5 +1,15 @@
+ + +
+ +
+ +
+
+ +
diff --git a/application/admin/view/home/information/edit.html b/application/admin/view/home/information/edit.html index 95b26af..aed91fd 100644 --- a/application/admin/view/home/information/edit.html +++ b/application/admin/view/home/information/edit.html @@ -1,5 +1,12 @@ +
+ +
+ +
+
+
diff --git a/application/admin/view/home/information_cate/add.html b/application/admin/view/home/information_cate/add.html new file mode 100644 index 0000000..fe548a5 --- /dev/null +++ b/application/admin/view/home/information_cate/add.html @@ -0,0 +1,53 @@ + + +
+ +
+
+ +
+ + +
+ +
+
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + {foreach name="statusList" item="vo"} + + {/foreach} +
    + +
    +
    +
    + +
    + +
    +
    + + diff --git a/application/admin/view/home/information_cate/edit.html b/application/admin/view/home/information_cate/edit.html new file mode 100644 index 0000000..2b1b242 --- /dev/null +++ b/application/admin/view/home/information_cate/edit.html @@ -0,0 +1,53 @@ +
    + +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      + {foreach name="statusList" item="vo"} + + {/foreach} +
      + +
      +
      +
      + +
      + +
      +
      + +
      diff --git a/application/admin/view/home/information_cate/index.html b/application/admin/view/home/information_cate/index.html new file mode 100644 index 0000000..5202ef6 --- /dev/null +++ b/application/admin/view/home/information_cate/index.html @@ -0,0 +1,46 @@ +
      + +
      + {:build_heading(null,FALSE)} + +
      + + +
      +
      +
      +
      +
      + + {:__('Add')} + {:__('Edit')} + {:__('Delete')} + + + + + {:__('Recycle bin')} +
      + +
      +
      +
      + +
      +
      +
      diff --git a/application/admin/view/home/information_cate/recyclebin.html b/application/admin/view/home/information_cate/recyclebin.html new file mode 100644 index 0000000..b690d94 --- /dev/null +++ b/application/admin/view/home/information_cate/recyclebin.html @@ -0,0 +1,25 @@ +
      + {:build_heading()} + +
      +
      +
      + +
      + +
      +
      +
      diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index 6655e8c..c1edeec 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -4,6 +4,8 @@ namespace app\api\controller; use app\api\controller\home\Base; use app\common\controller\Api; +use app\common\model\home\AboutUs; +use app\common\model\home\FriendshipLink; use app\common\model\home\Images; /** @@ -48,4 +50,75 @@ class Index extends Base } $this->success('查询成功', $res); } + + + + + /** + * @ApiTitle( 友情链接) + * @ApiSummary(友情链接) + * @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=各地共青团网站,3=其他,4=办公入口") + * @ApiReturn({ + * + *}) + */ + public function friendship_link() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $params=[]; + $page = $this->request->get('page/d', 0); //页数 + $limit = $this->request->get('limit/d', 0); //条数 + $params["status"] = $this->request->get('status/s', ""); //条数 + + + try{ + //当前申请状态 + $res = FriendshipLink::allList($page, $limit,$params); + + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', $res); + } + + + + /** + * @ApiTitle( 关于我们系列文章-建议不传参全查) + * @ApiSummary(友情链接) + * @ApiMethod(GET) + * @ApiParams(name = "page", type = "string",required=true,description = "页数") + * @ApiParams(name = "limit", type = "string",required=true,description = "条数") + * @ApiParams(name = "status", type = "string",required=false,description = "介绍类型:1=领导班子,2=机构职能,3=部门设置,4=直属单位,5=下属部门") + * @ApiReturn({ + * + *}) + */ + public function about_us() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $params=[]; + $page = $this->request->get('page/d', 1); //页数 + $limit = $this->request->get('limit/d', 100); //条数 + $params["status"] = $this->request->get('status/s', ""); //条数 + + + try{ + //当前申请状态 + $res = AboutUs::allList($page, $limit,$params); + + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', $res); + } } diff --git a/application/api/controller/home/Information.php b/application/api/controller/home/Information.php index beb368c..176b3fc 100644 --- a/application/api/controller/home/Information.php +++ b/application/api/controller/home/Information.php @@ -5,6 +5,7 @@ namespace app\api\controller\home; use app\common\model\home\Information as InformationModel; use app\common\model\home\NewsCate; +use app\common\model\home\InformationCate; /** * 信息公开接口 @@ -29,6 +30,45 @@ class Information 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 = InformationCate::allList($page, $limit,$params); + + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', $res); + } + + + + /** * @ApiTitle( 信息公开文章列表) * @ApiSummary(信息公开文章列表) @@ -37,6 +77,7 @@ class Information 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/common/model/home/AboutUs.php b/application/common/model/home/AboutUs.php new file mode 100644 index 0000000..963b69d --- /dev/null +++ b/application/common/model/home/AboutUs.php @@ -0,0 +1,70 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getStatusList() + { + return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5')]; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ?: ($data['status'] ?? ''); + $list = $this->getStatusList(); + return $list[$value] ?? ''; + } + + 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/application/common/model/home/EncyclopediaCate.php b/application/common/model/home/EncyclopediaCate.php index ab35abe..ac59858 100644 --- a/application/common/model/home/EncyclopediaCate.php +++ b/application/common/model/home/EncyclopediaCate.php @@ -141,9 +141,9 @@ class EncyclopediaCate extends BaseModel $sort = "weigh desc,id desc"; -// if(!empty($params['status'])){ -// $params['status'] = '1'; -// } + if(!empty($params['status'])){ + $params['status'] = '1'; + } return (new self)->getBaseList($params, $page, $limit,$sort); } diff --git a/application/common/model/home/FriendshipLink.php b/application/common/model/home/FriendshipLink.php new file mode 100644 index 0000000..bcfa13a --- /dev/null +++ b/application/common/model/home/FriendshipLink.php @@ -0,0 +1,87 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getStatusList() + { + return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4')]; + } + + public function getTypeList() + { + return ['in' => __('Type in'), 'out' => __('Type out')]; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ?: ($data['status'] ?? ''); + $list = $this->getStatusList(); + return $list[$value] ?? ''; + } + + + public function getTypeTextAttr($value, $data) + { + $value = $value ?: ($data['type'] ?? ''); + $list = $this->getTypeList(); + return $list[$value] ?? ''; + } + + + + + 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/application/common/model/home/InformationCate.php b/application/common/model/home/InformationCate.php new file mode 100644 index 0000000..50f64eb --- /dev/null +++ b/application/common/model/home/InformationCate.php @@ -0,0 +1,152 @@ +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/application/common/model/home/NewsCate.php b/application/common/model/home/NewsCate.php index e6c8020..74c8d32 100644 --- a/application/common/model/home/NewsCate.php +++ b/application/common/model/home/NewsCate.php @@ -156,9 +156,9 @@ class NewsCate extends BaseModel $sort = "weigh desc,id desc"; -// if(!empty($params['status'])){ -// $params['status'] = '1'; -// } + if(!empty($params['status'])){ + $params['status'] = '1'; + } return (new self)->getBaseList($params, $page, $limit,$sort); } diff --git a/application/common/model/home/RecruitmentInformationCate.php b/application/common/model/home/RecruitmentInformationCate.php index 5708a6d..b8f8f8a 100644 --- a/application/common/model/home/RecruitmentInformationCate.php +++ b/application/common/model/home/RecruitmentInformationCate.php @@ -59,9 +59,9 @@ class RecruitmentInformationCate extends BaseModel $sort = "weigh desc,id desc"; -// if(!empty($params['status'])){ -// $params['status'] = '1'; -// } + if(!empty($params['status'])){ + $params['status'] = '1'; + } return (new self)->getBaseList($params, $page, $limit,$sort); } diff --git a/public/assets/js/backend/home/about_us.js b/public/assets/js/backend/home/about_us.js new file mode 100644 index 0000000..c075cb7 --- /dev/null +++ b/public/assets/js/backend/home/about_us.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/about_us/index' + location.search, + add_url: 'home/about_us/add', + edit_url: 'home/about_us/edit', + del_url: 'home/about_us/del', + multi_url: 'home/about_us/multi', + import_url: 'home/about_us/import', + table: 'home_about_us', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'weigh', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5')}, formatter: Table.api.formatter.status}, + {field: 'tabtitle', title: __('Tabtitle'), 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: 'content', title: __('Content')}, + {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/about_us/recyclebin' + location.search, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'title', title: __('Title'), 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/about_us/restore', + refresh: true + }, + { + name: 'Destroy', + text: __('Destroy'), + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', + icon: 'fa fa-times', + url: 'home/about_us/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/friendship_link.js b/public/assets/js/backend/home/friendship_link.js new file mode 100644 index 0000000..1803ea0 --- /dev/null +++ b/public/assets/js/backend/home/friendship_link.js @@ -0,0 +1,117 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'home/friendship_link/index' + location.search, + add_url: 'home/friendship_link/add', + edit_url: 'home/friendship_link/edit', + del_url: 'home/friendship_link/del', + multi_url: 'home/friendship_link/multi', + import_url: 'home/friendship_link/import', + table: 'home_friendship_link', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'weigh', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4')}, formatter: Table.api.formatter.status}, + {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {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}, + {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/friendship_link/recyclebin' + location.search, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'title', title: __('Title'), 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/friendship_link/restore', + refresh: true + }, + { + name: 'Destroy', + text: __('Destroy'), + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', + icon: 'fa fa-times', + url: 'home/friendship_link/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/information.js b/public/assets/js/backend/home/information.js index 07e8b96..43178f1 100644 --- a/public/assets/js/backend/home/information.js +++ b/public/assets/js/backend/home/information.js @@ -28,6 +28,11 @@ 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/information_cate.js b/public/assets/js/backend/home/information_cate.js new file mode 100644 index 0000000..997cd6e --- /dev/null +++ b/public/assets/js/backend/home/information_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/information_cate/index' + location.search, + add_url: 'home/information_cate/add', + edit_url: 'home/information_cate/edit', + del_url: 'home/information_cate/del', + multi_url: 'home/information_cate/multi', + import_url: 'home/information_cate/import', + table: 'information_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/information_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/information_cate/restore', + refresh: true + }, + { + name: 'Destroy', + text: __('Destroy'), + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', + icon: 'fa fa-times', + url: 'home/information_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; +});