diff --git a/app/admin/controller/Api.php b/app/admin/controller/Api.php index cf5a29a..eaa6759 100644 --- a/app/admin/controller/Api.php +++ b/app/admin/controller/Api.php @@ -339,9 +339,18 @@ class Api extends BaseController public function getbytype(){ $type = get_params("type"); + $flag = get_params("flag"); $where['type'] = $type; $where['status'] = 'normal'; - $list = Db::table('fa_category')->where($where)->order('weigh asc,id asc')->select(); + $list = Db::table('fa_category')->field('id,pid,type,name')->where($where)->where('pid','<>',0)->order('weigh asc,id asc')->select()->toArray(); + + // 添加无 + $wu['id'] = 0; + $wu['pid'] = 0; + $wu['type'] = 0; + $wu['name'] = '无'; + array_unshift ($list,$wu); + return to_assign(0, '', $list); } diff --git a/app/admin/controller/nk/Affairs.php b/app/admin/controller/nk/Affairs.php new file mode 100644 index 0000000..9750d55 --- /dev/null +++ b/app/admin/controller/nk/Affairs.php @@ -0,0 +1,86 @@ +adminInfo = get_login_admin(); + $this->category_id=160; + $this->url=[ + '/admin/nk.affairs/index?category_id='.$this->category_id, + '/admin/nk.affairs/add', + '/admin/nk.affairs/edit', + '/admin/nk.affairs/del', + '/admin/nk.affairs/read', + ]; + } + /** + * 查看 + */ + public function index() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->index($params); + } + return view('nk/article/index',['url'=>$this->url]); + } + /** + * 添加 + */ + public function add() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->add($params); + }else{ + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view('nk/article/add'); + } + } + /** + * 修改 + */ + public function edit() + { + $params= get_params(); + (new Article())->edit($params); + return view('nk/article/edit',['url'=>$this->url]); + } + /** + * 查看信息 + */ + public function read() + { + $params = get_params(); + (new Article())->read($params); + + return view('nk/article/read',['url'=>$this->url]); + + } + /** + * 修改 + */ + public function del() + { + $params= get_params(); + (new Article())->del($params); + } +} \ No newline at end of file diff --git a/app/admin/controller/nk/Category.php b/app/admin/controller/nk/Category.php index 51fb58c..6b2a3fe 100644 --- a/app/admin/controller/nk/Category.php +++ b/app/admin/controller/nk/Category.php @@ -45,12 +45,46 @@ class Category extends BaseController $param = get_params(); if (request()->isAjax()) { - return to_assign(); + if($param['pid'] == 0){ + $www['pid'] = 0; + $www['type'] = $param['type']; + $pid = Db::table('fa_category')->where($www)->value('id'); + if($pid){ + $param['pid'] = $pid; + }else{ + return to_assign(1, '操作失败,请联系系统管理员'); + } + } + if ($param['id'] > 0) { + $param['updatetime'] = time(); + $res = Db::table('fa_category')->strict(false)->field(true)->where('id',$param['id'])->update($param); + if ($res){ + add_log('edit', $param['id'], $param); + return to_assign(0,'操作成功',['aid'=>$res]); + } + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + $param['nickname'] = $param['name']; + $param['createtime'] = time(); + unset($param['id']); + $res=Db::table('fa_category')->strict(false)->field(true)->insertGetId($param); + if ($res){ + add_log('add', $res, $param); + return to_assign(0,'操作成功',['aid'=>$res]); + } + return to_assign(1, '操作失败,原因:'.$res); + } + } else { $id = isset($param['id']) ? $param['id'] : 0; $pid = isset($param['pid']) ? $param['pid'] : 0; if($id>0){ - $detail = Db::name('fa_category')->where('id',$id)->find(); + $detail = Db::table('fa_category')->where('id',$id)->find(); + View::assign('detail', $detail); + }else{ + $detail['pid'] = ''; + $detail['type'] = ''; View::assign('detail', $detail); } View::assign('id', $id); diff --git a/app/admin/controller/nk/Finance.php b/app/admin/controller/nk/Finance.php new file mode 100644 index 0000000..f0810e2 --- /dev/null +++ b/app/admin/controller/nk/Finance.php @@ -0,0 +1,86 @@ +adminInfo = get_login_admin(); + $this->category_id=161; + $this->url=[ + '/admin/nk.finance/index?category_id='.$this->category_id, + '/admin/nk.finance/add', + '/admin/nk.finance/edit', + '/admin/nk.finance/del', + '/admin/nk.finance/read', + ]; + } + /** + * 查看 + */ + public function index() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->index($params); + } + return view('nk/article/index',['url'=>$this->url]); + } + /** + * 添加 + */ + public function add() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->add($params); + }else{ + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view('nk/article/add'); + } + } + /** + * 修改 + */ + public function edit() + { + $params= get_params(); + (new Article())->edit($params); + return view('nk/article/edit',['url'=>$this->url]); + } + /** + * 查看信息 + */ + public function read() + { + $params = get_params(); + (new Article())->read($params); + + return view('nk/article/read',['url'=>$this->url]); + + } + /** + * 修改 + */ + public function del() + { + $params= get_params(); + (new Article())->del($params); + } +} \ No newline at end of file diff --git a/app/admin/controller/nk/Meeting.php b/app/admin/controller/nk/Meeting.php new file mode 100644 index 0000000..5f99018 --- /dev/null +++ b/app/admin/controller/nk/Meeting.php @@ -0,0 +1,86 @@ +adminInfo = get_login_admin(); + $this->category_id=162; + $this->url=[ + '/admin/nk.meeting/index?category_id='.$this->category_id, + '/admin/nk.meeting/add', + '/admin/nk.meeting/edit', + '/admin/nk.meeting/del', + '/admin/nk.meeting/read', + ]; + } + /** + * 查看 + */ + public function index() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->index($params); + } + return view('nk/article/index',['url'=>$this->url]); + } + /** + * 添加 + */ + public function add() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->add($params); + }else{ + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view('nk/article/add'); + } + } + /** + * 修改 + */ + public function edit() + { + $params= get_params(); + (new Article())->edit($params); + return view('nk/article/edit',['url'=>$this->url]); + } + /** + * 查看信息 + */ + public function read() + { + $params = get_params(); + (new Article())->read($params); + + return view('nk/article/read',['url'=>$this->url]); + + } + /** + * 修改 + */ + public function del() + { + $params= get_params(); + (new Article())->del($params); + } +} \ No newline at end of file diff --git a/app/admin/controller/nk/Party.php b/app/admin/controller/nk/Party.php new file mode 100644 index 0000000..9be5c12 --- /dev/null +++ b/app/admin/controller/nk/Party.php @@ -0,0 +1,86 @@ +adminInfo = get_login_admin(); + $this->category_id=176; + $this->url=[ + '/admin/nk.party/index?category_id='.$this->category_id, + '/admin/nk.party/add', + '/admin/nk.party/edit', + '/admin/nk.party/del', + '/admin/nk.party/read', + ]; + } + /** + * 查看 + */ + public function index() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->index($params); + } + return view('nk/article/index',['url'=>$this->url]); + } + /** + * 添加 + */ + public function add() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->add($params); + }else{ + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view('nk/article/add'); + } + } + /** + * 修改 + */ + public function edit() + { + $params= get_params(); + (new Article())->edit($params); + return view('nk/article/edit',['url'=>$this->url]); + } + /** + * 查看信息 + */ + public function read() + { + $params = get_params(); + (new Article())->read($params); + + return view('nk/article/read',['url'=>$this->url]); + + } + /** + * 修改 + */ + public function del() + { + $params= get_params(); + (new Article())->del($params); + } +} \ No newline at end of file diff --git a/app/admin/validate/UserCheck.php b/app/admin/validate/UserCheck.php new file mode 100644 index 0000000..b74964a --- /dev/null +++ b/app/admin/validate/UserCheck.php @@ -0,0 +1,26 @@ + 'require', + 'password' => 'require', + 'captcha' => 'require|captcha', + ]; + + protected $message = [ + 'username.require' => '用户名不能为空', + 'password.require' => '密码不能为空', + 'captcha.require' => '验证码不能为空', + 'captcha.captcha' => '验证码不正确', + ]; +} diff --git a/app/admin/view/nk/category/add.html b/app/admin/view/nk/category/add.html index ce41449..c25b0cf 100644 --- a/app/admin/view/nk/category/add.html +++ b/app/admin/view/nk/category/add.html @@ -20,75 +20,88 @@
父级菜单/节点* + | 类型* | - | -左侧菜单显示* - | -- - - | |||||||
菜单/节点名称* + | 父级ID* | -- - | -操作日志名称* - | -- + | + | ||||||
菜单/节点URL | -- - | -菜单排序 | -- - | +名称* | +|||||||
菜单图标 | -- - [查看图标] + | 图片 | +
+
+
+
+
+ |
||||||||
权重* | ++ |