123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <?php
- /**
- * Niushop商城系统 - 团队十年电商经验汇集巨献!
- * =========================================================
- * Copy right 2019-2029 山西牛酷信息科技有限公司, 保留所有权利。
- * ----------------------------------------------
- * 官方网址: https://www.niushop.com.cn
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
- * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
- * =========================================================
- */
- namespace app\admin\controller;
- use app\model\web\NoticeClass;
- use app\model\web\NoticeClass as NoticeClassModel;
- use app\model\web\Notice as NoticeModel;
- /**
- * 商家帮助
- */
- class Notice extends BaseAdmin
- {
- /**
- * 分类列表
- */
- public function classList()
- {
- if (request()->isAjax()) {
- $page = input('page', 1);
- $page_size = input('page_size', PAGE_LIST_ROWS);
- $search_text = input('search_text', '');
- $condition[] = [ 'name', 'like', '%' . $search_text . '%' ];
- $order = 'create_time desc';
- $field = '*';
- $help_model = new NoticeClassModel();
- return $help_model->getNoticeClassPageList($condition, $page, $page_size, $order, $field);
- } else {
- $this->forthMenu();
- return $this->fetch('notice/class_list');
- }
- }
- /**
- * 分类添加
- */
- public function addClass()
- {
- if (request()->isAjax()) {
- $data = [
- 'name' => input('class_name', ''),
- 'create_time'=>time(),
- ];
- $help_model = new NoticeClassModel();
- return $help_model->addNoticeClass($data);
- } else {
- return $this->fetch('notice/add_class');
- }
- }
- /**
- * 分类编辑
- */
- public function editClass()
- {
- $help_model = new NoticeClassModel();
- if (request()->isAjax()) {
- $data = [
- 'class_name' => input('class_name', ''),
- 'create_time'=>time(),
- ];
- $class_id = input('class_id', 0);
- return $help_model->editnNoticeClass($data, $class_id);
- } else {
- $class_id = input('class_id', 0);
- $this->assign('class_id', $class_id);
- //帮助详情
- $class_info = $help_model->getNoticeClassInfo([ [ 'id', '=', $class_id ] ]);
- $this->assign('class_info', $class_info);
- return $this->fetch('notice/edit_class');
- }
- }
- /**
- * 分类删除
- */
- public function deleteClass()
- {
- if (request()->isAjax()) {
- $class_id = input('class_id', 0);
- $help_model = new NoticeClassModel();
- return $help_model->deleteNoticeClass([ [ 'id', '=', $class_id ] ]);
- }
- }
- /**
- * 帮助列表
- */
- public function helpList()
- {
- if (request()->isAjax()) {
- $page = input('page', 1);
- $page_size = input('page_size', PAGE_LIST_ROWS);
- $search_text = input('search_text', '');
- $condition[] = [ 'title', 'like', '%' . $search_text . '%' ];
- $order = 'create_time desc';
- $field = 'id,title,class_id,class_name,create_time';
- $help_model = new NoticeModel();
- return $help_model->getNoticePageList($condition, $page, $page_size, $order, $field);
- } else {
- $this->forthMenu();
- return $this->fetch('notice/help_list');
- }
- }
- /**
- * 帮助添加
- */
- public function addHelp()
- {
- $help_model = new NoticeModel();
- if (request()->isAjax()) {
- $data = [
- 'title' => input('title', ''),
- 'content' => input('content', ''),
- 'class_id' => input('class_id', ''),
- 'class_name' => input('class_name', ''),
- 'create_time' => time(),
- ];
- return $help_model->addNotice($data);
- } else {
- $help_class_model = new NoticeClassModel();
- //帮助分类
- $help_class_list = $help_class_model->getNoticeClassList([], 'id, name');
- $this->assign('help_class_list', $help_class_list['data']);
- return $this->fetch('notice/add_help');
- }
- }
- /**
- * 帮助编辑
- */
- public function editHelp()
- {
- $help_model = new NoticeModel();
- if (request()->isAjax()) {
- $data = [
- 'title' => input('title', ''),
- 'content' => input('content', ''),
- 'class_id' => input('class_id', ''),
- 'class_name' => input('class_name', ''),
- 'modify_time' => time(),
- ];
- $id = input('id', 0);
- return $help_model->editNotice($data, [ [ 'id', '=', $id ] ]);
- } else {
- $id = input('id', 0);
- $this->assign('id', $id);
- $help_info = $help_model->getNoticeInfo([['id','=',$id]]);
- $this->assign('help_info', $help_info['data']);
- //帮助分类
- $help_class_model = new NoticeClassModel();
- $help_class_list = $help_class_model->getNoticeClassList([ ], 'id, name');
- $this->assign('help_class_list', $help_class_list['data']);
- // print_r($help_info); print_r($help_class_list);die;
- return $this->fetch('notice/edit_help');
- }
- }
- /**
- * 帮助删除
- */
- public function deleteHelp()
- {
- if (request()->isAjax()) {
- $id = input('id', 0);
- $help_model = new NoticeModel();
- return $help_model->deleteNotice([ [ 'id', '=', $id ] ]);
- }
- }
- }
|