diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php
index 683af7e..1ef2ed7 100644
--- a/app/admin/controller/Login.php
+++ b/app/admin/controller/Login.php
@@ -50,6 +50,8 @@ class Login
'login_num' => $admin['login_num'] + 1,
];
Db::name('admin')->where(['id' => $admin['id']])->update($data);
+ $group_access=Db::name('admin_group_access')->where(['uid' => $admin['id']])->find();
+ $admin['group_access']=$group_access['group_id'];
$session_admin = get_config('app.session_admin');
Session::set($session_admin, $admin);
$token = make_token();
diff --git a/app/admin/controller/nk/Accommodation.php b/app/admin/controller/nk/Accommodation.php
new file mode 100644
index 0000000..a4ae12e
--- /dev/null
+++ b/app/admin/controller/nk/Accommodation.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=308;
+ $this->url=[
+ '/admin/nk.accommodation/index?category_id='.$this->category_id,
+ '/admin/nk.accommodation/add',
+ '/admin/nk.accommodation/edit',
+ '/admin/nk.accommodation/del',
+ '/admin/nk.accommodation/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/Announce.php b/app/admin/controller/nk/Announce.php
new file mode 100644
index 0000000..7087527
--- /dev/null
+++ b/app/admin/controller/nk/Announce.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=302;
+ $this->url=[
+ '/admin/nk.announce/index?category_id='.$this->category_id,
+ '/admin/nk.announce/add',
+ '/admin/nk.announce/edit',
+ '/admin/nk.announce/del',
+ '/admin/nk.announce/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/Article.php b/app/admin/controller/nk/Article.php
index 1fd9f6a..da428d4 100644
--- a/app/admin/controller/nk/Article.php
+++ b/app/admin/controller/nk/Article.php
@@ -23,9 +23,7 @@ class Article extends BaseController
public function index($params)
{
- $where=[
- 'status'=>1
- ];
+ $where['status']=1;
if (isset($params['keywords'])){
$where[]=['title','like','%'.$params['keywords'].'%'];
}
@@ -49,7 +47,7 @@ class Article extends BaseController
$category_id =$params['category_id'];
if($category_id){
- $map[] = ['category_id','in',$category_id];
+ $map[] = ['category_id','=',$category_id];
}else{
$map = [];
}
@@ -75,6 +73,7 @@ class Article extends BaseController
->where($map)
->page($params['page'])
->limit($params['limit'])
+ ->order('id desc')
->field('id,title,user_id,county,township,village,image,view_time')
->select();
@@ -86,7 +85,7 @@ class Article extends BaseController
public function add($param){
// 检验完整性
try {
- validate(\app\admin\validate\party\Article::class)->check($param);
+ validate(\app\admin\validate\nk\ArticleValidate::class)->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
@@ -106,7 +105,7 @@ class Article extends BaseController
public function edit($param){
if (request()->isAjax()) {
try {
- validate(\app\admin\validate\party\Article::class)->check($param);
+ validate(\app\admin\validate\nk\ArticleValidate::class)->check($param);
} catch (ValidateException $e) {
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
diff --git a/app/admin/controller/nk/Classroom.php b/app/admin/controller/nk/Classroom.php
new file mode 100644
index 0000000..0a9db1a
--- /dev/null
+++ b/app/admin/controller/nk/Classroom.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=298;
+ $this->url=[
+ '/admin/nk.classroom/index?category_id='.$this->category_id,
+ '/admin/nk.classroom/add',
+ '/admin/nk.classroom/edit',
+ '/admin/nk.classroom/del',
+ '/admin/nk.classroom/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/Education.php b/app/admin/controller/nk/Education.php
new file mode 100644
index 0000000..ab8935b
--- /dev/null
+++ b/app/admin/controller/nk/Education.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=299;
+ $this->url=[
+ '/admin/nk.education/index?category_id='.$this->category_id,
+ '/admin/nk.education/add',
+ '/admin/nk.education/edit',
+ '/admin/nk.education/del',
+ '/admin/nk.education/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/Eliminate.php b/app/admin/controller/nk/Eliminate.php
new file mode 100644
index 0000000..9eea390
--- /dev/null
+++ b/app/admin/controller/nk/Eliminate.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=149;
+ $this->url=[
+ '/admin/nk.eliminate/index?category_id='.$this->category_id,
+ '/admin/nk.eliminate/add',
+ '/admin/nk.eliminate/edit',
+ '/admin/nk.eliminate/del',
+ '/admin/nk.eliminate/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/Farming.php b/app/admin/controller/nk/Farming.php
new file mode 100644
index 0000000..6dc61da
--- /dev/null
+++ b/app/admin/controller/nk/Farming.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=311;
+ $this->url=[
+ '/admin/nk.farming/index?category_id='.$this->category_id,
+ '/admin/nk.farming/add',
+ '/admin/nk.farming/edit',
+ '/admin/nk.farming/del',
+ '/admin/nk.farming/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/Feedback.php b/app/admin/controller/nk/Feedback.php
new file mode 100644
index 0000000..fcefec5
--- /dev/null
+++ b/app/admin/controller/nk/Feedback.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=165;
+ $this->url=[
+ '/admin/nk.feedback/index?category_id='.$this->category_id,
+ '/admin/nk.feedback/add',
+ '/admin/nk.feedback/edit',
+ '/admin/nk.feedback/del',
+ '/admin/nk.feedback/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/Fishing.php b/app/admin/controller/nk/Fishing.php
new file mode 100644
index 0000000..cc5481f
--- /dev/null
+++ b/app/admin/controller/nk/Fishing.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=310;
+ $this->url=[
+ '/admin/nk.fishing/index?category_id='.$this->category_id,
+ '/admin/nk.fishing/add',
+ '/admin/nk.fishing/edit',
+ '/admin/nk.fishing/del',
+ '/admin/nk.fishing/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/Food.php b/app/admin/controller/nk/Food.php
new file mode 100644
index 0000000..6f8425e
--- /dev/null
+++ b/app/admin/controller/nk/Food.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=307;
+ $this->url=[
+ '/admin/nk.food/index?category_id='.$this->category_id,
+ '/admin/nk.food/add',
+ '/admin/nk.food/edit',
+ '/admin/nk.food/del',
+ '/admin/nk.food/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/Government.php b/app/admin/controller/nk/Government.php
new file mode 100644
index 0000000..196eb04
--- /dev/null
+++ b/app/admin/controller/nk/Government.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=301;
+ $this->url=[
+ '/admin/nk.government/index?category_id='.$this->category_id,
+ '/admin/nk.government/add',
+ '/admin/nk.government/edit',
+ '/admin/nk.government/del',
+ '/admin/nk.government/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/Heresy.php b/app/admin/controller/nk/Heresy.php
new file mode 100644
index 0000000..eb189c3
--- /dev/null
+++ b/app/admin/controller/nk/Heresy.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=148;
+ $this->url=[
+ '/admin/nk.heresy/index?category_id='.$this->category_id,
+ '/admin/nk.heresy/add',
+ '/admin/nk.heresy/edit',
+ '/admin/nk.heresy/del',
+ '/admin/nk.heresy/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/Industry.php b/app/admin/controller/nk/Industry.php
new file mode 100644
index 0000000..e3ade0b
--- /dev/null
+++ b/app/admin/controller/nk/Industry.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=312;
+ $this->url=[
+ '/admin/nk.industry/index?category_id='.$this->category_id,
+ '/admin/nk.industry/add',
+ '/admin/nk.industry/edit',
+ '/admin/nk.industry/del',
+ '/admin/nk.industry/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/Mediation.php b/app/admin/controller/nk/Mediation.php
new file mode 100644
index 0000000..b0802e9
--- /dev/null
+++ b/app/admin/controller/nk/Mediation.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=147;
+ $this->url=[
+ '/admin/nk.mediation/index?category_id='.$this->category_id,
+ '/admin/nk.mediation/add',
+ '/admin/nk.mediation/edit',
+ '/admin/nk.mediation/del',
+ '/admin/nk.mediation/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/People.php b/app/admin/controller/nk/People.php
new file mode 100644
index 0000000..1a477d6
--- /dev/null
+++ b/app/admin/controller/nk/People.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=152;
+ $this->url=[
+ '/admin/nk.people/index?category_id='.$this->category_id,
+ '/admin/nk.people/add',
+ '/admin/nk.people/edit',
+ '/admin/nk.people/del',
+ '/admin/nk.people/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/Profile.php b/app/admin/controller/nk/Profile.php
new file mode 100644
index 0000000..9eb4668
--- /dev/null
+++ b/app/admin/controller/nk/Profile.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=296;
+ $this->url=[
+ '/admin/nk.profile/index?category_id='.$this->category_id,
+ '/admin/nk.profile/add',
+ '/admin/nk.profile/edit',
+ '/admin/nk.profile/del',
+ '/admin/nk.profile/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/Recruit.php b/app/admin/controller/nk/Recruit.php
new file mode 100644
index 0000000..def9ec2
--- /dev/null
+++ b/app/admin/controller/nk/Recruit.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=316;
+ $this->url=[
+ '/admin/nk.recruit/index?category_id='.$this->category_id,
+ '/admin/nk.recruit/add',
+ '/admin/nk.recruit/edit',
+ '/admin/nk.recruit/del',
+ '/admin/nk.recruit/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/Regulation.php b/app/admin/controller/nk/Regulation.php
new file mode 100644
index 0000000..dc363b7
--- /dev/null
+++ b/app/admin/controller/nk/Regulation.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=163;
+ $this->url=[
+ '/admin/nk.regulation/index?category_id='.$this->category_id,
+ '/admin/nk.regulation/add',
+ '/admin/nk.regulation/edit',
+ '/admin/nk.regulation/del',
+ '/admin/nk.regulation/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/System.php b/app/admin/controller/nk/System.php
new file mode 100644
index 0000000..4196e30
--- /dev/null
+++ b/app/admin/controller/nk/System.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=297;
+ $this->url=[
+ '/admin/nk.system/index?category_id='.$this->category_id,
+ '/admin/nk.system/add',
+ '/admin/nk.system/edit',
+ '/admin/nk.system/del',
+ '/admin/nk.system/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/SzxcNotice.php b/app/admin/controller/nk/SzxcNotice.php
new file mode 100644
index 0000000..762c403
--- /dev/null
+++ b/app/admin/controller/nk/SzxcNotice.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=164;
+ $this->url=[
+ '/admin/nk.szxc_notice/index?category_id='.$this->category_id,
+ '/admin/nk.szxc_notice/add',
+ '/admin/nk.szxc_notice/edit',
+ '/admin/nk.szxc_notice/del',
+ '/admin/nk.szxc_notice/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/Travel.php b/app/admin/controller/nk/Travel.php
new file mode 100644
index 0000000..1c51040
--- /dev/null
+++ b/app/admin/controller/nk/Travel.php
@@ -0,0 +1,86 @@
+adminInfo = get_login_admin();
+ $this->category_id=309;
+ $this->url=[
+ '/admin/nk.travel/index?category_id='.$this->category_id,
+ '/admin/nk.travel/add',
+ '/admin/nk.travel/edit',
+ '/admin/nk.travel/del',
+ '/admin/nk.travel/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/User.php b/app/admin/controller/nk/User.php
new file mode 100644
index 0000000..bb2387c
--- /dev/null
+++ b/app/admin/controller/nk/User.php
@@ -0,0 +1,766 @@
+adminInfo = get_login_admin();
+ $this->category_id = 305;
+ $this->url = [
+ '/admin/nk.user/index?category_id=' . $this->category_id,
+ '/admin/nk.user/add',
+ '/admin/nk.user/edit',
+ '/admin/nk.user/del',
+ '/admin/nk.user/read',
+ '/admin/nk.user/auths',
+ '/admin/nk.user/postedit',
+ ];
+ }
+ /**
+ * 查看
+ */
+ public function index()
+ {
+ if (request()->isAjax()) {
+ $mmm = [];
+ $post = get_params();
+ if (!empty($post['keywords'])) {
+ $mmm[] = ['m.name', 'LIKE', '%' . $post['keywords'] . '%'];
+ }
+ if (!empty($post['phone'])) {
+
+ $mmm[] = ['m.phone', 'LIKE', '%' . $post['phone'] . '%'];
+ }
+
+ //权限组信息
+ if ($this->adminInfo['position_id'] != 1) {
+ $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->adminInfo['id'])->find();
+ if ($find) {
+ if ($find['auth_range'] == 1) {
+ $mmm['village_id'] = $find['village_id'];
+ } elseif ($find['auth_range'] == 2) {
+ $mmm['street_id'] = $find['street_id'];
+ } elseif ($find['auth_range'] == 3) {
+ $mmm['area_id'] = $find['area_id'];
+ }
+ }
+ }
+ if ($post) {
+ if (isset($post['area_id']) && !empty($post['area_id'])) {
+ $mmm['area_id'] = $post['area_id'];
+ }
+ if (isset($post['street_id']) && !empty($post['street_id'])) {
+ $mmm['street_id'] = $post['street_id'];
+ }
+ if (isset($post['village_id']) && !empty($post['village_id'])) {
+ $mmm['village_id'] = $post['village_id'];
+ }
+ if (isset($post['brigade_id']) && !empty($post['brigade_id'])) {
+ $mmm['brigade_id'] = $post['brigade_id'];
+ }
+ }
+ //权限组信息
+ $total = Db::table('fa_szxc_information_usermsg')
+ ->alias('m')
+ ->where($mmm)
+ ->count();
+ $list = Db::table('fa_szxc_information_usermsg')
+ ->alias('m')
+ ->where($mmm)
+ ->join(['fa_user' => 'u'], 'm.user_id=u.id')
+ ->join(['fa_user_group' => 'g'], 'g.id=u.group_id')
+ ->field('u.id,m.name,m.phone,u.avatar,u.group_id,u.status,m.gender,m.age,g.name group_name,m.householder_id')
+ ->withAttr('count', function ($value, $data) {
+ if ($data['householder_id'] != 0) {
+ $count = Db::table('fa_szxc_information_usermsg')->where('householder_id', $data['householder_id'])->count();
+ } else {
+ $count = '未绑定户主无法查询';
+ }
+ return $count;
+ })
+ ->withAttr('gender', function ($value, $data) {
+ if ($value == 1) {
+ return '男';
+ } elseif ($value == 2) {
+ return '女';
+ }
+ })
+ ->order('id DESC')
+ ->page($post['page'])
+ ->limit($post['limit'])
+ ->select();
+
+ $result = ['total' => $total, 'data' => $list];
+ return table_assign(0, '', $result);
+ }
+ //权限组信息
+ if ($this->adminInfo['position_id'] != 1) { //不是超级管理员
+ $www['admin_id'] = $this->adminInfo['id'];
+ $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
+ if ($user_address) {
+ if ($user_address['auth_range'] == 1) {
+ $select = Db::table('fa_geo_area')->where('city_code', '510500')->where('area_code', $user_address['area_id'])->select();
+ } elseif ($user_address['auth_range'] == 2) {
+ $select = Db::table('fa_geo_area')->where('city_code', '510500')->where('area_code', $user_address['area_id'])->select();
+ } elseif ($user_address['auth_range'] == 3) {
+ $select = Db::table('fa_geo_area')->where('city_code', '510500')->where('area_code', $user_address['area_id'])->select();
+ } elseif ($user_address['auth_range'] == 4) {
+ $select = Db::table('fa_geo_area')->where('city_code', '510500')->select();
+ } else {
+ $select = Db::table('fa_geo_area')->where('city_code', '510500')->select();
+ }
+ View::assign('row', $user_address);
+ } else {
+ $user_address['area_id'] = '';
+ $user_address['street_id'] = '';
+ $user_address['village_code'] = '';
+ $user_address['auth_range'] = '1';
+ $select = Db::table('fa_geo_area')->where('city_code', '510500')->select();
+ View::assign('row', $user_address);
+ }
+
+ $is_admin = 0;
+ } else {
+ $user_address['area_id'] = '';
+ $user_address['street_id'] = '';
+ $user_address['village_code'] = '';
+ $user_address['auth_range'] = '';
+ $select = Db::table('fa_geo_area')->where('city_code', '510500')->select();
+ View::assign('row', $user_address);
+ $is_admin = 1;
+ }
+ View::assign('arealist', $select);
+ View::assign('is_admin', $is_admin);
+ View::assign('url', $this->url);
+ return view();
+ }
+ /**
+ * 添加
+ */
+ 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();
+ $find = Db::table('fa_szxc_information_usermsg')
+ ->where('user_id', $params['id'])->find();
+ //获取所有分类
+ $www2[] = ['type', 'in', ['Nation', 'Education', 'Occupation', 'Zzmm', 'Family', 'Nature_of_land', 'Blood_type', 'Drug_allergy', 'Exposure_history', 'History_of_disease', 'Whether_disabled', 'Cfpfss', 'Fuel_type', 'Drinking_water', 'Toilet_msg', 'Poultry_corral', 'Insurance_type', 'House', 'Car', 'Grade', 'Insurance', 'Medical_insurance_type', 'FamilyHistory', 'Marriage']];
+ $all_category = Db::table('fa_category')->where($www2)->field('id,type,name,pid')->select();
+ //种植信息
+ $planting = Db::table('fa_szxc_information_planting')->where('user_id', $params['id'])
+ ->find();
+ $strlen = strlen($planting['breed_msg']);
+ if ($strlen != 0 || $strlen > 10) {
+ $planting['breed_msg'] = json_decode($planting['breed_msg'], true);
+ }
+ $strlen1 = strlen($planting['crops_msg']);
+ if ($strlen1 != 0 || $strlen1 > 10) {
+ $planting['crops_msg'] = json_decode($planting['crops_msg'], true);
+ }
+ $strlen2 = strlen($planting['tools_msg']);
+ if ($strlen2 != 0 || $strlen2 > 10) {
+ $planting['tools_msg'] = json_decode($planting['tools_msg'], true);
+ }
+ //保险信息
+ $insurancearr = Db::table('fa_szxc_information_insurance')->where('user_id', $params['id'])->find();
+ //健康信息
+ $healthyarr = Db::table('fa_szxc_information_healthy')->where('user_id', $params['id'])->find();
+ if ($planting == null) {
+ $planting = [
+ "tools_msg" => "",
+ "crops_msg" => "",
+ "land_area" => "",
+ "is_wz" => '',
+ "nature_of_land" => "",
+ ];
+ }
+ if ($insurancearr == null) {
+ $insurancearr = [
+ "endowment_insurance_status" => "",
+ "is_subsidy" => "",
+ "insurance_reason" => "",
+ "medical_insurance_type" => "",
+ "whether_disabled" => "",
+ "disability_num" => "",
+ "disability_type" => "",
+ "disability_level" => "",
+ "insurance_type" => "",
+ "ny_insurance" => "",
+ "sy_insurance" => "",
+ ];
+ }
+ if ($healthyarr == null) {
+ $healthyarr = [
+ "medical_insurance_type" => "",
+ "insurance_type" => "",
+ "blood_type" => "",
+ "drug_allergy" => "",
+ "exposure_history" => "",
+ "history_of_disease" => "",
+ "history_of_surgery" => "",
+ "family_history" => "",
+ "familial_diseases" => "",
+ "genetic_history" => "",
+ "genetic_name" => "",
+ "whether_disabled" => "",
+ "cfpfss" => "",
+ "fuel_type" => "",
+ "drinking_water" => "",
+ "toilet_msg" => "",
+ "poultry_corral" => "",
+ ];
+ }
+ View::assign('user_id', $params['id']);
+ View::assign('healthyarr', $healthyarr);
+ View::assign('insurancearr', $insurancearr);
+ View::assign('planting', $planting);
+ View::assign('all_category', $all_category);
+ View::assign('user', $find);
+ View::assign('url', $this->url);
+ View::assign('editor', get_system_config('other', 'editor'));
+
+ return view();
+ }
+ /**
+ * 提交修改
+ */
+ public function postedit()
+ {
+ $params = get_params();
+ halt($params);
+ if ($params['type'] == 1) {
+ unset($params['type']);
+ $res = Db::table('fa_szxc_information_usermsg')->where('user_id', $params['user_id'])->update($params);
+ if ($res) {
+ return to_assign(0, '操作成功');
+ } else {
+ return to_assign(1, '操作失败');
+ }
+ }
+ if ($params['type'] == 2) {
+ halt($params);
+ unset($params['type']);
+ $find = Db::table('fa_szxc_information_insurance')->where('user_id', $params['user_id'])->find();
+ if ($find) {
+ $res = Db::table('fa_szxc_information_insurance')->where('id', $find['id'])->update($params);
+ } else {
+ $res = Db::table('fa_szxc_information_insurance')->where('user_id', $params['user_id'])->insert($params);
+ }
+ if ($res) {
+ return to_assign(0, '操作成功');
+ } else {
+ return to_assign(1, '操作失败');
+ }
+ }
+ if ($params['type'] == 3) {
+ unset($params['type']);
+ $find = Db::table('fa_szxc_information_insurance')->where('user_id', $params['user_id'])->find();
+ if ($find) {
+ $res = Db::table('fa_szxc_information_insurance')->where('id', $find['id'])->update($params);
+ } else {
+ $res = Db::table('fa_szxc_information_insurance')->where('user_id', $params['user_id'])->insert($params);
+ }
+ if ($res) {
+ return to_assign(0, '操作成功');
+ } else {
+ return to_assign(1, '操作失败');
+ }
+ }
+ if ($params['type'] == 4) {
+ unset($params['type']);
+ $find = Db::table('fa_szxc_information_healthy')->where('user_id', $params['user_id'])->find();
+ if ($find) {
+ $res = Db::table('fa_szxc_information_healthy')->where('id', $find['id'])->update($params);
+ } else {
+ $res = Db::table('fa_szxc_information_healthy')->where('user_id', $params['user_id'])->insert($params);
+ }
+ if ($res) {
+ return to_assign(0, '操作成功');
+ } else {
+ return to_assign(1, '操作失败');
+ }
+ }
+ }
+ /**
+ * 查看信息
+ */
+ public function read()
+ {
+ $params = get_params();
+ $find = Db::table('fa_szxc_information_usermsg')
+ ->withAttr('gender', function ($value, $data) {
+ if ($value == 1) {
+ return '男';
+ }
+ return '女';
+ })->withAttr('education', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('nation', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('political_outlook', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('house_msg', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('car_msg', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('marital_status', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })
+ ->where('user_id', $params['id'])->find();
+ //家庭信息
+ if ($find == null || $find['householder_id'] == 0) {
+ $family = [];
+ } else {
+ if ($find['householder_id'] == $find['user_id']) {
+ $family['name'] = '本人';
+ } else {
+ $family['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $find['householder_id'])->value('name');
+ $family['relation'] = Db::table('fa_category')->where('id', $find['family_relation'])->value('name');
+ }
+ $family['list'] = Db::table('fa_szxc_information_usermsg')->where('householder_id', $find['householder_id'])->where('user_id', '<>', $find['householder_id'])->field('user_id,name,age,gender,phone')->select();
+ }
+ //种植信息
+ if ($find || $find['householder_id'] == $params['id']) {
+ $Planting['is'] = 1;
+ $Planting['list'] = [];
+ $finds = Db::table('fa_szxc_information_planting')->where('user_id', $params['id'])
+ ->withAttr('crops_msg', function ($value, $data) {
+ return json_decode($value, true);
+ })
+ ->withAttr('breed_msg', function ($value, $data) {
+ return json_decode($value, true);
+ })
+ ->withAttr('tools_msg', function ($value, $data) {
+ return json_decode($value, true);
+ })
+ ->withAttr('nature_of_land', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })
+ ->withAttr('is_wz', function ($value, $data) {
+ return $value == 0 ? '否' : '是';
+ })
+ ->find();
+ if ($find) {
+ $Planting['list'] = $finds;
+ }
+ } else {
+ $Planting['is'] = 0;
+ }
+ $insurancearr = Db::table('fa_szxc_information_insurance')
+ ->withAttr('endowment_insurance_status', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('insurance_type', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('whether_disabled', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('disability_level', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('ny_insurance', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('sy_insurance', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })
+ ->where('user_id', $params['id'])->find();
+ $healthyarr = Db::table('fa_szxc_information_healthy')
+ ->withAttr('blood_type', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('drug_allergy', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('exposure_history', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('history_of_disease', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('history_of_surgery', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('family_history', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('familial_diseases', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('genetic_history', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('cfpfss', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('fuel_type', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('drinking_water', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('toilet_msg', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('poultry_corral', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })->withAttr('genetic_name', function ($value, $data) {
+ return Db::table('fa_category')->where('id', $value)->value('name');
+ })
+ ->where('user_id', $params['id'])->find();
+
+ View::assign('id', $params['id']);
+ View::assign('read', $find);
+ View::assign('family', $family);
+ View::assign('planting', $Planting);
+ View::assign('insurancearr', $insurancearr);
+ View::assign('healthyarr', $healthyarr);
+ return view();
+ }
+
+ public function auths()
+ {
+ $params = get_params();
+ if (request()->isPost()) {
+ $admin = Db::name('Admin')->where('user_id', $params['id'])->find();
+ $user = Db::table('fa_user')->where('id', $params['id'])->find();
+
+ if ($params['village_id'] != '') {
+ $village = Db::table('fa_geo_village')->where('village_code', $params['village_id'])->find();
+ }
+ // 组装地址名
+ if ($params['area_id'] != '') {
+ $area_name = Db::table('fa_geo_area')->where('area_code', $params['area_id'])->value('area_name');
+ }
+ if ($params['street_id'] != '') {
+ $street_name = Db::table('fa_geo_street')->where('street_code', $params['street_id'])->value('street_name');
+ }
+ if ($params['brigade_id'] != '') {
+ $brigade_name = Db::table('fa_geo_brigade')->where('id', $params['brigade_id'])->value('brigade_name');
+ }
+ $address_name = $area_name . $street_name . $village['village_name'] . $brigade_name;
+
+ if ($admin) {
+ Db::startTrans();
+ try {
+ if ($params['groupdata'] == 0) {
+ Db::name('admin_group_access')->where('uid', $admin['id'])->delete();
+ Db::name('Admin')->where('id', $admin['id'])->update(['status' => 0]);
+ } else {
+ $is_have_admin = Db::name('admin_group_access')->where('uid', $admin['id'])->find();
+ if ($is_have_admin) {
+ Db::name('admin_group_access')->where('uid', $admin['id'])->update(['group_id' => $params['groupdata']]);
+ } else {
+ $group_access2 = ['uid' => $admin['id'], 'group_id' => $params['groupdata']];
+ //写入权限组
+ Db::name('admin_group_access')->insert($group_access2);
+ }
+ Db::name('Admin')->where('id', $admin['id'])->update(['status' => 1]);
+ }
+ $useraddress = [
+ 'area_id' => $params['area_id'],
+ 'street_id' => $params['street_id'],
+ 'village_code' => $params['village_id'],
+ 'brigade_id' => $params['brigade_id'],
+ 'auth_range' => $params['auth_range'],
+ 'village_id' => $params['village_id'] != '' ? $village['village_id'] : 0,
+ 'admin_id' => $admin['id'],
+ ];
+ Db::table('fa_szxc_information_useraddress')->where('user_id', $params['id'])->update($useraddress);
+ // 修改user表
+ $ddd['is_admin'] = 1;
+ $ddd['group_id'] = $params['group_id'];
+ Db::table('fa_user')->where('id', $params['id'])->update($ddd);
+
+ // 修改商城关系表
+ $nk_user['n_user_id'] = $params['id'];
+ $is_nk_user = Db::connect('shop')->name('nk_user')->where($nk_user)->find();
+ if ($is_nk_user) {
+ $nk_data['group_id'] = $params['group_id'];
+ Db::connect('shop')->name('nk_user')->where($nk_user)->update($nk_data);
+ }
+
+ // 修改用户详细地址
+ $u_msg['address_name'] = $address_name;
+ $u_msg['area_id'] = $params['area_id'];
+ $u_msg['street_id'] = $params['street_id'];
+ $u_msg['village_id'] = $params['village_id'] != '' ? $village['village_id'] : 0;
+ $u_msg['brigade_id'] = $params['brigade_id'];
+ Db::table('fa_szxc_information_usermsg')->where('user_id', $params['id'])->update($u_msg);
+ // 提交事务
+ Db::commit();
+ } catch (\Exception $e) {
+ // 回滚事务
+ Db::rollback();
+ return to_assign(1, '操作失败,原因:' . $e->getMessage());
+ }
+ return to_assign(0, '操作成功');
+ } else {
+ $salt = set_salt(20);
+ $data = [
+ 'user_id' => $params['id'],
+ 'username' => $user['username'],
+ 'nickname' => $user['nickname'],
+ 'thumb' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230104/32a639be4ee32349705e947fbbd1e114.png',
+ 'mobile' => 13688888886,
+ 'did' => 1,
+ 'position_id' => 3,
+ 'salt' => $salt,
+ 'pwd' => set_password(123456, $salt),
+ 'email' => '',
+ ];
+ Db::startTrans();
+ try {
+ $w['user_id'] = $params['id'];
+ $is_have = Db::table('fa_szxc_information_useraddress')->where($w)->find();
+ // 创建管理员账号
+ $admin_id = Db::name('Admin')->insertGetId($data);
+ // 写入权限组
+ Db::name('AdminGroupAccess')->strict(false)->field(true)->insert([
+ 'uid' => $admin_id,
+ 'group_id' => $params['group_id'],
+ ]);
+ add_log('add', $this->adminInfo['id'], $params);
+ // Db::table('fa_auth_group_access')->insert($group_access);
+ // 修改user表
+ $ddd['is_admin'] = 1;
+ $ddd['group_id'] = $params['group_id'];
+ Db::table('fa_user')->where('id', $params['id'])->update($ddd);
+
+ // 修改商城关系表
+ $nk_user['n_user_id'] = $params['id'];
+ $is_nk_user = Db::connect('shop')->name('nk_user')->where($nk_user)->find();
+ if ($is_nk_user) {
+ $nk_data['group_id'] = $params['group_id'];
+ Db::connect('shop')->name('nk_user')->where($nk_user)->update($nk_data);
+ }
+
+ if ($is_have) {
+ $useraddress = [
+ 'user_id' => $params['id'],
+ 'admin_id' => $admin_id,
+ 'area_id' => $params['area_id'],
+ 'street_id' => $params['street_id'],
+ 'village_code' => $params['village_id'],
+ 'village_id' => $village['village_id'],
+ 'brigade_id' => $params['brigade_id'],
+ 'auth_range' => $params['auth_range'],
+ ];
+ Db::table('fa_szxc_information_useraddress')->where($w)->update($useraddress);
+ } else {
+ $useraddress = [
+ 'user_id' => $params['id'],
+ 'admin_id' => $admin_id->id,
+ 'area_id' => $params['area_id'],
+ 'street_id' => $params['street_id'],
+ 'village_code' => $params['village_id'],
+ 'village_id' => $village['village_id'],
+ 'brigade_id' => $params['brigade_id'],
+ 'auth_range' => $params['auth_range'],
+ 'createtime' => date('Y-m-d H:i:s')
+ ];
+ Db::table('fa_szxc_information_useraddress')->insert($useraddress);
+ }
+
+ // 修改用户详细地址
+ $u_msg['address_name'] = $address_name;
+ $u_msg['area_id'] = $params['area_id'];
+ $u_msg['street_id'] = $params['street_id'];
+ $u_msg['village_id'] = $params['village_id'] != '' ? $village['village_id'] : 0;
+ $u_msg['brigade_id'] = $params['brigade_id'];
+ Db::table('fa_szxc_information_usermsg')->where('user_id', $params['id'])->update($u_msg);
+
+ // 提交事务
+ Db::commit();
+ } catch (\Exception $e) {
+ // 回滚事务
+ Db::rollback();
+ return to_assign(1, '操作失败,原因:' . $e->getMessage());
+ }
+ return to_assign(0, '操作成功');
+ }
+ }
+
+ $user = Db::table('fa_user')->where('id', $params['id'])->field('id,nickname,group_id')->find();
+
+ // $geo_brigade = Db::table('fa_geo_brigade')->select();
+
+ $useraddress = [
+ 'area_id' => 0,
+ 'street_id' => 0,
+ 'village_id' => 0,
+ 'village_code' => 0,
+ 'brigade_id' => 0,
+ 'admin_group' => 0,
+ 'auth_range' => 1,
+ ];
+ $address = Db::table('fa_szxc_information_useraddress')->where('user_id', $params['id'])->find();
+ if ($address) {
+ $useraddress['area_id'] = $address['area_id'];
+ $useraddress['street_id'] = $address['street_id'];
+ $useraddress['village_id'] = $address['village_id'];
+ $useraddress['brigade_id'] = $address['brigade_id'];
+ $useraddress['village_code'] = $address['village_code'];
+ $useraddress['auth_range'] = $address['auth_range'];
+ $admin = Db::name('admin_group_access')->where('uid', $address['admin_id'])->find();
+ if ($admin) {
+ $useraddress['admin_group'] = $admin['group_id'];
+ }
+ }
+ //权限组信息
+ $groupwhere[] = ['id', 'in', 2, 4];
+ if ($this->adminInfo['position_id'] != 1) { //不是超级管理员
+ // $www['admin_id'] = $this->adminInfo['id'];
+ // $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
+ // if ($user_address) {
+ if ($this->adminInfo['group_access'] == 2) {
+ $auth_range = [['name' => '村级', 'value' => '1']];
+ $groupwhere[] = ['id', 'in', 2];
+ }
+ if ($this->adminInfo['group_access'] == 4) {
+ $auth_range = [['name' => '村级', 'value' => '1'], ['name' => '乡镇', 'value' => '2']];
+ }
+ // if ($user_address['auth_range'] == 3) {
+ // $auth_range = [['name' => '村级', 'value' => '1'], ['name' => '乡镇', 'value' => '2'], ['name' => '区县', 'value' => '3']];
+ // }
+ // if ($user_address['auth_range'] == 4) {
+ // $auth_range = [['name' => '村级', 'value' => '1'], ['name' => '乡镇', 'value' => '2'], ['name' => '区县', 'value' => '3'], ['name' => '市级', 'value' => '4']];
+ // }
+ // }
+ } else {
+ $auth_range = [['name' => '村级', 'value' => '1'], ['name' => '乡镇', 'value' => '2'], ['name' => '区县', 'value' => '3'], ['name' => '市级', 'value' => '4']];
+ }
+ $street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
+ ->field('area_id id,area_code code,area_name name')
+ ->select();
+ $brigade = Db::table('fa_geo_brigade')
+ ->limit(30)
+ ->select();
+ //后端权限
+ $groupdata = Db::name('admin_group')
+ ->where($groupwhere)
+ ->limit(30)
+ ->select();
+ $groupdata[] = ['id' => 0, 'title' => '无后台权限'];
+ //前端权限
+ $user_group = Db::table('fa_user_group')
+ ->limit(30)
+ ->select();
+ View::assign('id', $params['id']);
+ View::assign('user_group', $user_group);
+ View::assign('groupdata', $groupdata);
+ View::assign('street', $street);
+ View::assign('brigade', $brigade);
+ View::assign('auth_range', $auth_range);
+ View::assign('user', $user);
+ View::assign('address', $useraddress);
+ View::assign('url', $this->url);
+ View::assign('editor', get_system_config('other', 'editor'));
+
+ return view();
+ }
+ public function tongji()
+ {
+ $post = get_params();
+ $where = [];
+ //权限组信息
+ $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->adminInfo['user_id'])->find();
+ if ($find) {
+ if ($find['auth_range'] == 1) {
+ $where['village_id'] = $find['village_id'];
+ } elseif ($find['auth_range'] == 2) {
+ $where['street_id'] = $find['street_id'];
+ } elseif ($find['auth_range'] == 3) {
+ $where['area_id'] = $find['area_id'];
+ }
+ }
+
+ if ($post['village_id'] != '') {
+ $where['village_id'] = $post['village_id'];
+ }
+ if ($post['brigade_id'] != '') {
+ $where['brigade_id'] = $post['brigade_id'];
+ }
+ if ($post['street_id'] != '') {
+ $where['street_id'] = $post['street_id'];
+ }
+ $where['area_id'] = $post['area_id'];
+ // 大于60岁人数
+ $old_num = Db::table('fa_szxc_information_usermsg')->where($where)->whereAge('>=', 60)->count();
+ // 儿童人数
+ $children_num = Db::table('fa_szxc_information_usermsg')->where($where)->whereAge('<', 15)->count();
+ // 未婚男
+ $unmarried_man_num = Db::table('fa_szxc_information_usermsg')->where($where)->where([['gender', '=', 1], ['marital_status', '=', 169]])->count();
+ // 未婚女
+ $unmarried_woman_num = Db::table('fa_szxc_information_usermsg')->where($where)->where([['gender', '=', 2], ['marital_status', '=', 169]])->count();
+
+ $land_area_num = Db::table('fa_szxc_information_useraddress')
+ ->alias('u')
+ ->where($where)
+ ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.land_area');
+
+ $sum_218 = Db::table('fa_szxc_information_useraddress')
+ ->alias('u')
+ ->where($where)
+ ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=218')->sum('p.land_area');
+ $sum_217 = Db::table('fa_szxc_information_useraddress')
+ ->alias('u')
+ ->where($where)
+ ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=217')->sum('p.land_area');
+ $sum_216 = Db::table('fa_szxc_information_useraddress')
+ ->alias('u')
+ ->where($where)
+ ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=216')->sum('p.land_area');
+ $sum_215 = Db::table('fa_szxc_information_useraddress')
+ ->alias('u')
+ ->where($where)
+ ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=215')->sum('p.land_area');
+ $sum_214 = Db::table('fa_szxc_information_useraddress')
+ ->alias('u')
+ ->where($where)
+ ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=214')->sum('p.land_area');
+ $sum_70 = Db::table('fa_szxc_information_useraddress')
+ ->alias('u')
+ ->where($where)
+ ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=70')->sum('p.land_area');
+ $sum_69 = Db::table('fa_szxc_information_useraddress')
+ ->alias('u')
+ ->where($where)
+ ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.land_area');
+ $result = [
+ 'old_num' => $old_num,
+ 'children_num' => $children_num,
+ 'unmarried_man_num' => $unmarried_man_num,
+ 'unmarried_woman_num' => $unmarried_woman_num,
+ 'land_area_num' => $land_area_num,
+ 'sum_218' => $sum_218,
+ 'sum_217' => $sum_217,
+ 'sum_216' => $sum_216,
+ 'sum_215' => $sum_215,
+ 'sum_214' => $sum_214,
+ 'sum_70' => $sum_70,
+ 'sum_69' => $sum_69,
+
+ ];
+ $result = ['total' => 0, 'data' => $result];
+ return table_assign(0, '', $result);
+ }
+ /**
+ * 修改
+ */
+ public function del()
+ {
+ $params = get_params();
+ (new Article())->del($params);
+ }
+}
diff --git a/app/admin/validate/nk/ArticleValidate.php b/app/admin/validate/nk/ArticleValidate.php
new file mode 100644
index 0000000..c13f934
--- /dev/null
+++ b/app/admin/validate/nk/ArticleValidate.php
@@ -0,0 +1,26 @@
+ 'require',
+ 'title' => 'require',
+ // 'thumb' => 'require',
+ 'content' => 'require',
+];
+
+ protected $message = [
+ // 'cate_id.require' => '所属分类不能为空',
+ 'title.require' => '文章标题不能为空',
+ // 'thumb.require' => '缩略图不能为空',
+ 'content.require' => '文章内容不能为空',
+];
+}
\ No newline at end of file
diff --git a/app/admin/view/nk/article/index.html b/app/admin/view/nk/article/index.html
index a79a04f..65b9c11 100644
--- a/app/admin/view/nk/article/index.html
+++ b/app/admin/view/nk/article/index.html
@@ -5,7 +5,7 @@
@@ -21,7 +21,7 @@
@@ -53,7 +53,22 @@
field: 'id',
title: '编号',
align: 'center',
- width: 80
+ width:120,
+ },{
+ field: 'area',
+ title: '区县',
+ align: 'center',
+ width:120,
+ },{
+ field: 'street',
+ title: '乡镇',
+ align: 'center',
+ width:120,
+ },{
+ field: 'village',
+ title: '街道/村',
+ align: 'center',
+ width:120,
},{
field: 'title',
title: '文章标题',
@@ -61,33 +76,15 @@
field: 'nickname',
title: '用户',
align: 'center',
- width: 90
- },{
- field: 'area',
- title: '区县',
- align: 'center',
- width: 90
- },{
- field: 'street',
- title: '乡镇',
- align: 'center',
- width: 90
- },{
- field: 'village',
- title: '街道/村',
- align: 'center',
- width: 90
},{
field: 'view_time',
title: '发布时间',
align: 'center',
- width: 160
},{
fixed: 'right',
field: 'right',
title: '操作',
toolbar: '#barDemo',
- width: 136,
align: 'center'
}
]
diff --git a/app/admin/view/nk/user/add.html b/app/admin/view/nk/user/add.html
new file mode 100644
index 0000000..b2ce05d
--- /dev/null
+++ b/app/admin/view/nk/user/add.html
@@ -0,0 +1,102 @@
+{extend name="common/base"/}
+{block name="style"}
+
+{/block}
+
+{block name="body"}
+
+{/block}
+
+
+
+{block name="script"}
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/user/auths.html b/app/admin/view/nk/user/auths.html
new file mode 100644
index 0000000..f72951e
--- /dev/null
+++ b/app/admin/view/nk/user/auths.html
@@ -0,0 +1,217 @@
+{extend name="common/base"/}
+{block name="style"}
+
+{/block}
+
+{block name="body"}
+
+
+
+
+
+
+{/block}
+
+
+
+{block name="script"}
+
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/user/edit.html b/app/admin/view/nk/user/edit.html
new file mode 100644
index 0000000..bb68706
--- /dev/null
+++ b/app/admin/view/nk/user/edit.html
@@ -0,0 +1,566 @@
+{extend name="common/base"/}
+{block name="style"}
+
+{/block}
+
+{block name="body"}
+