diff --git a/app/admin/controller/nk/party/Article.php b/app/admin/controller/nk/party/Article.php
new file mode 100644
index 0000000..1ab85ec
--- /dev/null
+++ b/app/admin/controller/nk/party/Article.php
@@ -0,0 +1,174 @@
+adminInfo = get_login_admin();
+ $this->url=[
+ '/admin/nk.party.article/index',
+ '/admin/nk.party.article/add',
+ '/admin/nk.party.article/edit',
+ '/admin/nk.party.article/del',
+ '/admin/nk.party.article/read',
+ ];
+ }
+
+
+ public function index()
+ {
+ if (request()->isAjax()) {
+ $params= get_params();
+ $where['status']=1;
+ if (isset($params['keywords'])){
+ $where[]=['title','like','%'.$params['keywords'].'%'];
+ }
+ 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){
+ $where['village'] = $user_address['village_id'];
+ }elseif ($user_address['auth_range'] == 2){
+ $where['township'] = $user_address['street_id'];
+ }elseif ($user_address['auth_range'] == 3){
+ $where['county'] = $user_address['area_id'];
+ }else{
+ $where['village'] = $user_address['village_id'];
+ }
+ }else{
+ $where['village'] = '';
+ }
+ }
+
+ $total = Db::table('fa_szxc_party_article')
+ ->where($where)
+ ->count();
+ $list = Db::table('fa_szxc_party_article')
+ ->withAttr('nickname',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name');
+ })
+ ->withAttr('area',function ($value,$data){
+ return Db::table('fa_geo_area')->where('area_code',$data['county'])->value('area_name');
+ })
+ ->withAttr('street',function ($value,$data){
+ return Db::table('fa_geo_street')->where('street_code',$data['township'])->value('street_name');
+ })
+ ->withAttr('village',function ($value,$data){
+ return Db::table('fa_geo_village')->where('village_id',$data['village'])->value('village_name');
+ })
+ ->where($where)
+ ->page($params['page'])
+ ->limit($params['limit'])
+ ->order('id desc')
+ ->field('id,title,user_id,county,township,village,image,view_time')
+ ->select();
+ $result = ['total' => $total, 'data' => $list];
+ return table_assign(0, '', $result);
+ }
+ else{
+ return view('nk/party/article/index',['url'=>$this->url]);
+ }
+ }
+
+ public function add(){
+ if (request()->isAjax()) {
+ $param= get_params();
+ // 检验完整性
+ try {
+ validate(\app\admin\validate\nk\ArticleValidate::class)->check($param);
+ } catch (ValidateException $e) {
+ // 验证失败 输出错误信息
+ return to_assign(1, $e->getError());
+ }
+ $adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
+ $param['view_time']=date('Y-m-d H:i:s');
+ $param['county']=$adds['area_id'];
+ $param['township']=$adds['street_id'];
+ $param['village']=$adds['village_id'];
+ $param['user_id']=$adds['user_id'];
+ $res=Db::table('fa_szxc_party_article')->strict(false)->field(true)->insertGetId($param);
+ if ($res){
+ return to_assign(0,'操作成功',['aid'=>$res]);
+ }
+ return to_assign(1, '操作失败,原因:'.$res);
+ }else{
+ View::assign('editor', get_system_config('other','editor'));
+ return view();
+ }
+ }
+
+
+ public function edit(){
+ $param= get_params();
+ if (request()->isAjax()) {
+ try {
+ validate(\app\admin\validate\nk\ArticleValidate::class)->check($param);
+ } catch (ValidateException $e) {
+ // 验证失败 输出错误信息
+ return to_assign(1, $e->getError());
+ }
+ $res=Db::table('fa_szxc_party_article')->where('id',$param['id'])->strict(false)->field(true)->update($param);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }else{
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_article')->where('id',$id)->find();
+ View::assign('editor', get_system_config('other','editor'));
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ }
+ /**
+ * 查看信息
+ */
+ public function read()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_article')->where('id',$id)->find();
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $type = isset($param['type']) ? $param['type'] : 0;
+ $res = Db::table('fa_szxc_party_article')->where('id',$id)->update(['status'=>$type]);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }
+}
diff --git a/app/admin/controller/nk/party/Branch.php b/app/admin/controller/nk/party/Branch.php
new file mode 100644
index 0000000..29f1dcb
--- /dev/null
+++ b/app/admin/controller/nk/party/Branch.php
@@ -0,0 +1,172 @@
+adminInfo = get_login_admin();
+ $this->url=[
+ '/admin/nk.party.branch/index',
+ '/admin/nk.party.branch/add',
+ '/admin/nk.party.branch/edit',
+ '/admin/nk.party.branch/del',
+ '/admin/nk.party.branch/read',
+ ];
+// 获取用户信息
+ $this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
+ }
+ /**
+ * 数据列表
+ */
+ public function index()
+ {
+ if (request()->isAjax()) {
+ $params= get_params();
+ $where['status']=1;
+ if (isset($params['keywords'])){
+ $where[]=['title','like','%'.$params['keywords'].'%'];
+ }
+ 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){
+ $where['village'] = $user_address['village_id'];
+ }elseif ($user_address['auth_range'] == 2){
+ $where['township'] = $user_address['street_id'];
+ }elseif ($user_address['auth_range'] == 3){
+ $where['county'] = $user_address['area_id'];
+ }else{
+ $where['village'] = $user_address['village_id'];
+ }
+ }else{
+ $where['village'] = '';
+ }
+ }
+
+ $total = Db::table('fa_szxc_party_branch')
+ ->where($where)
+ ->count();
+ $list = Db::table('fa_szxc_party_branch')
+ ->withAttr('nickname',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name');
+ })
+ ->withAttr('nickname2',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['two_user_id'])->value('name');
+ })
+ ->withAttr('area',function ($value,$data){
+ return Db::table('fa_geo_area')->where('area_code',$data['county'])->value('area_name');
+ })
+ ->withAttr('street',function ($value,$data){
+ return Db::table('fa_geo_street')->where('street_code',$data['township'])->value('street_name');
+ })
+ ->withAttr('village',function ($value,$data){
+ return Db::table('fa_geo_village')->where('village_id',$data['village'])->value('village_name');
+ })
+ ->where($where)
+ ->page($params['page'])
+ ->limit($params['limit'])
+ ->order('id desc')
+ ->select();
+ $result = ['total' => $total, 'data' => $list];
+ return table_assign(0, '', $result);
+ }
+ else{
+ return view('nk/party/branch/index',['url'=>$this->url]);
+ }
+ }
+
+ public function add(){
+ if (request()->isAjax()) {
+ $param= get_params();
+ $adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
+ $param['county']=$adds['area_id'];
+ $param['township']=$adds['street_id'];
+ $param['village']=$adds['village_id'];
+ $res=Db::table('fa_szxc_party_branch')->strict(false)->field(true)->insertGetId($param);
+ if ($res){
+ return to_assign(0,'操作成功',['aid'=>$res]);
+ }
+ return to_assign(1, '操作失败,原因:'.$res);
+ }else{
+ View::assign('editor', get_system_config('other','editor'));
+ View::assign('users', $this->users);
+ return view();
+ }
+ }
+
+
+ public function edit(){
+ $param= get_params();
+ if (request()->isAjax()) {
+ $res=Db::table('fa_szxc_party_branch')->where('id',$param['id'])->strict(false)->field(true)->update($param);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }else{
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_branch')->where('id',$id)->find();
+ View::assign('editor', get_system_config('other','editor'));
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ View::assign('users', $this->users);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ }
+ /**
+ * 查看信息
+ */
+ public function read()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_branch')->where('id',$id)->find();
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ View::assign('users', $this->users);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $type = isset($param['type']) ? $param['type'] : 0;
+ $res = Db::table('fa_szxc_party_branch')->where('id',$id)->update(['status'=>$type]);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }
+
+
+}
diff --git a/app/admin/controller/nk/party/BranchPayList.php b/app/admin/controller/nk/party/BranchPayList.php
new file mode 100644
index 0000000..bc50c8d
--- /dev/null
+++ b/app/admin/controller/nk/party/BranchPayList.php
@@ -0,0 +1,101 @@
+model = new \app\admin\model\party\BranchPayList;
+
+ }
+
+ /**
+ * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+ * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+ * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+ */
+ /**
+ * 查看
+ */
+ public function index()
+ {
+
+ //设置过滤方法
+ $this->request->filter(['strip_tags']);
+ if ($this->request->isAjax()) {
+// dump();die;
+ //如果发送的来源是Selectpage,则转发到Selectpage
+ if ($this->request->request('keyField')) {
+ return $this->selectpage();
+ }
+ [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+
+ //权限组信息
+ $getGroups = $this->auth->getGroups();
+ if($getGroups[0]['pid'] != 0){ //不是超级管理员
+ $userInfo = $this->auth->getUserinfo();
+ $admin_id = $userInfo['id'];
+ $www['admin_id'] = $admin_id;
+ $user_address = Db::name('szxc_information_useraddress')->where($www)->find();
+ if ($user_address){
+ if($user_address['auth_range'] == 1){
+ $where['village'] = $user_address['village_id'];
+ }elseif ($user_address['auth_range'] == 2){
+ $where['township'] = $user_address['street_id'];
+ }elseif ($user_address['auth_range'] == 3){
+ $where['county'] = $user_address['area_id'];
+ }elseif ($user_address['auth_range'] == 4){
+
+ }else{
+ $where['village'] = $user_address['village_id'];
+ }
+ }else{
+ $where['village'] = '';
+ }
+ }
+
+ $total = $this->model
+ ->with(['usermsg','area','street','village'])
+ ->where($where)
+ ->order($sort, $order)
+ ->count();
+
+ $list = $this->model
+ ->with(['usermsg','area','street','village'])
+ ->where($where)
+ ->order($sort, $order)
+ ->limit($offset, $limit)
+ ->select();
+ $list = $list->toArray();
+ if ($list){
+ foreach ($list as $k=>$v){
+ $list[$k]['branch_id'] = Db::name('szxc_party_branch')->where('id',$v['branch_id'])->value('name');
+ }
+ }
+ $result = ['total' => $total, 'rows' => $list];
+
+ return json($result);
+ }
+
+ return $this->view->fetch();
+ }
+
+
+}
diff --git a/app/admin/controller/nk/party/BranchPayUser.php b/app/admin/controller/nk/party/BranchPayUser.php
new file mode 100644
index 0000000..4b62174
--- /dev/null
+++ b/app/admin/controller/nk/party/BranchPayUser.php
@@ -0,0 +1,103 @@
+model = new \app\admin\model\party\BranchPayUser;
+
+ }
+
+ /**
+ * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+ * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+ * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+ */
+
+ /**
+ * 查看
+ */
+ public function index()
+ {
+
+ //设置过滤方法
+ $this->request->filter(['strip_tags']);
+ if ($this->request->isAjax()) {
+// dump();die;
+ //如果发送的来源是Selectpage,则转发到Selectpage
+ if ($this->request->request('keyField')) {
+ return $this->selectpage();
+ }
+ [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+
+ //权限组信息
+ $getGroups = $this->auth->getGroups();
+ if($getGroups[0]['pid'] != 0){ //不是超级管理员
+ $userInfo = $this->auth->getUserinfo();
+ $admin_id = $userInfo['id'];
+ $www['admin_id'] = $admin_id;
+ $user_address = Db::name('szxc_information_useraddress')->where($www)->find();
+ if ($user_address){
+ if($user_address['auth_range'] == 1){
+ $where['village'] = $user_address['village_id'];
+ }elseif ($user_address['auth_range'] == 2){
+ $where['township'] = $user_address['street_id'];
+ }elseif ($user_address['auth_range'] == 3){
+ $where['county'] = $user_address['area_id'];
+ }elseif ($user_address['auth_range'] == 4){
+
+ }else{
+ $where['village'] = $user_address['village_id'];
+ }
+ }else{
+ $where['village'] = '';
+ }
+ }
+
+ $total = $this->model
+ ->with(['usermsg','area','street','village'])
+ ->where($where)
+ ->order($sort, $order)
+ ->count();
+
+ $list = $this->model
+ ->with(['usermsg','area','street','village'])
+ ->where($where)
+ ->order($sort, $order)
+ ->limit($offset, $limit)
+ ->select();
+ $list = $list->toArray();
+ if ($list){
+ foreach ($list as $k=>$v){
+ $list[$k]['branch_id'] = Db::name('szxc_party_branch')->where('id',$v['branch_id'])->value('name');
+ }
+ }
+ $result = ['total' => $total, 'rows' => $list];
+
+ return json($result);
+ }
+
+ return $this->view->fetch();
+ }
+
+
+
+}
diff --git a/app/admin/controller/nk/party/Info.php b/app/admin/controller/nk/party/Info.php
new file mode 100644
index 0000000..da91572
--- /dev/null
+++ b/app/admin/controller/nk/party/Info.php
@@ -0,0 +1,211 @@
+adminInfo = get_login_admin();
+ $this->url=[
+ '/admin/nk.party.info/index',
+ '/admin/nk.party.info/add',
+ '/admin/nk.party.info/edit',
+ '/admin/nk.party.info/del',
+ '/admin/nk.party.info/read',
+ ];
+// 获取用户信息
+ $this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
+ $this->party_branch = Db::table('fa_szxc_party_branch')->where('status',1)->field('id,name')->select();
+ }
+ /**
+ * 数据列表
+ */
+ public function index()
+ {
+ if (request()->isAjax()) {
+ $params= get_params();
+ $where['status']=1;
+ if (isset($params['keywords'])){
+ $where[]=['title','like','%'.$params['keywords'].'%'];
+ }
+ 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){
+ $where['village'] = $user_address['village_id'];
+ }elseif ($user_address['auth_range'] == 2){
+ $where['township'] = $user_address['street_id'];
+ }elseif ($user_address['auth_range'] == 3){
+ $where['county'] = $user_address['area_id'];
+ }else{
+ $where['village'] = $user_address['village_id'];
+ }
+ }else{
+ $where['village'] = '';
+ }
+ }
+
+ $total = Db::table('fa_szxc_party_info')
+ ->where($where)
+ ->count();
+ $list = Db::table('fa_szxc_party_info')
+ ->withAttr('name',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name');
+ })
+ ->withAttr('nation',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('nation');
+ })
+ ->withAttr('political_outlook',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('political_outlook');
+ })
+ ->withAttr('phone',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('phone');
+ })
+ ->withAttr('marital_status',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('marital_status');
+ })
+ ->withAttr('idcard',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('idcard');
+ })
+ ->withAttr('sex',function ($value,$data){
+ $sex = Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('gender');
+ if($sex == 1){
+ return '男';
+ }elseif ($sex == 2){
+ return '女';
+ }else{
+ return '';
+ }
+ })
+ ->withAttr('age',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('age');
+ })
+ ->withAttr('area',function ($value,$data){
+ return Db::table('fa_geo_area')->where('area_code',$data['county'])->value('area_name');
+ })
+ ->withAttr('street',function ($value,$data){
+ return Db::table('fa_geo_street')->where('street_code',$data['township'])->value('street_name');
+ })
+ ->withAttr('village',function ($value,$data){
+ return Db::table('fa_geo_village')->where('village_id',$data['village'])->value('village_name');
+ })
+ ->withAttr('party_branch',function ($value,$data){
+ return Db::table('fa_szxc_party_branch')->where('id',$data['party_branch'])->value('name');
+ })
+ ->withAttr('status',function ($value,$data){
+ if($value == 1){
+ return '正常';
+ }else{
+ return '禁用';
+ }
+ })
+ ->where($where)
+ ->page($params['page'])
+ ->limit($params['limit'])
+ ->order('id desc')
+ ->select();
+ $result = ['total' => $total, 'data' => $list];
+ return table_assign(0, '', $result);
+ }
+ else{
+ return view('nk/party/info/index',['url'=>$this->url]);
+ }
+ }
+
+ public function add(){
+ if (request()->isAjax()) {
+ $param= get_params();
+ $adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
+ $param['county']=$adds['area_id'];
+ $param['township']=$adds['street_id'];
+ $param['village']=$adds['village_id'];
+ $res=Db::table('fa_szxc_party_info')->strict(false)->field(true)->insertGetId($param);
+ if ($res){
+ return to_assign(0,'操作成功',['aid'=>$res]);
+ }
+ return to_assign(1, '操作失败,原因:'.$res);
+ }else{
+ View::assign('editor', get_system_config('other','editor'));
+ View::assign('users', $this->users);
+ View::assign('party_branch', $this->party_branch);
+ return view();
+ }
+ }
+
+
+ public function edit(){
+ $param= get_params();
+ if (request()->isAjax()) {
+ $res=Db::table('fa_szxc_party_info')->where('id',$param['id'])->strict(false)->field(true)->update($param);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }else{
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_info')->where('id',$id)->find();
+ View::assign('editor', get_system_config('other','editor'));
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ View::assign('users', $this->users);
+ View::assign('party_branch', $this->party_branch);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ }
+ /**
+ * 查看信息
+ */
+ public function read()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_info')->where('id',$id)->find();
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ View::assign('users', $this->users);
+ View::assign('party_branch', $this->party_branch);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $type = isset($param['type']) ? $param['type'] : 0;
+ $res = Db::table('fa_szxc_party_info')->where('id',$id)->update(['status'=>$type]);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }
+
+
+}
diff --git a/app/admin/controller/nk/party/Vote.php b/app/admin/controller/nk/party/Vote.php
new file mode 100644
index 0000000..c1300c2
--- /dev/null
+++ b/app/admin/controller/nk/party/Vote.php
@@ -0,0 +1,175 @@
+adminInfo = get_login_admin();
+ $this->url=[
+ '/admin/nk.party.vote/index',
+ '/admin/nk.party.vote/add',
+ '/admin/nk.party.vote/edit',
+ '/admin/nk.party.vote/del',
+ '/admin/nk.party.vote/read',
+ ];
+// 获取用户信息
+ $this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
+ }
+ /**
+ * 数据列表
+ */
+ public function index()
+ {
+ if (request()->isAjax()) {
+ $params= get_params();
+ $where['status']=1;
+ if (isset($params['keywords'])){
+ $where[]=['title','like','%'.$params['keywords'].'%'];
+ }
+ 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){
+ $where['village'] = $user_address['village_id'];
+ }elseif ($user_address['auth_range'] == 2){
+ $where['township'] = $user_address['street_id'];
+ }elseif ($user_address['auth_range'] == 3){
+ $where['county'] = $user_address['area_id'];
+ }else{
+ $where['village'] = $user_address['village_id'];
+ }
+ }else{
+ $where['village'] = '';
+ }
+ }
+
+ $total = Db::table('fa_szxc_party_vote')
+ ->where($where)
+ ->count();
+ $list = Db::table('fa_szxc_party_vote')
+ ->withAttr('name',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name');
+ })
+ ->withAttr('area',function ($value,$data){
+ return Db::table('fa_geo_area')->where('area_code',$data['county'])->value('area_name');
+ })
+ ->withAttr('street',function ($value,$data){
+ return Db::table('fa_geo_street')->where('street_code',$data['township'])->value('street_name');
+ })
+ ->withAttr('village',function ($value,$data){
+ return Db::table('fa_geo_village')->where('village_id',$data['village'])->value('village_name');
+ })
+ ->withAttr('status',function ($value,$data){
+ if($value == 1){
+ return '正常';
+ }else{
+ return '禁用';
+ }
+ })
+ ->where($where)
+ ->page($params['page'])
+ ->limit($params['limit'])
+ ->order('id desc')
+ ->select();
+ $result = ['total' => $total, 'data' => $list];
+ return table_assign(0, '', $result);
+ }
+ else{
+ return view('nk/party/vote/index',['url'=>$this->url]);
+ }
+ }
+
+ public function add(){
+ if (request()->isAjax()) {
+ $param= get_params();
+ $adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
+ $param['county']=$adds['area_id'];
+ $param['township']=$adds['street_id'];
+ $param['village']=$adds['village_id'];
+ $res=Db::table('fa_szxc_party_vote')->strict(false)->field(true)->insertGetId($param);
+ if ($res){
+ return to_assign(0,'操作成功',['aid'=>$res]);
+ }
+ return to_assign(1, '操作失败,原因:'.$res);
+ }else{
+ View::assign('editor', get_system_config('other','editor'));
+ View::assign('users', $this->users);
+ return view();
+ }
+ }
+
+
+ public function edit(){
+ $param= get_params();
+ if (request()->isAjax()) {
+ $res=Db::table('fa_szxc_party_vote')->where('id',$param['id'])->strict(false)->field(true)->update($param);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }else{
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_vote')->where('id',$id)->find();
+ View::assign('editor', get_system_config('other','editor'));
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ View::assign('users', $this->users);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ }
+ /**
+ * 查看信息
+ */
+ public function read()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_vote')->where('id',$id)->find();
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ View::assign('users', $this->users);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $type = isset($param['type']) ? $param['type'] : 0;
+ $res = Db::table('fa_szxc_party_vote')->where('id',$id)->update(['status'=>$type]);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }
+
+
+}
diff --git a/app/admin/controller/nk/party/VoteComment.php b/app/admin/controller/nk/party/VoteComment.php
new file mode 100644
index 0000000..2017371
--- /dev/null
+++ b/app/admin/controller/nk/party/VoteComment.php
@@ -0,0 +1,173 @@
+adminInfo = get_login_admin();
+ $this->url=[
+ '/admin/nk.party.votecomment/index',
+ '/admin/nk.party.votecomment/add',
+ '/admin/nk.party.votecomment/edit',
+ '/admin/nk.party.votecomment/del',
+ '/admin/nk.party.votecomment/read',
+ ];
+// 获取用户信息
+ $this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
+ $this->party_vote = Db::table('fa_szxc_party_vote')->where('status',1)->field('id,title')->select();
+ }
+ /**
+ * 数据列表
+ */
+ public function index()
+ {
+ if (request()->isAjax()) {
+ $params= get_params();
+ $where=[];
+ if (isset($params['keywords'])){
+ $where[]=['title','like','%'.$params['keywords'].'%'];
+ }
+ 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){
+ $where['village'] = $user_address['village_id'];
+ }elseif ($user_address['auth_range'] == 2){
+ $where['township'] = $user_address['street_id'];
+ }elseif ($user_address['auth_range'] == 3){
+ $where['county'] = $user_address['area_id'];
+ }else{
+ $where['village'] = $user_address['village_id'];
+ }
+ }else{
+ $where['village'] = '';
+ }
+ }
+
+ $total = Db::table('fa_szxc_party_vote_comment')
+ ->where($where)
+ ->count();
+ $list = Db::table('fa_szxc_party_vote_comment')
+ ->withAttr('name',function ($value,$data){
+ return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name');
+ })
+ ->withAttr('title',function ($value,$data){
+ return Db::table('fa_szxc_party_vote')->where('id',$data['vote_id'])->value('title');
+ })
+ ->withAttr('status',function ($value,$data){
+ if($value == 1){
+ return '通过';
+ }else{
+ return '不通过';
+ }
+ })
+ ->where($where)
+ ->page($params['page'])
+ ->limit($params['limit'])
+ ->order('id desc')
+ ->select();
+ $result = ['total' => $total, 'data' => $list];
+ return table_assign(0, '', $result);
+ }
+ else{
+ return view('nk/party/votecomment/index',['url'=>$this->url]);
+ }
+ }
+
+ public function add(){
+ if (request()->isAjax()) {
+ $param= get_params();
+ $adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
+ $param['add_time']= date('Y-m-d H:i:s');
+ $param['county']=$adds['area_id'];
+ $param['township']=$adds['street_id'];
+ $param['village']=$adds['village_id'];
+ $res=Db::table('fa_szxc_party_vote_comment')->strict(false)->field(true)->insertGetId($param);
+ if ($res){
+ return to_assign(0,'操作成功',['aid'=>$res]);
+ }
+ return to_assign(1, '操作失败,原因:'.$res);
+ }else{
+ View::assign('editor', get_system_config('other','editor'));
+ View::assign('users', $this->users);
+ View::assign('party_vote', $this->party_vote);
+ return view();
+ }
+ }
+
+
+ public function edit(){
+ $param= get_params();
+ if (request()->isAjax()) {
+ $res=Db::table('fa_szxc_party_vote_comment')->where('id',$param['id'])->strict(false)->field(true)->update($param);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }else{
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_vote_comment')->where('id',$id)->find();
+ View::assign('editor', get_system_config('other','editor'));
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ View::assign('users', $this->users);
+ View::assign('party_vote', $this->party_vote);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ }
+ /**
+ * 查看信息
+ */
+ public function read()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $detail = Db::table('fa_szxc_party_vote_comment')->where('id',$id)->find();
+ if (!empty($detail)) {
+ View::assign('detail', $detail);
+ View::assign('users', $this->users);
+ View::assign('party_vote', $this->party_vote);
+ return view();
+ }
+ else{
+ throw new \think\exception\HttpException(404, '找不到页面');
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $param= get_params();
+ $id = isset($param['id']) ? $param['id'] : 0;
+ $type = isset($param['type']) ? $param['type'] : 0;
+ $res = Db::table('fa_szxc_party_vote_comment')->where('id',$id)->update(['status'=>$type]);
+ if ($res){
+ return to_assign();
+ }else{
+ return to_assign(1, '操作失败,原因:'.$res);
+ }
+ }
+
+
+}
diff --git a/app/admin/view/admin/add.html b/app/admin/view/admin/add.html
index fd28b0f..42e4356 100644
--- a/app/admin/view/admin/add.html
+++ b/app/admin/view/admin/add.html
@@ -181,6 +181,63 @@
+
+
+
+
+
+
+
{/block}
diff --git a/app/admin/view/nk/party/article/add.html b/app/admin/view/nk/party/article/add.html
new file mode 100644
index 0000000..95dddec
--- /dev/null
+++ b/app/admin/view/nk/party/article/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/party/article/edit.html b/app/admin/view/nk/party/article/edit.html
new file mode 100644
index 0000000..98021e9
--- /dev/null
+++ b/app/admin/view/nk/party/article/edit.html
@@ -0,0 +1,119 @@
+{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/party/article/index.html b/app/admin/view/nk/party/article/index.html
new file mode 100644
index 0000000..68027e2
--- /dev/null
+++ b/app/admin/view/nk/party/article/index.html
@@ -0,0 +1,145 @@
+{extend name="common/base"/}
+
+{block name="body"}
+
+
+
+
+
+
+
+
+
+
+{/block}
+
+
+
+{block name="script"}
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/party/article/read.html b/app/admin/view/nk/party/article/read.html
new file mode 100644
index 0000000..5c8280e
--- /dev/null
+++ b/app/admin/view/nk/party/article/read.html
@@ -0,0 +1,39 @@
+{extend name="common/base"/}
+{block name="style"}
+
+{/block}
+
+{block name="body"}
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/party/branch/add.html b/app/admin/view/nk/party/branch/add.html
new file mode 100644
index 0000000..66463ac
--- /dev/null
+++ b/app/admin/view/nk/party/branch/add.html
@@ -0,0 +1,113 @@
+{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/party/branch/edit.html b/app/admin/view/nk/party/branch/edit.html
new file mode 100644
index 0000000..1cf4a27
--- /dev/null
+++ b/app/admin/view/nk/party/branch/edit.html
@@ -0,0 +1,129 @@
+{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/party/branch/index.html b/app/admin/view/nk/party/branch/index.html
new file mode 100644
index 0000000..d86d385
--- /dev/null
+++ b/app/admin/view/nk/party/branch/index.html
@@ -0,0 +1,164 @@
+{extend name="common/base"/}
+
+{block name="body"}
+
+
+
+
+
+
+
+
+
+
+{/block}
+
+
+
+{block name="script"}
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/party/branch/read.html b/app/admin/view/nk/party/branch/read.html
new file mode 100644
index 0000000..7f9e08b
--- /dev/null
+++ b/app/admin/view/nk/party/branch/read.html
@@ -0,0 +1,76 @@
+{extend name="common/base"/}
+{block name="style"}
+
+{/block}
+
+{block name="body"}
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/party/branch_pay_list/add.html b/app/admin/view/nk/party/branch_pay_list/add.html
new file mode 100644
index 0000000..a43c1ac
--- /dev/null
+++ b/app/admin/view/nk/party/branch_pay_list/add.html
@@ -0,0 +1,53 @@
+
diff --git a/app/admin/view/nk/party/branch_pay_list/edit.html b/app/admin/view/nk/party/branch_pay_list/edit.html
new file mode 100644
index 0000000..0d66718
--- /dev/null
+++ b/app/admin/view/nk/party/branch_pay_list/edit.html
@@ -0,0 +1,52 @@
+
diff --git a/app/admin/view/nk/party/branch_pay_list/index.html b/app/admin/view/nk/party/branch_pay_list/index.html
new file mode 100644
index 0000000..f72e3d4
--- /dev/null
+++ b/app/admin/view/nk/party/branch_pay_list/index.html
@@ -0,0 +1,35 @@
+
+ {:build_heading()}
+
+
+
diff --git a/app/admin/view/nk/party/branch_pay_user/add.html b/app/admin/view/nk/party/branch_pay_user/add.html
new file mode 100644
index 0000000..5ec9de4
--- /dev/null
+++ b/app/admin/view/nk/party/branch_pay_user/add.html
@@ -0,0 +1,66 @@
+
diff --git a/app/admin/view/nk/party/branch_pay_user/edit.html b/app/admin/view/nk/party/branch_pay_user/edit.html
new file mode 100644
index 0000000..35504ce
--- /dev/null
+++ b/app/admin/view/nk/party/branch_pay_user/edit.html
@@ -0,0 +1,71 @@
+
diff --git a/app/admin/view/nk/party/branch_pay_user/index.html b/app/admin/view/nk/party/branch_pay_user/index.html
new file mode 100644
index 0000000..0a53e6f
--- /dev/null
+++ b/app/admin/view/nk/party/branch_pay_user/index.html
@@ -0,0 +1,35 @@
+
+ {:build_heading()}
+
+
+
diff --git a/app/admin/view/nk/party/info/add.html b/app/admin/view/nk/party/info/add.html
new file mode 100644
index 0000000..fffb32d
--- /dev/null
+++ b/app/admin/view/nk/party/info/add.html
@@ -0,0 +1,150 @@
+{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/party/info/edit.html b/app/admin/view/nk/party/info/edit.html
new file mode 100644
index 0000000..bdb7d8c
--- /dev/null
+++ b/app/admin/view/nk/party/info/edit.html
@@ -0,0 +1,164 @@
+{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/party/info/index.html b/app/admin/view/nk/party/info/index.html
new file mode 100644
index 0000000..a0104a9
--- /dev/null
+++ b/app/admin/view/nk/party/info/index.html
@@ -0,0 +1,209 @@
+{extend name="common/base"/}
+
+{block name="body"}
+
+
+
+
+
+
+
+
+
+
+{/block}
+
+
+
+{block name="script"}
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/party/info/read.html b/app/admin/view/nk/party/info/read.html
new file mode 100644
index 0000000..50402f7
--- /dev/null
+++ b/app/admin/view/nk/party/info/read.html
@@ -0,0 +1,106 @@
+{extend name="common/base"/}
+{block name="style"}
+
+{/block}
+
+{block name="body"}
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/party/vote/add.html b/app/admin/view/nk/party/vote/add.html
new file mode 100644
index 0000000..800317e
--- /dev/null
+++ b/app/admin/view/nk/party/vote/add.html
@@ -0,0 +1,105 @@
+{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/party/vote/edit.html b/app/admin/view/nk/party/vote/edit.html
new file mode 100644
index 0000000..3d8ea7b
--- /dev/null
+++ b/app/admin/view/nk/party/vote/edit.html
@@ -0,0 +1,116 @@
+{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/party/vote/index.html b/app/admin/view/nk/party/vote/index.html
new file mode 100644
index 0000000..a594176
--- /dev/null
+++ b/app/admin/view/nk/party/vote/index.html
@@ -0,0 +1,179 @@
+{extend name="common/base"/}
+
+{block name="body"}
+
+
+
+
+
+
+
+
+
+
+{/block}
+
+
+
+{block name="script"}
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/party/vote/read.html b/app/admin/view/nk/party/vote/read.html
new file mode 100644
index 0000000..f70acde
--- /dev/null
+++ b/app/admin/view/nk/party/vote/read.html
@@ -0,0 +1,67 @@
+{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/party/votecomment/add.html b/app/admin/view/nk/party/votecomment/add.html
new file mode 100644
index 0000000..bada4cf
--- /dev/null
+++ b/app/admin/view/nk/party/votecomment/add.html
@@ -0,0 +1,114 @@
+{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/party/votecomment/edit.html b/app/admin/view/nk/party/votecomment/edit.html
new file mode 100644
index 0000000..7af6369
--- /dev/null
+++ b/app/admin/view/nk/party/votecomment/edit.html
@@ -0,0 +1,126 @@
+{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/party/votecomment/index.html b/app/admin/view/nk/party/votecomment/index.html
new file mode 100644
index 0000000..f945ac2
--- /dev/null
+++ b/app/admin/view/nk/party/votecomment/index.html
@@ -0,0 +1,154 @@
+{extend name="common/base"/}
+
+{block name="body"}
+
+
+
+
+
+
+
+
+
+
+{/block}
+
+
+
+{block name="script"}
+
+{/block}
+
\ No newline at end of file
diff --git a/app/admin/view/nk/party/votecomment/read.html b/app/admin/view/nk/party/votecomment/read.html
new file mode 100644
index 0000000..c1277d5
--- /dev/null
+++ b/app/admin/view/nk/party/votecomment/read.html
@@ -0,0 +1,81 @@
+{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/api/controller/Article.php b/app/api/controller/Article.php
index f04e8a1..280cabc 100644
--- a/app/api/controller/Article.php
+++ b/app/api/controller/Article.php
@@ -26,7 +26,7 @@ class Article extends BaseController
$screen = $param['screen']??1;
$solve = $param['solve']??1;
$order = $param['order']??1;
- $model = Db::table('fa_article');
+// $model = Db::table('fa_article');
$where = [
['status', '=', 1],
['category_id', '=', $category_id]
@@ -54,9 +54,9 @@ class Article extends BaseController
}
}
//总条数
- $count = $model->where($where)->count();
+ $count = Db::table('fa_article')->where($where)->count();
//当月条数
- $month_count = $model->where($where)->whereMonth('view_time')->count();
+ $month_count = Db::table('fa_article')->where($where)->whereMonth('view_time')->count();
if ($search != '') {
$where[] = ['title', 'like', '%' . $search . '%'];
}
@@ -92,7 +92,7 @@ class Article extends BaseController
}else if($solve==3){
$where[] = ['is_solve', '=', 1];
}
- $select = $model->with('user')->where($where)->page($page)->limit(20)
+ $select = Db::table('fa_article')->with('user')->where($where)->page($page)->limit(20)
->field('id,title,user_id,view,view_time,image,end_time,is_solve,is_vote,is_nickname,video,category_type,describe')
->order('id',$orders)->select()->toArray();
}
@@ -294,7 +294,7 @@ class Article extends BaseController
*/
public function getArticleList($category_id = 0, $page = 1, $type = 1)
{
- $model = Db::table('fa_article');
+// $model = Db::table('fa_article');
$where = [
['status', '=', 1],
];
@@ -536,8 +536,8 @@ class Article extends BaseController
*/
public function edit($id)
{
- $model =Db::table('fa_article');
- $find = $model->where('id', $id)->find();
+// $model =Db::table('fa_article');
+ $find = Db::table('fa_article')->where('id', $id)->find();
if ($find && $find['is_vote'] == 1) {
$data = Db::table('fa_article_vote_side_tables')->where('article_id', $find['id'])->find();
$find['extend']['vote'] = $data;
@@ -581,7 +581,7 @@ class Article extends BaseController
public function getWorkArticleCount()
{
- $model = Db::table('fa_article');
+// $model = Db::table('fa_article');
//根据个人村id进行查询
if (JWT_UID) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
@@ -595,14 +595,17 @@ class Article extends BaseController
}
}
}
- $is_solve = $model->where('is_solve', 1)->where($where)->count();
- $shuqiu = $model->where('is_solve', 0)->where($where)->where('category_id', 'in',[165,150,149,148,147])->whereTime('end_time','>', date('Y-m-d h:i:s'))->count();
- $time = $model->where('is_solve', 0)->where($where)->where('category_id', 'in',[165,150,149,148,147])->whereTime('end_time','<=', date('Y-m-d h:i:s'))->count();
- $maodun = $model->where('is_solve', 0)->where($where)->where('category_id',147)->count();
- $xiejiao = $model->where('is_solve', 0)->where($where)->where('category_id', 148)->count();
- $saohei = $model->where('is_solve', 0)->where($where)->where('category_id', 149)->count();
- $sos = $model->where('is_solve', 0)->where($where)->where('category_id', 150)->count();
- $one_shuqiu = $model->where('is_solve', 0)->where($where)->where('category_id', 165)->count();
+
+ $ww['is_solve'] = 1;
+ $is_solve = Db::table('fa_article')->where($ww)->where($where)->count();
+ $shuqiu = Db::table('fa_article')->where('is_solve', 0)->where($where)->where('category_id', 'in',[165,150,149,148,147])->whereTime('end_time','>', date('Y-m-d h:i:s'))->count();
+
+ $time = Db::table('fa_article')->where('is_solve', 0)->where($where)->where('category_id', 'in',[165,150,149,148,147])->whereTime('end_time','<=', date('Y-m-d h:i:s'))->count();
+ $maodun = Db::table('fa_article')->where('is_solve', 0)->where($where)->where('category_id',147)->count();
+ $xiejiao = Db::table('fa_article')->where('is_solve', 0)->where($where)->where('category_id', 148)->count();
+ $saohei = Db::table('fa_article')->where('is_solve', 0)->where($where)->where('category_id', 149)->count();
+ $sos = Db::table('fa_article')->where('is_solve', 0)->where($where)->where('category_id', 150)->count();
+ $one_shuqiu = Db::table('fa_article')->where('is_solve', 0)->where($where)->where('category_id', 165)->count();
$select = [
'solve_count' => $is_solve,
'shuqiu' => $shuqiu,
@@ -620,8 +623,8 @@ class Article extends BaseController
public function delete($id)
{
- $model = Db::table('fa_article');
- $res = $model->where('id', $id)->update(['status' => 0]);
+// $model = Db::table('fa_article');
+ $res = Db::table('fa_article')->where('id', $id)->update(['status' => 0]);
if ($res) {
return $this->apiSuccess('删除成功');
} else {
@@ -632,7 +635,7 @@ class Article extends BaseController
// 服务大厅小红点
public function getMyArticleCount()
{
- $model = Db::table('fa_article');
+// $model = Db::table('fa_article');
//根据个人id进行查询
$where[] = ['a.user_id','=',JWT_UID];
$where[] = ['b.is_read','=','0'];
@@ -649,12 +652,12 @@ class Article extends BaseController
}
}
}
- $yishi = $model->alias('a')->join(['fa_article_vote_side_tables' => 'b'],'a.id=b.article_id')->where($www)->where('a.category_id',162)->whereTime('b.end_time', '>', date('Y-m-d H:i:s'))->count();
- $maodun = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id',147)->count();
- $xiejiao = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 148)->count();
- $saohei = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 149)->count();
- $sos = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 150)->count();
- $one_shuqiu = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 165)->count();
+ $yishi = Db::table('fa_article')->alias('a')->join(['fa_article_vote_side_tables' => 'b'],'a.id=b.article_id')->where($www)->where('a.category_id',162)->whereTime('b.end_time', '>', date('Y-m-d H:i:s'))->count();
+ $maodun = Db::table('fa_article')->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id',147)->count();
+ $xiejiao = Db::table('fa_article')->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 148)->count();
+ $saohei = Db::table('fa_article')->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 149)->count();
+ $sos = Db::table('fa_article')->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 150)->count();
+ $one_shuqiu = Db::table('fa_article')->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 165)->count();
$select = [
'yishi' => $yishi,
'maodun' => $maodun,
@@ -672,7 +675,7 @@ class Article extends BaseController
$screen = $param['screen']??1;
$solve = $param['solve']??1;
$order = $param['order']??1;
- $model = Db::table('fa_article');
+// $model = Db::table('fa_article');
$where = [
['status', '=', 1],
['category_id', '=', $category_id]
@@ -686,16 +689,31 @@ class Article extends BaseController
if (!$category_id) {
unset($where[1]);
}
- $village_id = get_params('village_id');
- if ($village_id) {
- $where[] = ['village', '=', $village_id];
+ //根据个人村id进行查询
+ if (JWT_UID) {
+ $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
+ if ($find) {
+ if ($find['auth_range']==1){
+ $where[] = ['village', '=', $find['village_id']];
+ }elseif ($find['auth_range']==2){
+ $where[] = ['township', '=', $find['street_id']];
+ }elseif ($find['auth_range']==3){
+ $where[] = ['county', '=', $find['area_id']];
+ }
+ }
}
+// $village_id = get_params('village_id');
+//
+// if ($village_id) {
+// $where[] = ['village', '=', $village_id];
+// }
+
//总条数
- $count = $model->where($where)->count();
+ $count = Db::table('fa_article')->where($where)->count();
//当月条数
- $month_count = $model->where($where)->whereMonth('view_time')->count();
+ $month_count = Db::table('fa_article')->where($where)->whereMonth('view_time')->count();
if ($search != '') {
$where[] = ['title', 'like', '%' . $search . '%'];
}
@@ -731,7 +749,7 @@ class Article extends BaseController
}else if($solve==3){
$where[] = ['is_solve', '=', 1];
}
- $select = $model->with('user')->where($where)->page($page)->limit(20)
+ $select = Db::table('fa_article')->with('user')->where($where)->page($page)->limit(20)
->field('id,title,user_id,view,view_time,image,end_time,is_solve,is_vote,is_nickname,video,category_type,describe')
->order('id',$orders)->select()->toArray();
}
diff --git a/app/api/controller/Common.php b/app/api/controller/Common.php
index b6175c3..0fc38a4 100644
--- a/app/api/controller/Common.php
+++ b/app/api/controller/Common.php
@@ -14,6 +14,8 @@ namespace app\api\controller;
use app\api\BaseController;
use app\api\middleware\Auth;
+use OSS\Core\OssException;
+use OSS\OssClient;
use think\facade\Config;
use app\common\model\Area;
use app\common\model\Version;
@@ -59,116 +61,235 @@ class Common extends BaseController
}
}
- /**
- * 上传文件.
- * @ApiMethod (POST)
- *
- * @param File $file 文件流
- */
+// /**
+// * 上传文件.
+// * @ApiMethod (POST)
+// *
+// * @param File $file 文件流
+// */
+// public function upload()
+// {
+// $file = $this->request->file('file');
+// if (empty($file)) {
+// $this->apiError('未上传文件或超出服务器上传限制');
+// }
+//
+// //判断是否已经存在附件
+// $sha1 = $file->hash();
+//
+// $upload = Config::get('upload');
+//
+// preg_match('/(\d+)(\w+)/', $upload['maxsize'], $matches);
+// $type = strtolower($matches[2]);
+// $typeDict = ['b' => 0, 'k' => 1, 'kb' => 1, 'm' => 2, 'mb' => 2, 'gb' => 3, 'g' => 3];
+// $size = (int) $upload['maxsize'] * pow(1024, isset($typeDict[$type]) ? $typeDict[$type] : 0);
+// $fileInfo['name'] = $file->getOriginalName(); //上传文件名
+// $fileInfo['type'] = $file->getOriginalMime(); //上传文件类型信息
+// $fileInfo['tmp_name'] = $file->getPathname();
+// $fileInfo['size'] = $file->getSize();
+// $suffix = strtolower(pathinfo($fileInfo['name'], PATHINFO_EXTENSION));
+// $suffix = $suffix && preg_match('/^[a-zA-Z0-9]+$/', $suffix) ? $suffix : 'file';
+//
+// $mimetypeArr = explode(',', strtolower($upload['mimetype']));
+// $typeArr = explode('/', $fileInfo['type']);
+//
+// //禁止上传PHP和HTML文件
+// if (in_array($fileInfo['type'], ['text/x-php', 'text/html']) || in_array($suffix, ['php', 'html', 'htm', 'phar', 'phtml']) || preg_match("/^php(.*)/i", $suffix)) {
+// $this->apiError('上传文件格式受限制');
+// }
+//
+// //Mimetype值不正确
+// if (stripos($fileInfo['type'], '/') === false) {
+// $this->apiError('上传文件格式受限制');
+// }
+//
+// //验证文件后缀
+// if ($upload['mimetype'] !== '*' &&
+// (
+// !in_array($suffix, $mimetypeArr)
+// || (stripos($typeArr[0] . '/', $upload['mimetype']) !== false && (!in_array($fileInfo['type'], $mimetypeArr) && !in_array($typeArr[0] . '/*', $mimetypeArr)))
+// )
+// ) {
+// $this->apiError('上传文件格式受限制');
+// }
+//
+// //验证是否为图片文件
+// $imagewidth = $imageheight = 0;
+// if (in_array($fileInfo['type'],
+// ['image/gif', 'image/jpg', 'image/jpeg', 'image/bmp', 'image/png', 'image/webp']) || in_array($suffix,
+// ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'webp'])) {
+// $imgInfo = getimagesize($fileInfo['tmp_name']);
+// if (! $imgInfo || ! isset($imgInfo[0]) || ! isset($imgInfo[1])) {
+// $this->apiError('上传文件不是有效的图片文件');
+// }
+// $imagewidth = isset($imgInfo[0]) ? $imgInfo[0] : $imagewidth;
+// $imageheight = isset($imgInfo[1]) ? $imgInfo[1] : $imageheight;
+// }
+//
+// $_validate[] = 'filesize:'.$size;
+// if ($upload['mimetype']) {
+// $_validate[] = 'fileExt:'.$upload['mimetype'];
+// }
+// $validate = implode('|', $_validate);
+//
+// $event_config = Event::trigger('upload_init', $upload,true);
+// if($event_config){
+// $upload = array_merge($upload, $event_config);
+// }
+// try {
+// $savename = upload_file($file, $upload['driver'], 'uploads', $validate, $upload['cdnurl']);
+// } catch (\Exception $e) {
+// $savename = false;
+// $this->apiError($e->getMessage());
+// }
+// if (! $savename) {
+// $this->apiError('上传失败');
+// }
+// $category = request()->post('category');
+// $category = array_key_exists($category, config('site.attachmentcategory') ?? []) ? $category : '';
+//// $urls= Env::get('APP.URL_MY')? Env::get('APP.URL_MY'):'https://ceshi.excellentkk.cn';
+// $params = [
+// 'admin_id' => 0,
+// 'user_id' => (int) JWT_UID,
+// 'category' => $category,
+// 'filename' => mb_substr(htmlspecialchars(strip_tags($fileInfo['name'])), 0, 100),
+// 'filesize' => $fileInfo['size'],
+// 'imagewidth' => $imagewidth,
+// 'imageheight' => $imageheight,
+// 'imagetype' => $suffix,
+// 'imageframes' => 0,
+// 'mimetype' => $fileInfo['type'],
+// 'url' => $savename,
+// 'uploadtime' => time(),
+// 'storage' => $upload['driver'],
+// 'sha1' => $sha1,
+// ];
+// $attachment = new Attachment();
+// $attachment->data(array_filter($params));
+// $attachment->save();
+// \think\facade\Event::trigger('upload_after', $attachment);
+// $this->apiSuccess('上传成功', [
+// 'url' =>$savename,
+// ]);
+// }
+
+ //上传文件
public function upload()
{
- $file = $this->request->file('file');
- if (empty($file)) {
- $this->apiError('未上传文件或超出服务器上传限制');
+ $param = get_params();
+ //var_dump($param);exit;
+ $sourse = 'file';
+ if(isset($param['sourse'])){
+ $sourse = $param['sourse'];
}
-
- //判断是否已经存在附件
- $sha1 = $file->hash();
-
- $upload = Config::get('upload');
-
- preg_match('/(\d+)(\w+)/', $upload['maxsize'], $matches);
- $type = strtolower($matches[2]);
- $typeDict = ['b' => 0, 'k' => 1, 'kb' => 1, 'm' => 2, 'mb' => 2, 'gb' => 3, 'g' => 3];
- $size = (int) $upload['maxsize'] * pow(1024, isset($typeDict[$type]) ? $typeDict[$type] : 0);
- $fileInfo['name'] = $file->getOriginalName(); //上传文件名
- $fileInfo['type'] = $file->getOriginalMime(); //上传文件类型信息
- $fileInfo['tmp_name'] = $file->getPathname();
- $fileInfo['size'] = $file->getSize();
- $suffix = strtolower(pathinfo($fileInfo['name'], PATHINFO_EXTENSION));
- $suffix = $suffix && preg_match('/^[a-zA-Z0-9]+$/', $suffix) ? $suffix : 'file';
-
- $mimetypeArr = explode(',', strtolower($upload['mimetype']));
- $typeArr = explode('/', $fileInfo['type']);
-
- //禁止上传PHP和HTML文件
- if (in_array($fileInfo['type'], ['text/x-php', 'text/html']) || in_array($suffix, ['php', 'html', 'htm', 'phar', 'phtml']) || preg_match("/^php(.*)/i", $suffix)) {
- $this->apiError('上传文件格式受限制');
- }
-
- //Mimetype值不正确
- if (stripos($fileInfo['type'], '/') === false) {
- $this->apiError('上传文件格式受限制');
- }
-
- //验证文件后缀
- if ($upload['mimetype'] !== '*' &&
- (
- !in_array($suffix, $mimetypeArr)
- || (stripos($typeArr[0] . '/', $upload['mimetype']) !== false && (!in_array($fileInfo['type'], $mimetypeArr) && !in_array($typeArr[0] . '/*', $mimetypeArr)))
- )
- ) {
- $this->apiError('上传文件格式受限制');
- }
-
- //验证是否为图片文件
- $imagewidth = $imageheight = 0;
- if (in_array($fileInfo['type'],
- ['image/gif', 'image/jpg', 'image/jpeg', 'image/bmp', 'image/png', 'image/webp']) || in_array($suffix,
- ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'webp'])) {
- $imgInfo = getimagesize($fileInfo['tmp_name']);
- if (! $imgInfo || ! isset($imgInfo[0]) || ! isset($imgInfo[1])) {
- $this->apiError('上传文件不是有效的图片文件');
+ if($sourse == 'file' || $sourse == 'tinymce'){
+ if(request()->file('file')){
+ $file = request()->file('file');
+ }
+ else{
+ return to_assign(1, '没有选择上传文件');
}
- $imagewidth = isset($imgInfo[0]) ? $imgInfo[0] : $imagewidth;
- $imageheight = isset($imgInfo[1]) ? $imgInfo[1] : $imageheight;
}
-
- $_validate[] = 'filesize:'.$size;
- if ($upload['mimetype']) {
- $_validate[] = 'fileExt:'.$upload['mimetype'];
+ else{
+ if (request()->file('editormd-image-file')) {
+ $file = request()->file('editormd-image-file');
+ } else {
+ return to_assign(1, '没有选择上传文件');
+ }
}
- $validate = implode('|', $_validate);
-
- $event_config = Event::trigger('upload_init', $upload,true);
- if($event_config){
- $upload = array_merge($upload, $event_config);
- }
- try {
- $savename = upload_file($file, $upload['driver'], 'uploads', $validate, $upload['cdnurl']);
- } catch (\Exception $e) {
- $savename = false;
- $this->apiError($e->getMessage());
- }
- if (! $savename) {
- $this->apiError('上传失败');
- }
- $category = request()->post('category');
- $category = array_key_exists($category, config('site.attachmentcategory') ?? []) ? $category : '';
-// $urls= Env::get('APP.URL_MY')? Env::get('APP.URL_MY'):'https://ceshi.excellentkk.cn';
- $params = [
- 'admin_id' => 0,
- 'user_id' => (int) JWT_UID,
- 'category' => $category,
- 'filename' => mb_substr(htmlspecialchars(strip_tags($fileInfo['name'])), 0, 100),
- 'filesize' => $fileInfo['size'],
- 'imagewidth' => $imagewidth,
- 'imageheight' => $imageheight,
- 'imagetype' => $suffix,
- 'imageframes' => 0,
- 'mimetype' => $fileInfo['type'],
- 'url' => $savename,
- 'uploadtime' => time(),
- 'storage' => $upload['driver'],
- 'sha1' => $sha1,
+ // 获取上传文件的hash散列值
+ $sha1 = $file->hash('sha1');
+ $md5 = $file->hash('md5');
+ $rule = [
+ 'image' => 'jpg,png,jpeg,gif',
+ 'doc' => 'doc,docx,ppt,pptx,xls,xlsx,pdf',
+ 'file' => 'zip,gz,7z,rar,tar',
+ 'video' => 'mpg,mp4,mpeg,avi,wmv,mov,flv,m4v',
];
- $attachment = new Attachment();
- $attachment->data(array_filter($params));
- $attachment->save();
- \think\facade\Event::trigger('upload_after', $attachment);
- $this->apiSuccess('上传成功', [
- 'url' =>$savename,
+ $fileExt = $rule['image'] . ',' . $rule['doc'] . ',' . $rule['file'] . ',' . $rule['video'];
+ //1M=1024*1024=1048576字节
+ $fileSize = 100 * 1024 * 1024;
+ if (isset($param['type']) && $param['type']) {
+ $fileExt = $rule[$param['type']];
+ }
+ if (isset($param['size']) && $param['size']) {
+ $fileSize = $param['size'];
+ }
+ $validate = \think\facade\Validate::rule([
+ 'image' => 'require|fileSize:' . $fileSize . '|fileExt:' . $fileExt,
]);
+ $file_check['image'] = $file;
+ if (!$validate->check($file_check)) {
+ return to_assign(1, $validate->getError());
+ }
+ // 日期前綴
+ $dataPath = date('Ym');
+ $use = 'thumb';
+ $accessKeyId = "LTAI5t7mhH3ij2cNWs1zhPmv"; ;
+ $accessKeySecret = "gqo2wMpvi8h5bDBmCpMje6BaiXvcPu";
+ $endpoint = "oss-cn-chengdu.aliyuncs.com";
+ try {
+ $ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
+ } catch (OssException $e) {
+ return to_assign(1, $e->getMessage());
+ }
+ $bucket = "lihai001";
+ $object = 'storage/'.$dataPath.'/'.$md5.'.jpg';
+// $filename = \think\facade\Filesystem::disk('public')->putFile($dataPath, $file, function () use ($md5) {
+// return $md5;
+// });
+ try {
+ $filename=$ossClient->uploadFile($bucket, $object,$file);
+ } catch (OssException $e) {
+ return to_assign(1, $e->getMessage());
+ }
+ if ($filename) {
+ //写入到附件表
+ $data = [];
+ $path = get_config('filesystem.disks.public.url');
+ $data['filepath'] = $filename['info']['url'];
+ $data['name'] = $file->getOriginalName();
+ $data['mimetype'] = $file->getOriginalMime();
+ $data['fileext'] = $file->extension();
+ $data['filesize'] = $file->getSize();
+ $data['filename'] = $object;
+ $data['sha1'] = $sha1;
+ $data['md5'] = $md5;
+ $data['module'] = \think\facade\App::initialize()->http->getName();
+ $data['action'] = app('request')->action();
+ $data['uploadip'] = app('request')->ip();
+ $data['create_time'] = time();
+ $data['user_id'] = JWT_UID ? JWT_UID : 0;
+ if ($data['module'] = 'admin') {
+ //通过后台上传的文件直接审核通过
+ $data['status'] = 1;
+ $data['admin_id'] = $data['user_id'];
+ $data['audit_time'] = time();
+ }
+ $data['use'] = request()->has('use') ? request()->param('use') : $use; //附件用处
+ $res['id'] = Db::name('file')->insertGetId($data);
+ $res['filepath'] = $data['filepath'];
+ $res['name'] = $data['name'];
+ $res['filename'] = $data['filename'];
+// add_log('upload', $data['user_id'], $data);
+ if($sourse == 'editormd'){
+ //editormd编辑器上传返回
+ return json(['success'=>1,'message'=>'上传成功','url'=>$data['filepath']]);
+ }
+ else if($sourse == 'tinymce'){
+ //tinymce编辑器上传返回
+ return json(['success'=>1,'message'=>'上传成功','location'=>$data['filepath']]);
+ }
+ else{
+ //普通上传返回
+// return to_assign(0, '上传成功', $res);
+ $this->apiSuccess('上传成功', [
+ 'url' =>$data['filepath'],
+ ]);
+ }
+ } else {
+ return to_assign(1, '上传失败,请重试');
+ }
}
public function category($id=0,$type='',$pid=0,$is_category=false){
diff --git a/app/api/controller/Maintainentry.php b/app/api/controller/Maintainentry.php
index c847baf..aed5e48 100644
--- a/app/api/controller/Maintainentry.php
+++ b/app/api/controller/Maintainentry.php
@@ -7,7 +7,6 @@ use app\api\middleware\Auth;
use think\Exception;
use think\facade\Db;
use think\exception\ValidateException;
-use app\common\model\User;
/**
@@ -72,6 +71,8 @@ class Maintainentry extends BaseController
$www[] = ['status','=','1'];
$www[] = ['enter_id','=',JWT_UID];
$have = Db::table('fa_szxc_information_usermsg')->where($www)->count();
+ $man_num = Db::table('fa_szxc_information_usermsg')->where($www)->where('gender',1)->count();
+ $woman_num = Db::table('fa_szxc_information_usermsg')->where($www)->where('gender',2)->count();
$page = get_params('page')??1;
$limit = get_params('limit')??10;
// $name = get_params('name', '');
@@ -91,7 +92,7 @@ class Maintainentry extends BaseController
// 获取已录入的人员信息
$res = Db::table('fa_szxc_information_usermsg')->where($where)
->order('id desc')
- ->field("id,user_id,name,age,gender,family_num,political_outlook,householder_id,is_hz,address_name")
+ ->field("id,user_id,name,age,gender,family_num,political_outlook,householder_id,is_hz,address_name,phone")
->page($page, $limit)
->withAttr('householder_name',function ($data,$value){
if($value['is_hz']==1){
@@ -135,9 +136,19 @@ class Maintainentry extends BaseController
return '女';
}
})
+ ->withAttr('avatar',function ($data,$value){
+ if($value['is_hz']==1){
+ return 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230129/0dc8d0a0f3bcc168550ef263a9a170dc.png';
+ }else{
+ $msg= Db::table('fa_user')->where('id',$value['user_id'])->value('avatar');
+ return $msg??'';
+ }
+ })
->select();
$return['total_num'] = $total;
$return['now_num'] = $have;
+ $return['man_num'] = $man_num;
+ $return['woman_num'] = $woman_num;
$return['data'] = $res;
$this->apiSuccess('获取成功', $return, 1);
}
@@ -1200,7 +1211,7 @@ class Maintainentry extends BaseController
$this->apiError('录入出错,请联系系统管理员');
}
// 判断手机号是否已经注册
- $is_mobile = User::getByMobile($post['phone']);
+ $is_mobile = Db::table('fa_user')->where('mobile',$post['phone'])->find();
if ($is_mobile) {
$this->apiError('手机号已被使用');
}
@@ -1254,7 +1265,7 @@ class Maintainentry extends BaseController
'updatetime' => $time
];
//写入用户表
- $userid = User::strict(false)->insertGetId($params);
+ $userid = Db::table('fa_user')->strict(false)->insertGetId($params);
// 写入商城关系表
$nk_user['n_user_id'] = $userid;
@@ -1495,7 +1506,7 @@ class Maintainentry extends BaseController
$this->apiError('录入出错,请联系系统管理员');
}
// 判断手机号是否已经注册
- $is_mobile = User::getByMobile($post['phone']);
+ $is_mobile = Db::table('fa_user')->where('mobile',$post['phone'])->find();
if ($is_mobile) {
$this->apiError('手机号已被使用');
}
@@ -1549,7 +1560,7 @@ class Maintainentry extends BaseController
'updatetime' => $time
];
//写入用户表
- $userid = User::strict(false)->insertGetId($params);
+ $userid = Db::table('fa_user')->strict(false)->insertGetId($params);
// 写入商城关系表
$nk_user['n_user_id'] = $userid;
@@ -1772,7 +1783,7 @@ class Maintainentry extends BaseController
// }
// 判断手机号是否已经注册
- $is_mobile = User::getByMobile($phone);
+ $is_mobile = Db::table('fa_user')->where('mobile',$phone)->find();
if ($is_mobile) {
$this->apiError('手机号已被使用');
}
diff --git a/app/api/controller/MyArticle.php b/app/api/controller/MyArticle.php
index 93d615f..f53e5b9 100644
--- a/app/api/controller/MyArticle.php
+++ b/app/api/controller/MyArticle.php
@@ -22,7 +22,6 @@ class MyArticle extends BaseController
public function index($search = '', $category_id = 1, $page = 1, $is_time=0,)
{
- $model = Db::table('fa_article');
$where = [
['status', '=', 1],
['category_id', '=', $category_id],
@@ -32,14 +31,14 @@ class MyArticle extends BaseController
unset($where[1]);
}
//总条数
- $count = $model->where($where)->count();
+ $count = Db::table('fa_article')->where($where)->count();
//当月条数
- $month_count = $model->where($where)->whereMonth('view_time')->count();
+ $month_count = Db::table('fa_article')->where($where)->whereMonth('view_time')->count();
if ($search != '') {
$where[] = ['title', 'like', '%' . $search . '%'];
}
//查询
- $select = $model->with('user')->where($where)->page($page)->limit(20)
+ $select = Db::table('fa_article')->with('user')->where($where)->page($page)->limit(20)
->field('id,title,user_id,view,view_time,image,end_time,is_solve,is_vote,is_nickname,describe')->order('id DESC')->select()->toArray();
foreach ($select as $key => $value) {
if ($value['is_nickname'] == 1) {
diff --git a/app/api/controller/Notice.php b/app/api/controller/Notice.php
new file mode 100644
index 0000000..2bd1cf6
--- /dev/null
+++ b/app/api/controller/Notice.php
@@ -0,0 +1,76 @@
+ ['except' => [] ]
+ ];
+
+ /**
+ * 消息通知列表
+ */
+ public function list($page=1,$limit=10){
+ $where['status'] = 1;
+ $where['user_id'] = JWT_UID;
+ $res = Db::table('cms_notice')
+ ->where($where)
+ ->field('id,user_id,title,content,create_time,is_read,read_time')
+ ->page($page, $limit)
+ ->select();
+ $this->apiSuccess('获取成功',$res);
+ }
+
+ /**
+ * 未读消息数
+ */
+ public function count(){
+ $where['status'] = 1;
+ $where['is_read'] = 0;
+ $where['user_id'] = JWT_UID;
+ $res = Db::table('cms_notice')
+ ->where($where)
+ ->count();
+ $this->apiSuccess('获取成功',$res);
+ }
+
+ /**
+ * 消息详情
+ */
+ public function info(){
+ $id = get_params('id');
+ if(empty($id)){
+ $this->apiError('缺少参数');
+ }
+ $where['id'] = $id;
+ $where['user_id'] = JWT_UID;
+ $res = Db::table('cms_notice')
+ ->where($where)
+ ->find();
+ if($res){
+ $data['is_read'] = 1;
+ $data['read_time'] = time();
+ Db::table('cms_notice')->where($where)->update($data);
+ $this->apiSuccess('获取成功',$res);
+ }else{
+ $this->apiError('未找到该数据');
+ }
+ }
+
+
+
+
+}
diff --git a/app/api/controller/User.php b/app/api/controller/User.php
index 793543f..886a078 100644
--- a/app/api/controller/User.php
+++ b/app/api/controller/User.php
@@ -31,7 +31,8 @@ class User extends BaseController
public function index()
{
$user = Db::table('fa_user')->where('id',JWT_UID)->find();
- $this->apiSuccess('', ['nickname' => $user['nickname'],'avatar'=>$user['avatar']]);
+ $user_msg = Db::table('fa_szxc_information_usermsg')->where('user_id',JWT_UID)->field('id,name,address_name')->find();
+ $this->apiSuccess('', ['nickname' => $user['nickname'],'avatar'=>$user['avatar'],'address_name'=>$user_msg['address_name'],'name'=>$user_msg['name']]);
}
/**
diff --git a/app/api/controller/Userinfo.php b/app/api/controller/Userinfo.php
index ab3ac44..3200961 100644
--- a/app/api/controller/Userinfo.php
+++ b/app/api/controller/Userinfo.php
@@ -190,12 +190,12 @@ class Userinfo extends BaseController
// $ret = $this->auth->login($user['username'], '');
// if ($ret) {
//创建新Token
- $token = $this->getToken($user['id']);
- \app\common\library\Token::set($token, $user['id'], 2592000);
- $tokenInfo = \app\common\library\Token::get($token);
+// $token = $this->getToken($user['id']);
+// \app\common\library\Token::set($token, $user['id'], 2592000);
+// $tokenInfo = \app\common\library\Token::get($token);
+// $Userinfo['token'] = $tokenInfo['token'];
+// $Userinfo['expires_in'] = $tokenInfo['expires_in'];
$Userinfo = $user;
- $Userinfo['token'] = $tokenInfo['token'];
- $Userinfo['expires_in'] = $tokenInfo['expires_in'];
$Userinfo['user_id'] = $post['user_id'];
$userinfo_data['userinfo'] = $Userinfo;