diff --git a/app/api/BaseController.php b/app/api/BaseController.php index 823bf71..2809d68 100644 --- a/app/api/BaseController.php +++ b/app/api/BaseController.php @@ -117,7 +117,7 @@ abstract class BaseController // } // $user = Db::table('fa_user')->where('id',$user['n_user_id'])->find(); // //$request->uid = $jwt_data['userid']; -// define('JWT_UID', $user['id']); +// define('$this->request->uid', $user['id']); // // $response = $next($request); // // return $response; // //return $next($request); @@ -135,7 +135,7 @@ abstract class BaseController // return json(['code'=>404,'msg'=>'非法请求']); // } // }else{ -// define('JWT_UID', ''); +// define('$this->request->uid', ''); // } // 暂时去除 ----------------------------------------------------- diff --git a/app/api/controller/ArticleComment.php b/app/api/controller/ArticleComment.php index 5ed2a74..4f59570 100644 --- a/app/api/controller/ArticleComment.php +++ b/app/api/controller/ArticleComment.php @@ -134,7 +134,7 @@ class ArticleComment extends BaseController{ $this->apiError('已结束议事不能投票'); } if ($input['type']!=0){ - $find=Db::table('fa_article_comment')->where('vote_id', $input['vote_id'])->where('user_id', JWT_UID)->find(); + $find=Db::table('fa_article_comment')->where('vote_id', $input['vote_id'])->where('user_id', $this->request->uid)->find(); if ($find){ return $this->apiError('只能投票一次'); } @@ -142,7 +142,7 @@ class ArticleComment extends BaseController{ if(empty($input['content'])){ $this->apiError('请输入投票内容'); } - $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find(); + $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); if ($useraddress) { $input['county'] = $useraddress['area_id']; @@ -150,7 +150,7 @@ class ArticleComment extends BaseController{ $input['village'] = $useraddress['village_id']; } - $input['user_id']=JWT_UID; + $input['user_id']=$this->request->uid; $input['add_time']=date('Y-m-d H:i:s'); $res=Db::table('fa_article_comment')->save($input); if ($res){ @@ -185,7 +185,7 @@ class ArticleComment extends BaseController{ // if (!$res){ // return $this->apiError($this->validate->getError()); // } - $input['user_id'] = JWT_UID; + $input['user_id'] = $this->request->uid; $res=Db::table('fa_article_comment')->where('id',$id)->update($input); if ($res){ return $this->apiSuccess('修改成功'); diff --git a/app/api/controller/Census.php b/app/api/controller/Census.php index bf56404..6e909c0 100644 --- a/app/api/controller/Census.php +++ b/app/api/controller/Census.php @@ -18,8 +18,8 @@ class Census extends BaseController $post = get_params(); // //根据个人村id进行查询 -// if (JWT_UID) { -// $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); +// if ($this->request->uid) { +// $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); // if ($find) { // if ($find['auth_range']==1){ // $mmm[] = $where[] = ['b.village_id', '=', $find['village_id']]; diff --git a/app/api/controller/Ceshi.php b/app/api/controller/Ceshi.php index cd6e08c..38ca5b2 100644 --- a/app/api/controller/Ceshi.php +++ b/app/api/controller/Ceshi.php @@ -211,7 +211,7 @@ class Ceshi extends BaseController $utils = $app->getUtils(); $response = $utils->codeToSession($code); if ($response['openid']) { - $where['user_id'] = JWT_UID; + $where['user_id'] = $this->request->uid; $user = Db::table('fa_user_openid')->where($where)->find(); if ($user) { if (!empty($user['openid']) && $user['openid'] == $response['openid']) { @@ -224,7 +224,7 @@ class Ceshi extends BaseController $time = time(); $data = [ 'openid' => $response['openid'], - 'user_id' => JWT_UID, + 'user_id' => $this->request->uid, 'createtime' => $time, ]; $res = Db::table('fa_user_openid')->insert($data); @@ -277,7 +277,7 @@ class Ceshi extends BaseController $utils = $app->getUtils(); $response = $utils->codeToSession($code); if ($response['openid']) { - $where['user_id'] = JWT_UID; + $where['user_id'] = $this->request->uid; $user = Db::table('fa_user_openid')->where($where)->find(); if ($user) { if (!empty($user['official_account_openid']) && $user['official_account_openid'] == $response['openid']) { @@ -290,7 +290,7 @@ class Ceshi extends BaseController $time = time(); $data = [ 'official_account_openid' => $response['openid'], - 'user_id' => JWT_UID, + 'user_id' => $this->request->uid, 'createtime' => $time, ]; $res = Db::table('fa_user_openid')->insert($data); diff --git a/app/api/controller/Common.php b/app/api/controller/Common.php index 85966d3..6ac5279 100644 --- a/app/api/controller/Common.php +++ b/app/api/controller/Common.php @@ -150,7 +150,7 @@ class Common extends BaseController //// $urls= Env::get('APP.URL_MY')? Env::get('APP.URL_MY'):'https://ceshi.excellentkk.cn'; // $params = [ // 'admin_id' => 0, -// 'user_id' => (int) JWT_UID, +// 'user_id' => (int) $this->request->uid, // 'category' => $category, // 'filename' => mb_substr(htmlspecialchars(strip_tags($fileInfo['name'])), 0, 100), // 'filesize' => $fileInfo['size'], @@ -259,7 +259,7 @@ class Common extends BaseController $data['action'] = app('request')->action(); $data['uploadip'] = app('request')->ip(); $data['create_time'] = time(); - $data['user_id'] = JWT_UID ? JWT_UID : 0; + $data['user_id'] = $this->request->uid ? $this->request->uid : 0; if ($data['module'] = 'admin') { //通过后台上传的文件直接审核通过 $data['status'] = 1; diff --git a/app/api/controller/Cultural.php b/app/api/controller/Cultural.php index c06daef..e8562af 100644 --- a/app/api/controller/Cultural.php +++ b/app/api/controller/Cultural.php @@ -75,8 +75,8 @@ class Cultural extends BaseController unset($where[1]); } //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; @@ -88,7 +88,7 @@ class Cultural extends BaseController } // 登录返回村名和村地址 $cun_arr['cun_name'] = Db::table('fa_geo_village')->where('village_id', $find['village_id'])->value('village_name'); - $cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name'); + $cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $this->request->uid)->value('address_name'); }else{ $cun_arr = []; } @@ -217,8 +217,8 @@ class Cultural extends BaseController unset($where[1]); } // 如果登录 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; @@ -346,8 +346,8 @@ class Cultural extends BaseController ['status', '=', 1], ]; //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; diff --git a/app/api/controller/Index.php b/app/api/controller/Index.php index 6229f57..1669224 100644 --- a/app/api/controller/Index.php +++ b/app/api/controller/Index.php @@ -173,7 +173,7 @@ class Index extends BaseController */ public function demo() { - $uid = JWT_UID; + $uid = $this->request->uid; $userInfo = Db::table('fa_user')->where(['id' => $uid])->find(); $this->apiSuccess('请求成功', ['user' => $userInfo]); } @@ -186,7 +186,7 @@ class Index extends BaseController $id = $param['id']; //文章id $content = $param['content']; //投诉内容 $type = $param['type']??1; //标识(1文章/2朋友圈) - $user_id = JWT_UID;//用户的id + $user_id = $this->request->uid;//用户的id $where['article_id'] = $id; $where['user_id'] = $user_id; $where['type'] = $type; @@ -195,7 +195,7 @@ class Index extends BaseController $this->apiError('您已投诉!'); }else{ - $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find(); + $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); $data = []; if ($useraddress) { $data['county'] = $useraddress['area_id']; diff --git a/app/api/controller/Maintainentry.php b/app/api/controller/Maintainentry.php index 93447a0..00b4d31 100644 --- a/app/api/controller/Maintainentry.php +++ b/app/api/controller/Maintainentry.php @@ -62,14 +62,14 @@ class Maintainentry extends BaseController public function pickUpInfo() { //村id - $village_id = Db::table('fa_szxc_information_useraddress')->where('user_id',JWT_UID)->value('village_id'); + $village_id = Db::table('fa_szxc_information_useraddress')->where('user_id',$this->request->uid)->value('village_id'); //获取当前村总人数 $map['village_id'] = $village_id; $total = Db::table('fa_szxc_information_useraddress')->where($map)->count(); //获取已录入人数 $www[] = ['village_id','=',$village_id]; $www[] = ['status','=','1']; -// $www[] = ['enter_id','=',JWT_UID]; +// $www[] = ['enter_id','=',$this->request->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(); @@ -1225,7 +1225,7 @@ class Maintainentry extends BaseController if ($post) { Db::startTrans(); // 获取录入人地址 - $add = Db::table('fa_szxc_information_useraddress')->where('user_id',JWT_UID)->find(); + $add = Db::table('fa_szxc_information_useraddress')->where('user_id',$this->request->uid)->find(); if(empty($add)){ $this->apiError('录入出错,请联系系统管理员'); } @@ -1304,7 +1304,7 @@ class Maintainentry extends BaseController //写入用户信息表 $post['user_id'] = $userid; $post['createtime'] = $time; - $post['enter_id'] = JWT_UID; + $post['enter_id'] = $this->request->uid; $post['gender']= $post['gender_id']; $post['nation']=$post['nation_id']; $post['political_outlook']=$post['zzmm_id']; @@ -1525,7 +1525,7 @@ class Maintainentry extends BaseController Db::startTrans(); // 获取录入人地址 - $add = Db::table('fa_szxc_information_useraddress')->where('user_id',JWT_UID)->find(); + $add = Db::table('fa_szxc_information_useraddress')->where('user_id',$this->request->uid)->find(); if(empty($add)){ $this->apiError('录入出错,请联系系统管理员'); } @@ -1604,7 +1604,7 @@ class Maintainentry extends BaseController //写入用户信息表 $post['user_id'] = $userid; $post['createtime'] = $time; - $post['enter_id'] = JWT_UID; + $post['enter_id'] = $this->request->uid; $post['gender']= $post['gender_id']; $post['nation']=$post['nation_id']; $post['political_outlook']=$post['zzmm_id']; @@ -1626,7 +1626,7 @@ class Maintainentry extends BaseController Db::table('fa_szxc_information_useraddress')->strict(false)->insert($address_data); // 写入家庭成员表 - $my_user_id = JWT_UID; + $my_user_id = $this->request->uid; $f_where[] = ['user_ids','find in set',$my_user_id]; $family_arr = Db::table('fa_szxc_family')->where($f_where)->find(); if($family_arr){ @@ -1658,7 +1658,7 @@ class Maintainentry extends BaseController // 获取我的家庭成员 public function getmyFamily(){ //用户id - $user_id = JWT_UID; + $user_id = $this->request->uid; // 获取户主id $f_where[] = ['user_ids','find in set',$user_id]; diff --git a/app/api/controller/MyArticle.php b/app/api/controller/MyArticle.php index f53e5b9..13527c9 100644 --- a/app/api/controller/MyArticle.php +++ b/app/api/controller/MyArticle.php @@ -25,7 +25,7 @@ class MyArticle extends BaseController $where = [ ['status', '=', 1], ['category_id', '=', $category_id], - ['user_id', '=', JWT_UID] + ['user_id', '=', $this->request->uid] ]; if (!$category_id) { unset($where[1]); @@ -80,9 +80,9 @@ class MyArticle extends BaseController $select[$key]['is_read'] = Db::table('fa_article_comment')->where('vote_id',$value['id'])->value('is_read'); } - $name['address_name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name'); - $name['vartar'] = Db::table('fa_user')->where('id', JWT_UID)->value('avatar'); - $name['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('name'); + $name['address_name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $this->request->uid)->value('address_name'); + $name['vartar'] = Db::table('fa_user')->where('id', $this->request->uid)->value('avatar'); + $name['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $this->request->uid)->value('name'); return $this->apiSuccess('ok', ['list' => $select, 'count' => ['count' => $count, 'month_count' => $month_count],'actor'=>$name]); } @@ -99,7 +99,7 @@ class MyArticle extends BaseController $where = [ ['status', '=', 1], ['id', '=', $id], - ['user_id', '=', JWT_UID] + ['user_id', '=', $this->request->uid] ]; $find = Db::table('fa_article')->where($where)->withAttr('user_info', function ($data, $value) { diff --git a/app/api/controller/Notice.php b/app/api/controller/Notice.php index b263863..a52d5ea 100644 --- a/app/api/controller/Notice.php +++ b/app/api/controller/Notice.php @@ -25,7 +25,7 @@ class Notice extends BaseController */ public function list($page=1,$limit=10){ $where['status'] = 1; - $where['user_id'] = JWT_UID; + $where['user_id'] = $this->request->uid; $res = Db::table('cms_notice') ->where($where) ->field('id,user_id,title,content,create_time,is_read,read_time') @@ -40,7 +40,7 @@ class Notice extends BaseController public function count(){ $where['status'] = 1; $where['is_read'] = 0; - $where['user_id'] = JWT_UID; + $where['user_id'] = $this->request->uid; $res = Db::table('cms_notice') ->where($where) ->count(); @@ -56,7 +56,7 @@ class Notice extends BaseController $this->apiError('缺少参数'); } $where['id'] = $id; - $where['user_id'] = JWT_UID; + $where['user_id'] = $this->request->uid; $res = Db::table('cms_notice') ->where($where) ->find(); diff --git a/app/api/controller/Personal.php b/app/api/controller/Personal.php index 6022ce1..ee6f235 100644 --- a/app/api/controller/Personal.php +++ b/app/api/controller/Personal.php @@ -40,11 +40,11 @@ class Personal extends BaseController */ public function getCommentList() { - $user_id = JWT_UID; + $user_id = $this->request->uid; //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range'] == 1) { $where[] = $map[] = $map2[] = $whe2[] = ['village', '=', $find['village_id']]; @@ -135,11 +135,11 @@ class Personal extends BaseController */ public function oneCAlickAudit() { - $user_id = JWT_UID; + $user_id = $this->request->uid; //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range'] == 1) { $where[] = ['village', '=', $find['village_id']]; @@ -235,7 +235,7 @@ class Personal extends BaseController { $post = $this->request->post(); $time = time(); - $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find(); + $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); $data = []; if ($useraddress) { @@ -271,7 +271,7 @@ class Personal extends BaseController } } else {//添加 $post['createtime'] = $time; - $post['user_id'] = JWT_UID; + $post['user_id'] = $this->request->uid; $res = Db::table('fa_szxc_personal_news')->strict(false)->insert($post); if ($res) { $this->apiSuccess('发布成功', $res, 1); @@ -314,7 +314,7 @@ class Personal extends BaseController $this->apiError('请输入评论内容'); } - $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find(); + $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); $data = []; if ($useraddress) { $post['county'] = $useraddress['area_id']; @@ -324,7 +324,7 @@ class Personal extends BaseController $time = time(); $post['createtime'] = $time; - $post['user_id'] = JWT_UID; + $post['user_id'] = $this->request->uid; $res = Db::table('fa_szxc_personal_news_comment')->strict(false)->insert($post); if ($res) { $this->apiSuccess('操作成功', $res, 1); @@ -401,7 +401,7 @@ class Personal extends BaseController if(empty($category_id)){ $this->apiError('缺少参数'); } - $address = Db::table('fa_szxc_information_useraddress')->where('user_id',JWT_UID)->find(); + $address = Db::table('fa_szxc_information_useraddress')->where('user_id',$this->request->uid)->find(); if($address){ $where[] = ['county', '=', $address['area_id']]; $where[] = ['township', '=', $address['street_id']]; @@ -447,7 +447,7 @@ class Personal extends BaseController //获取当前区域朋友圈列表 public function getlists($page = 1){ - $address = Db::table('fa_szxc_information_useraddress')->where('user_id',JWT_UID)->find(); + $address = Db::table('fa_szxc_information_useraddress')->where('user_id',$this->request->uid)->find(); if($address){ $where[] = ['county', '=', $address['area_id']]; $where[] = ['township', '=', $address['street_id']]; @@ -482,7 +482,7 @@ class Personal extends BaseController //获取所有朋友圈列表 public function getalllist($page = 1){ -// $address = Db::table('fa_szxc_information_useraddress')->where('user_id',JWT_UID)->find(); +// $address = Db::table('fa_szxc_information_useraddress')->where('user_id',$this->request->uid)->find(); // if($address){ // $where[] = ['county', '=', $address['area_id']]; // $where[] = ['township', '=', $address['street_id']]; diff --git a/app/api/controller/User.php b/app/api/controller/User.php index aa4346b..3f2de73 100644 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -247,7 +247,7 @@ class User extends BaseController */ public function profile() { - $user = Db::table('fa_user')->where(['id' => JWT_UID])->find(); + $user = Db::table('fa_user')->where(['id' => $this->request->uid])->find(); // $username = $this->request->request('username'); $params = get_params(); $nickname = $params['nickname']; @@ -269,9 +269,9 @@ class User extends BaseController // $user->bio = $bio; // $user->save(); if($data){ - Db::table('fa_user')->where(['id' => JWT_UID])->update($data); + Db::table('fa_user')->where(['id' => $this->request->uid])->update($data); } - $user = Db::table('fa_user')->where(['id' => JWT_UID])->find(); + $user = Db::table('fa_user')->where(['id' => $this->request->uid])->find(); $new_user['nickname'] = $user['nickname']; $new_user['avatar'] = $user['avatar']; $this->apiSuccess('修改成功',$new_user); @@ -433,11 +433,11 @@ class User extends BaseController // 用户实名认证 public function realname(){ $params = get_params(); - $uid = JWT_UID; + $uid = $this->request->uid; $params['user_id'] = $uid; $is_have = Db::table('cms_szxc_user_authentication')->where('user_id',$uid)->find(); - $adds=Db::table('fa_szxc_information_useraddress')->where('user_id',JWT_UID)->find(); + $adds=Db::table('fa_szxc_information_useraddress')->where('user_id',$this->request->uid)->find(); $params['area_id']=$adds['area_id']; $params['street_id']=$adds['street_id']; $params['village_id']=$adds['village_id']; diff --git a/app/api/controller/Village.php b/app/api/controller/Village.php index f0981ec..c6c8181 100644 --- a/app/api/controller/Village.php +++ b/app/api/controller/Village.php @@ -54,7 +54,7 @@ class Village extends BaseController }) ->withAttr('is_dz', function ($value, $data) { // 判断redis - $user_id = JWT_UID; + $user_id = $this->request->uid; if($user_id){ $name = $user_id . $data['id']; $is_zan = Cache::store('redis')->get($name); @@ -99,7 +99,7 @@ class Village extends BaseController }) ->withAttr('is_dz', function ($value, $data) { // 判断redis - $user_id = JWT_UID; + $user_id = $this->request->uid; if($user_id){ $name = $user_id . $data['id']; $is_zan = Cache::store('redis')->get($name); @@ -130,7 +130,7 @@ class Village extends BaseController $news = Db::table('fa_szxc_village')->where($where)->field('id,title,address,people_num,images,views,likes,createtime,introduce,info,area_id,street_id,village_id')->find(); if ($news) { // 判断redis - $user_id = JWT_UID; + $user_id = $this->request->uid; if($user_id){ $name = $user_id . $news['id']; $is_zan = Cache::store('redis')->get($name); @@ -268,7 +268,7 @@ class Village extends BaseController }) ->withAttr('is_dz', function ($value, $data) { // 判断redis - $user_id = JWT_UID; + $user_id = $this->request->uid; if($user_id){ $name = $user_id . $data['id']; $is_zan = Cache::store('redis')->get($name); @@ -291,7 +291,7 @@ class Village extends BaseController // 我的村庄 public function get_my_village(){ - $user_id = JWT_UID; + $user_id = $this->request->uid; if (empty($user_id)) { $this->apiError('请先登录'); } @@ -319,7 +319,7 @@ class Village extends BaseController $news = Db::table('fa_szxc_village')->where($www)->field('id,title,address,people_num,images,views,likes,createtime,introduce,info,area_id,street_id,village_id')->find(); if ($news) { // 判断redis - $user_id = JWT_UID; + $user_id = $this->request->uid; if($user_id){ $name = $user_id . $news['id']; $is_zan = Cache::store('redis')->get($name); @@ -392,8 +392,8 @@ class Village extends BaseController $this->apiSuccess('获取成功', $news); } else { // 判断redis - if(JWT_UID){ - $name = JWT_UID . $address['village_id']; + if($this->request->uid){ + $name = $this->request->uid . $address['village_id']; $is_zan = Cache::store('redis')->get($name); if($is_zan){ $news['is_dz'] = 1; @@ -468,7 +468,7 @@ class Village extends BaseController // 点赞村庄 public function thumbs_up($id=0){ - $user_id = JWT_UID; + $user_id = $this->request->uid; if (empty($user_id)) { $this->apiError('请先登录'); } @@ -491,7 +491,7 @@ class Village extends BaseController // 我的镇 public function get_my_town(){ - $user_id = JWT_UID; + $user_id = $this->request->uid; if (empty($user_id)) { $this->apiError('请先登录'); } @@ -717,7 +717,7 @@ class Village extends BaseController }) ->withAttr('is_dz', function ($value, $data) { // 判断redis - $user_id = JWT_UID; + $user_id = $this->request->uid; if($user_id){ $name = $user_id . $data['id']; $is_zan = Cache::store('redis')->get($name); diff --git a/app/api/controller/party/Article.php b/app/api/controller/party/Article.php index 6f52f8d..961f6b3 100644 --- a/app/api/controller/party/Article.php +++ b/app/api/controller/party/Article.php @@ -33,8 +33,8 @@ class Article extends BaseController ['category_id','=', $category_id] ]; //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; @@ -79,7 +79,7 @@ class Article extends BaseController // if (!$res){ // return $this->apiError($valdate->getError()); // } - $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find(); + $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); if ($useraddress) { $input['county'] = $useraddress['area_id']; $input['township'] = $useraddress['street_id']; @@ -87,7 +87,7 @@ class Article extends BaseController } $input['add_time'] = date('Y-m-d H:i:s'); $input['view_time'] = date('Y-m-d H:i:s'); - $input['user_id'] = JWT_UID; + $input['user_id'] = $this->request->uid; $res=Db::table('fa_szxc_party_article')->save($input); if ($res){ return $this->apiSuccess('添加成功'); @@ -107,7 +107,7 @@ class Article extends BaseController // if (!$res){ // return $this->apiError($valdate->getError()); // } - $input['user_id'] = JWT_UID; + $input['user_id'] = $this->request->uid; $res=Db::table('fa_szxc_party_article')->where('id',$id)->update($input); if ($res){ return $this->apiSuccess('修改成功'); diff --git a/app/api/controller/party/Branch.php b/app/api/controller/party/Branch.php index d4014fa..87f6941 100644 --- a/app/api/controller/party/Branch.php +++ b/app/api/controller/party/Branch.php @@ -31,8 +31,8 @@ class Branch extends BaseController{ ['status','=', 1], ]; //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; diff --git a/app/api/controller/party/Vote.php b/app/api/controller/party/Vote.php index d6589c2..099411f 100644 --- a/app/api/controller/party/Vote.php +++ b/app/api/controller/party/Vote.php @@ -30,8 +30,8 @@ class Vote extends BaseController{ ['status','=', 1] ]; //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; @@ -111,13 +111,13 @@ class Vote extends BaseController{ if (!$res){ return $this->apiError($this->validate->getError()); } - $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find(); + $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); if ($useraddress) { $input['county'] = $useraddress['area_id']; $input['township'] = $useraddress['street_id']; $input['village'] = $useraddress['village_id']; } - $input['user_id']=JWT_UID; + $input['user_id']=$this->request->uid; $input['add_time']=date('Y-m-d H:i:s'); $res=$this->model->save($input); if ($res){ @@ -137,7 +137,7 @@ class Vote extends BaseController{ if (!$res){ return $this->apiError($this->validate->getError()); } - $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find(); + $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); if ($useraddress) { $input['county'] = $useraddress['area_id']; $input['township'] = $useraddress['street_id']; diff --git a/app/api/controller/party/VoteComment.php b/app/api/controller/party/VoteComment.php index 5d14a0d..39b832c 100644 --- a/app/api/controller/party/VoteComment.php +++ b/app/api/controller/party/VoteComment.php @@ -86,7 +86,7 @@ class VoteComment extends BaseController{ if (!$res){ return $this->apiError($this->validate->getError()); } - $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find(); + $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); if ($useraddress) { $input['county'] = $useraddress['area_id']; diff --git a/app/api/middleware.php b/app/api/middleware.php index e695fbe..5454cea 100644 --- a/app/api/middleware.php +++ b/app/api/middleware.php @@ -6,6 +6,5 @@ return [ //验证勾股cms是否完成安装 \app\home\middleware\Install::class, \app\api\middleware\AllowOriginMiddleware::class, - \app\api\middleware\Auth::class, ]; \ No newline at end of file diff --git a/app/api/route/api.php b/app/api/route/api.php new file mode 100644 index 0000000..a0218d2 --- /dev/null +++ b/app/api/route/api.php @@ -0,0 +1,174 @@ +middleware(\app\api\middleware\Auth::class); + +Route::group('/',function () { + Route::get('PublicBenefit/enroll', 'PublicBenefit/enroll'); + Route::get('PublicBenefit/Activites', 'PublicBenefit/Activites'); + Route::get('HouseDecoration/store', 'HouseDecoration/store'); + Route::get('HouseDecoration/case', 'HouseDecoration/case'); + /** + * 文创文章 + */ + Route::get('cultural/article', 'cultural/article'); + /** + * 全民打卡 + */ + Route::get('cultural/punchcard', 'cultural/punchcard'); + /** + * 官网攻略 + */ + Route::get('cultural/WebStrategy', 'cultural/WebStrategy'); + /** + * 热门活动 + */ + Route::get('cultural/hotparty', 'cultural/hotparty'); + /** + * 获取banner + */ + Route::get('Slide/get_slide', 'Slide/get_slide'); + /** + * 获取文章 + */ + Route::get('article/indexs', 'article/indexs'); + Route::get('article/details', 'article/details'); + Route::post('article_comment/post', 'article_comment/post'); + /** + * 获取分类 + */ + Route::get('common/category', 'common/category'); + Route::get('Village/get_ranking_town', 'Village/get_ranking_town'); + Route::get('Village/get_town_list', 'Village/get_town_list'); + Route::get('Village/get_ranking_list', 'Village/get_ranking_list'); + Route::get('Census/get_list', 'Census/get_list'); + Route::get('Village/get_village', 'Village/get_village'); + Route::get('Village/thumbs_up', 'Village/thumbs_up'); + Route::get('Village/get_detail', 'Village/get_detail'); + Route::get('Village/get_list', 'Village/get_list'); + Route::get('Village/get_json', 'Village/get_json'); + Route::get('common/get_brigade', 'common/get_brigade'); + Route::get('Userinfo/Binding', 'Userinfo/Binding'); + Route::get('city/get_area', 'common/get_area'); + Route::get('city/get_street', 'common/get_street'); + Route::get('city/get_village', 'common/get_village'); + Route::get('geo/area', 'geo/area'); + Route::get('geo/street', 'geo/street'); + Route::get('geo/village', 'geo/village'); + Route::get('geo/brigade', 'geo/brigade'); +}); + + diff --git a/app/api/route/party.php b/app/api/route/party.php index 3388df8..4ebc69c 100644 --- a/app/api/route/party.php +++ b/app/api/route/party.php @@ -58,7 +58,7 @@ Route::group('party',function () { Route::post('put', 'party.VoteComment/put'); Route::get('del', 'party.VoteComment/delete'); }); -}); +})->middleware(\app\api\middleware\Auth::class); Route::group('article',function () { Route::get('index', 'article/index');