修改jwt 定义

This commit is contained in:
mkm 2023-03-14 14:50:53 +08:00
parent d0eca41525
commit 31a36d55f4
17 changed files with 82 additions and 82 deletions

View File

@ -117,7 +117,7 @@ abstract class BaseController
// } // }
// $user = Db::table('fa_user')->where('id',$user['n_user_id'])->find(); // $user = Db::table('fa_user')->where('id',$user['n_user_id'])->find();
// //$request->uid = $jwt_data['userid']; // //$request->uid = $jwt_data['userid'];
// define('JWT_UID', $user['id']); // define('$this->request->uid', $user['id']);
// // $response = $next($request); // // $response = $next($request);
// // return $response; // // return $response;
// //return $next($request); // //return $next($request);
@ -135,7 +135,7 @@ abstract class BaseController
// return json(['code'=>404,'msg'=>'非法请求']); // return json(['code'=>404,'msg'=>'非法请求']);
// } // }
// }else{ // }else{
// define('JWT_UID', ''); // define('$this->request->uid', '');
// } // }
// 暂时去除 ----------------------------------------------------- // 暂时去除 -----------------------------------------------------

View File

@ -134,7 +134,7 @@ class ArticleComment extends BaseController{
$this->apiError('已结束议事不能投票'); $this->apiError('已结束议事不能投票');
} }
if ($input['type']!=0){ 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){ if ($find){
return $this->apiError('只能投票一次'); return $this->apiError('只能投票一次');
} }
@ -142,7 +142,7 @@ class ArticleComment extends BaseController{
if(empty($input['content'])){ if(empty($input['content'])){
$this->apiError('请输入投票内容'); $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) { if ($useraddress) {
$input['county'] = $useraddress['area_id']; $input['county'] = $useraddress['area_id'];
@ -150,7 +150,7 @@ class ArticleComment extends BaseController{
$input['village'] = $useraddress['village_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'); $input['add_time']=date('Y-m-d H:i:s');
$res=Db::table('fa_article_comment')->save($input); $res=Db::table('fa_article_comment')->save($input);
if ($res){ if ($res){
@ -185,7 +185,7 @@ class ArticleComment extends BaseController{
// if (!$res){ // if (!$res){
// return $this->apiError($this->validate->getError()); // 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); $res=Db::table('fa_article_comment')->where('id',$id)->update($input);
if ($res){ if ($res){
return $this->apiSuccess('修改成功'); return $this->apiSuccess('修改成功');

View File

@ -18,8 +18,8 @@ class Census extends BaseController
$post = get_params(); $post = get_params();
// //根据个人村id进行查询 // //根据个人村id进行查询
// if (JWT_UID) { // if ($this->request->uid) {
// $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); // $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
// if ($find) { // if ($find) {
// if ($find['auth_range']==1){ // if ($find['auth_range']==1){
// $mmm[] = $where[] = ['b.village_id', '=', $find['village_id']]; // $mmm[] = $where[] = ['b.village_id', '=', $find['village_id']];

View File

@ -211,7 +211,7 @@ class Ceshi extends BaseController
$utils = $app->getUtils(); $utils = $app->getUtils();
$response = $utils->codeToSession($code); $response = $utils->codeToSession($code);
if ($response['openid']) { if ($response['openid']) {
$where['user_id'] = JWT_UID; $where['user_id'] = $this->request->uid;
$user = Db::table('fa_user_openid')->where($where)->find(); $user = Db::table('fa_user_openid')->where($where)->find();
if ($user) { if ($user) {
if (!empty($user['openid']) && $user['openid'] == $response['openid']) { if (!empty($user['openid']) && $user['openid'] == $response['openid']) {
@ -224,7 +224,7 @@ class Ceshi extends BaseController
$time = time(); $time = time();
$data = [ $data = [
'openid' => $response['openid'], 'openid' => $response['openid'],
'user_id' => JWT_UID, 'user_id' => $this->request->uid,
'createtime' => $time, 'createtime' => $time,
]; ];
$res = Db::table('fa_user_openid')->insert($data); $res = Db::table('fa_user_openid')->insert($data);
@ -277,7 +277,7 @@ class Ceshi extends BaseController
$utils = $app->getUtils(); $utils = $app->getUtils();
$response = $utils->codeToSession($code); $response = $utils->codeToSession($code);
if ($response['openid']) { if ($response['openid']) {
$where['user_id'] = JWT_UID; $where['user_id'] = $this->request->uid;
$user = Db::table('fa_user_openid')->where($where)->find(); $user = Db::table('fa_user_openid')->where($where)->find();
if ($user) { if ($user) {
if (!empty($user['official_account_openid']) && $user['official_account_openid'] == $response['openid']) { if (!empty($user['official_account_openid']) && $user['official_account_openid'] == $response['openid']) {
@ -290,7 +290,7 @@ class Ceshi extends BaseController
$time = time(); $time = time();
$data = [ $data = [
'official_account_openid' => $response['openid'], 'official_account_openid' => $response['openid'],
'user_id' => JWT_UID, 'user_id' => $this->request->uid,
'createtime' => $time, 'createtime' => $time,
]; ];
$res = Db::table('fa_user_openid')->insert($data); $res = Db::table('fa_user_openid')->insert($data);

View File

@ -150,7 +150,7 @@ class Common extends BaseController
//// $urls= Env::get('APP.URL_MY')? Env::get('APP.URL_MY'):'https://ceshi.excellentkk.cn'; //// $urls= Env::get('APP.URL_MY')? Env::get('APP.URL_MY'):'https://ceshi.excellentkk.cn';
// $params = [ // $params = [
// 'admin_id' => 0, // 'admin_id' => 0,
// 'user_id' => (int) JWT_UID, // 'user_id' => (int) $this->request->uid,
// 'category' => $category, // 'category' => $category,
// 'filename' => mb_substr(htmlspecialchars(strip_tags($fileInfo['name'])), 0, 100), // 'filename' => mb_substr(htmlspecialchars(strip_tags($fileInfo['name'])), 0, 100),
// 'filesize' => $fileInfo['size'], // 'filesize' => $fileInfo['size'],
@ -259,7 +259,7 @@ class Common extends BaseController
$data['action'] = app('request')->action(); $data['action'] = app('request')->action();
$data['uploadip'] = app('request')->ip(); $data['uploadip'] = app('request')->ip();
$data['create_time'] = time(); $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') { if ($data['module'] = 'admin') {
//通过后台上传的文件直接审核通过 //通过后台上传的文件直接审核通过
$data['status'] = 1; $data['status'] = 1;

View File

@ -75,8 +75,8 @@ class Cultural extends BaseController
unset($where[1]); unset($where[1]);
} }
//根据个人村id进行查询 //根据个人村id进行查询
if (JWT_UID) { if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) { if ($find) {
if ($find['auth_range']==1){ if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']]; $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_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{ }else{
$cun_arr = []; $cun_arr = [];
} }
@ -217,8 +217,8 @@ class Cultural extends BaseController
unset($where[1]); unset($where[1]);
} }
// 如果登录 // 如果登录
if (JWT_UID) { if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) { if ($find) {
if ($find['auth_range']==1){ if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']]; $where[] = ['village', '=', $find['village_id']];
@ -346,8 +346,8 @@ class Cultural extends BaseController
['status', '=', 1], ['status', '=', 1],
]; ];
//根据个人村id进行查询 //根据个人村id进行查询
if (JWT_UID) { if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) { if ($find) {
if ($find['auth_range']==1){ if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']]; $where[] = ['village', '=', $find['village_id']];

View File

@ -173,7 +173,7 @@ class Index extends BaseController
*/ */
public function demo() public function demo()
{ {
$uid = JWT_UID; $uid = $this->request->uid;
$userInfo = Db::table('fa_user')->where(['id' => $uid])->find(); $userInfo = Db::table('fa_user')->where(['id' => $uid])->find();
$this->apiSuccess('请求成功', ['user' => $userInfo]); $this->apiSuccess('请求成功', ['user' => $userInfo]);
} }
@ -186,7 +186,7 @@ class Index extends BaseController
$id = $param['id']; //文章id $id = $param['id']; //文章id
$content = $param['content']; //投诉内容 $content = $param['content']; //投诉内容
$type = $param['type']??1; //标识1文章/2朋友圈 $type = $param['type']??1; //标识1文章/2朋友圈
$user_id = JWT_UID;//用户的id $user_id = $this->request->uid;//用户的id
$where['article_id'] = $id; $where['article_id'] = $id;
$where['user_id'] = $user_id; $where['user_id'] = $user_id;
$where['type'] = $type; $where['type'] = $type;
@ -195,7 +195,7 @@ class Index extends BaseController
$this->apiError('您已投诉!'); $this->apiError('您已投诉!');
}else{ }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 = []; $data = [];
if ($useraddress) { if ($useraddress) {
$data['county'] = $useraddress['area_id']; $data['county'] = $useraddress['area_id'];

View File

@ -62,14 +62,14 @@ class Maintainentry extends BaseController
public function pickUpInfo() public function pickUpInfo()
{ {
//村id //村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; $map['village_id'] = $village_id;
$total = Db::table('fa_szxc_information_useraddress')->where($map)->count(); $total = Db::table('fa_szxc_information_useraddress')->where($map)->count();
//获取已录入人数 //获取已录入人数
$www[] = ['village_id','=',$village_id]; $www[] = ['village_id','=',$village_id];
$www[] = ['status','=','1']; $www[] = ['status','=','1'];
// $www[] = ['enter_id','=',JWT_UID]; // $www[] = ['enter_id','=',$this->request->uid];
$have = Db::table('fa_szxc_information_usermsg')->where($www)->count(); $have = Db::table('fa_szxc_information_usermsg')->where($www)->count();
$man_num = Db::table('fa_szxc_information_usermsg')->where($www)->where('gender',1)->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(); $woman_num = Db::table('fa_szxc_information_usermsg')->where($www)->where('gender',2)->count();
@ -1225,7 +1225,7 @@ class Maintainentry extends BaseController
if ($post) { if ($post) {
Db::startTrans(); 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)){ if(empty($add)){
$this->apiError('录入出错,请联系系统管理员'); $this->apiError('录入出错,请联系系统管理员');
} }
@ -1304,7 +1304,7 @@ class Maintainentry extends BaseController
//写入用户信息表 //写入用户信息表
$post['user_id'] = $userid; $post['user_id'] = $userid;
$post['createtime'] = $time; $post['createtime'] = $time;
$post['enter_id'] = JWT_UID; $post['enter_id'] = $this->request->uid;
$post['gender']= $post['gender_id']; $post['gender']= $post['gender_id'];
$post['nation']=$post['nation_id']; $post['nation']=$post['nation_id'];
$post['political_outlook']=$post['zzmm_id']; $post['political_outlook']=$post['zzmm_id'];
@ -1525,7 +1525,7 @@ class Maintainentry extends BaseController
Db::startTrans(); 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)){ if(empty($add)){
$this->apiError('录入出错,请联系系统管理员'); $this->apiError('录入出错,请联系系统管理员');
} }
@ -1604,7 +1604,7 @@ class Maintainentry extends BaseController
//写入用户信息表 //写入用户信息表
$post['user_id'] = $userid; $post['user_id'] = $userid;
$post['createtime'] = $time; $post['createtime'] = $time;
$post['enter_id'] = JWT_UID; $post['enter_id'] = $this->request->uid;
$post['gender']= $post['gender_id']; $post['gender']= $post['gender_id'];
$post['nation']=$post['nation_id']; $post['nation']=$post['nation_id'];
$post['political_outlook']=$post['zzmm_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); 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]; $f_where[] = ['user_ids','find in set',$my_user_id];
$family_arr = Db::table('fa_szxc_family')->where($f_where)->find(); $family_arr = Db::table('fa_szxc_family')->where($f_where)->find();
if($family_arr){ if($family_arr){
@ -1658,7 +1658,7 @@ class Maintainentry extends BaseController
// 获取我的家庭成员 // 获取我的家庭成员
public function getmyFamily(){ public function getmyFamily(){
//用户id //用户id
$user_id = JWT_UID; $user_id = $this->request->uid;
// 获取户主id // 获取户主id
$f_where[] = ['user_ids','find in set',$user_id]; $f_where[] = ['user_ids','find in set',$user_id];

View File

@ -25,7 +25,7 @@ class MyArticle extends BaseController
$where = [ $where = [
['status', '=', 1], ['status', '=', 1],
['category_id', '=', $category_id], ['category_id', '=', $category_id],
['user_id', '=', JWT_UID] ['user_id', '=', $this->request->uid]
]; ];
if (!$category_id) { if (!$category_id) {
unset($where[1]); 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'); $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['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', JWT_UID)->value('avatar'); $name['vartar'] = Db::table('fa_user')->where('id', $this->request->uid)->value('avatar');
$name['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('name'); $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]); return $this->apiSuccess('ok', ['list' => $select, 'count' => ['count' => $count, 'month_count' => $month_count],'actor'=>$name]);
} }
@ -99,7 +99,7 @@ class MyArticle extends BaseController
$where = [ $where = [
['status', '=', 1], ['status', '=', 1],
['id', '=', $id], ['id', '=', $id],
['user_id', '=', JWT_UID] ['user_id', '=', $this->request->uid]
]; ];
$find = Db::table('fa_article')->where($where)->withAttr('user_info', function ($data, $value) { $find = Db::table('fa_article')->where($where)->withAttr('user_info', function ($data, $value) {

View File

@ -25,7 +25,7 @@ class Notice extends BaseController
*/ */
public function list($page=1,$limit=10){ public function list($page=1,$limit=10){
$where['status'] = 1; $where['status'] = 1;
$where['user_id'] = JWT_UID; $where['user_id'] = $this->request->uid;
$res = Db::table('cms_notice') $res = Db::table('cms_notice')
->where($where) ->where($where)
->field('id,user_id,title,content,create_time,is_read,read_time') ->field('id,user_id,title,content,create_time,is_read,read_time')
@ -40,7 +40,7 @@ class Notice extends BaseController
public function count(){ public function count(){
$where['status'] = 1; $where['status'] = 1;
$where['is_read'] = 0; $where['is_read'] = 0;
$where['user_id'] = JWT_UID; $where['user_id'] = $this->request->uid;
$res = Db::table('cms_notice') $res = Db::table('cms_notice')
->where($where) ->where($where)
->count(); ->count();
@ -56,7 +56,7 @@ class Notice extends BaseController
$this->apiError('缺少参数'); $this->apiError('缺少参数');
} }
$where['id'] = $id; $where['id'] = $id;
$where['user_id'] = JWT_UID; $where['user_id'] = $this->request->uid;
$res = Db::table('cms_notice') $res = Db::table('cms_notice')
->where($where) ->where($where)
->find(); ->find();

View File

@ -40,11 +40,11 @@ class Personal extends BaseController
*/ */
public function getCommentList() public function getCommentList()
{ {
$user_id = JWT_UID; $user_id = $this->request->uid;
//根据个人村id进行查询 //根据个人村id进行查询
if (JWT_UID) { if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) { if ($find) {
if ($find['auth_range'] == 1) { if ($find['auth_range'] == 1) {
$where[] = $map[] = $map2[] = $whe2[] = ['village', '=', $find['village_id']]; $where[] = $map[] = $map2[] = $whe2[] = ['village', '=', $find['village_id']];
@ -135,11 +135,11 @@ class Personal extends BaseController
*/ */
public function oneCAlickAudit() public function oneCAlickAudit()
{ {
$user_id = JWT_UID; $user_id = $this->request->uid;
//根据个人村id进行查询 //根据个人村id进行查询
if (JWT_UID) { if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) { if ($find) {
if ($find['auth_range'] == 1) { if ($find['auth_range'] == 1) {
$where[] = ['village', '=', $find['village_id']]; $where[] = ['village', '=', $find['village_id']];
@ -235,7 +235,7 @@ class Personal extends BaseController
{ {
$post = $this->request->post(); $post = $this->request->post();
$time = time(); $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 = []; $data = [];
if ($useraddress) { if ($useraddress) {
@ -271,7 +271,7 @@ class Personal extends BaseController
} }
} else {//添加 } else {//添加
$post['createtime'] = $time; $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); $res = Db::table('fa_szxc_personal_news')->strict(false)->insert($post);
if ($res) { if ($res) {
$this->apiSuccess('发布成功', $res, 1); $this->apiSuccess('发布成功', $res, 1);
@ -314,7 +314,7 @@ class Personal extends BaseController
$this->apiError('请输入评论内容'); $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 = []; $data = [];
if ($useraddress) { if ($useraddress) {
$post['county'] = $useraddress['area_id']; $post['county'] = $useraddress['area_id'];
@ -324,7 +324,7 @@ class Personal extends BaseController
$time = time(); $time = time();
$post['createtime'] = $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); $res = Db::table('fa_szxc_personal_news_comment')->strict(false)->insert($post);
if ($res) { if ($res) {
$this->apiSuccess('操作成功', $res, 1); $this->apiSuccess('操作成功', $res, 1);
@ -401,7 +401,7 @@ class Personal extends BaseController
if(empty($category_id)){ if(empty($category_id)){
$this->apiError('缺少参数'); $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){ if($address){
$where[] = ['county', '=', $address['area_id']]; $where[] = ['county', '=', $address['area_id']];
$where[] = ['township', '=', $address['street_id']]; $where[] = ['township', '=', $address['street_id']];
@ -447,7 +447,7 @@ class Personal extends BaseController
//获取当前区域朋友圈列表 //获取当前区域朋友圈列表
public function getlists($page = 1){ 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){ if($address){
$where[] = ['county', '=', $address['area_id']]; $where[] = ['county', '=', $address['area_id']];
$where[] = ['township', '=', $address['street_id']]; $where[] = ['township', '=', $address['street_id']];
@ -482,7 +482,7 @@ class Personal extends BaseController
//获取所有朋友圈列表 //获取所有朋友圈列表
public function getalllist($page = 1){ 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){ // if($address){
// $where[] = ['county', '=', $address['area_id']]; // $where[] = ['county', '=', $address['area_id']];
// $where[] = ['township', '=', $address['street_id']]; // $where[] = ['township', '=', $address['street_id']];

View File

@ -247,7 +247,7 @@ class User extends BaseController
*/ */
public function profile() 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'); // $username = $this->request->request('username');
$params = get_params(); $params = get_params();
$nickname = $params['nickname']; $nickname = $params['nickname'];
@ -269,9 +269,9 @@ class User extends BaseController
// $user->bio = $bio; // $user->bio = $bio;
// $user->save(); // $user->save();
if($data){ 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['nickname'] = $user['nickname'];
$new_user['avatar'] = $user['avatar']; $new_user['avatar'] = $user['avatar'];
$this->apiSuccess('修改成功',$new_user); $this->apiSuccess('修改成功',$new_user);
@ -433,11 +433,11 @@ class User extends BaseController
// 用户实名认证 // 用户实名认证
public function realname(){ public function realname(){
$params = get_params(); $params = get_params();
$uid = JWT_UID; $uid = $this->request->uid;
$params['user_id'] = $uid; $params['user_id'] = $uid;
$is_have = Db::table('cms_szxc_user_authentication')->where('user_id',$uid)->find(); $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['area_id']=$adds['area_id'];
$params['street_id']=$adds['street_id']; $params['street_id']=$adds['street_id'];
$params['village_id']=$adds['village_id']; $params['village_id']=$adds['village_id'];

View File

@ -54,7 +54,7 @@ class Village extends BaseController
}) })
->withAttr('is_dz', function ($value, $data) { ->withAttr('is_dz', function ($value, $data) {
// 判断redis // 判断redis
$user_id = JWT_UID; $user_id = $this->request->uid;
if($user_id){ if($user_id){
$name = $user_id . $data['id']; $name = $user_id . $data['id'];
$is_zan = Cache::store('redis')->get($name); $is_zan = Cache::store('redis')->get($name);
@ -99,7 +99,7 @@ class Village extends BaseController
}) })
->withAttr('is_dz', function ($value, $data) { ->withAttr('is_dz', function ($value, $data) {
// 判断redis // 判断redis
$user_id = JWT_UID; $user_id = $this->request->uid;
if($user_id){ if($user_id){
$name = $user_id . $data['id']; $name = $user_id . $data['id'];
$is_zan = Cache::store('redis')->get($name); $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(); $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) { if ($news) {
// 判断redis // 判断redis
$user_id = JWT_UID; $user_id = $this->request->uid;
if($user_id){ if($user_id){
$name = $user_id . $news['id']; $name = $user_id . $news['id'];
$is_zan = Cache::store('redis')->get($name); $is_zan = Cache::store('redis')->get($name);
@ -268,7 +268,7 @@ class Village extends BaseController
}) })
->withAttr('is_dz', function ($value, $data) { ->withAttr('is_dz', function ($value, $data) {
// 判断redis // 判断redis
$user_id = JWT_UID; $user_id = $this->request->uid;
if($user_id){ if($user_id){
$name = $user_id . $data['id']; $name = $user_id . $data['id'];
$is_zan = Cache::store('redis')->get($name); $is_zan = Cache::store('redis')->get($name);
@ -291,7 +291,7 @@ class Village extends BaseController
// 我的村庄 // 我的村庄
public function get_my_village(){ public function get_my_village(){
$user_id = JWT_UID; $user_id = $this->request->uid;
if (empty($user_id)) { if (empty($user_id)) {
$this->apiError('请先登录'); $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(); $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) { if ($news) {
// 判断redis // 判断redis
$user_id = JWT_UID; $user_id = $this->request->uid;
if($user_id){ if($user_id){
$name = $user_id . $news['id']; $name = $user_id . $news['id'];
$is_zan = Cache::store('redis')->get($name); $is_zan = Cache::store('redis')->get($name);
@ -392,8 +392,8 @@ class Village extends BaseController
$this->apiSuccess('获取成功', $news); $this->apiSuccess('获取成功', $news);
} else { } else {
// 判断redis // 判断redis
if(JWT_UID){ if($this->request->uid){
$name = JWT_UID . $address['village_id']; $name = $this->request->uid . $address['village_id'];
$is_zan = Cache::store('redis')->get($name); $is_zan = Cache::store('redis')->get($name);
if($is_zan){ if($is_zan){
$news['is_dz'] = 1; $news['is_dz'] = 1;
@ -468,7 +468,7 @@ class Village extends BaseController
// 点赞村庄 // 点赞村庄
public function thumbs_up($id=0){ public function thumbs_up($id=0){
$user_id = JWT_UID; $user_id = $this->request->uid;
if (empty($user_id)) { if (empty($user_id)) {
$this->apiError('请先登录'); $this->apiError('请先登录');
} }
@ -491,7 +491,7 @@ class Village extends BaseController
// 我的镇 // 我的镇
public function get_my_town(){ public function get_my_town(){
$user_id = JWT_UID; $user_id = $this->request->uid;
if (empty($user_id)) { if (empty($user_id)) {
$this->apiError('请先登录'); $this->apiError('请先登录');
} }
@ -717,7 +717,7 @@ class Village extends BaseController
}) })
->withAttr('is_dz', function ($value, $data) { ->withAttr('is_dz', function ($value, $data) {
// 判断redis // 判断redis
$user_id = JWT_UID; $user_id = $this->request->uid;
if($user_id){ if($user_id){
$name = $user_id . $data['id']; $name = $user_id . $data['id'];
$is_zan = Cache::store('redis')->get($name); $is_zan = Cache::store('redis')->get($name);

View File

@ -33,8 +33,8 @@ class Article extends BaseController
['category_id','=', $category_id] ['category_id','=', $category_id]
]; ];
//根据个人村id进行查询 //根据个人村id进行查询
if (JWT_UID) { if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) { if ($find) {
if ($find['auth_range']==1){ if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']]; $where[] = ['village', '=', $find['village_id']];
@ -79,7 +79,7 @@ class Article extends BaseController
// if (!$res){ // if (!$res){
// return $this->apiError($valdate->getError()); // 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) { if ($useraddress) {
$input['county'] = $useraddress['area_id']; $input['county'] = $useraddress['area_id'];
$input['township'] = $useraddress['street_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['add_time'] = date('Y-m-d H:i:s');
$input['view_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); $res=Db::table('fa_szxc_party_article')->save($input);
if ($res){ if ($res){
return $this->apiSuccess('添加成功'); return $this->apiSuccess('添加成功');
@ -107,7 +107,7 @@ class Article extends BaseController
// if (!$res){ // if (!$res){
// return $this->apiError($valdate->getError()); // 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); $res=Db::table('fa_szxc_party_article')->where('id',$id)->update($input);
if ($res){ if ($res){
return $this->apiSuccess('修改成功'); return $this->apiSuccess('修改成功');

View File

@ -31,8 +31,8 @@ class Branch extends BaseController{
['status','=', 1], ['status','=', 1],
]; ];
//根据个人村id进行查询 //根据个人村id进行查询
if (JWT_UID) { if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) { if ($find) {
if ($find['auth_range']==1){ if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']]; $where[] = ['village', '=', $find['village_id']];

View File

@ -30,8 +30,8 @@ class Vote extends BaseController{
['status','=', 1] ['status','=', 1]
]; ];
//根据个人村id进行查询 //根据个人村id进行查询
if (JWT_UID) { if ($this->request->uid) {
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find();
if ($find) { if ($find) {
if ($find['auth_range']==1){ if ($find['auth_range']==1){
$where[] = ['village', '=', $find['village_id']]; $where[] = ['village', '=', $find['village_id']];
@ -111,13 +111,13 @@ class Vote extends BaseController{
if (!$res){ if (!$res){
return $this->apiError($this->validate->getError()); 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) { if ($useraddress) {
$input['county'] = $useraddress['area_id']; $input['county'] = $useraddress['area_id'];
$input['township'] = $useraddress['street_id']; $input['township'] = $useraddress['street_id'];
$input['village'] = $useraddress['village_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'); $input['add_time']=date('Y-m-d H:i:s');
$res=$this->model->save($input); $res=$this->model->save($input);
if ($res){ if ($res){
@ -137,7 +137,7 @@ class Vote extends BaseController{
if (!$res){ if (!$res){
return $this->apiError($this->validate->getError()); 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) { if ($useraddress) {
$input['county'] = $useraddress['area_id']; $input['county'] = $useraddress['area_id'];
$input['township'] = $useraddress['street_id']; $input['township'] = $useraddress['street_id'];

View File

@ -86,7 +86,7 @@ class VoteComment extends BaseController{
if (!$res){ if (!$res){
return $this->apiError($this->validate->getError()); 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) { if ($useraddress) {
$input['county'] = $useraddress['area_id']; $input['county'] = $useraddress['area_id'];