接口修改3

This commit is contained in:
彭桃 2023-02-15 16:13:16 +08:00
parent 5826fe2607
commit b1ba53c15a
2 changed files with 15 additions and 4 deletions

View File

@ -98,6 +98,9 @@ class Userinfo extends BaseController
if(!$post['idcard'] || !$post['area_id'] || !$post['street_id'] || !$post['village_id'] || !$post['name']){
$this->apiError('缺少参数');
}
if($post['phone'] == 'undefined'){
$this->apiError('手机号错误');
}
$where['id'] = $this->request->uid;
$post['user_id'] = $this->request->uid;
$user = Db::table('fa_user')->where($where)->field('id,nickname,group_id,mobile,avatar,username,createtime,score')->find();

View File

@ -214,16 +214,16 @@ class Village extends BaseController
if ($list) {
//级别1市级2区县3乡镇
if($list['level'] == 1){
$num1 = Db::table('fa_szxc_information_useraddress')->group('village_id')->count();
$num1 = Db::table('fa_szxc_village')->where('village_id','>',0)->where('status',1)->count();
$num2 = Db::table('fa_szxc_information_useraddress')->count();
$num3 = Db::table('fa_szxc_information_usermsg')->where('is_hz',1)->count();
}elseif($list['level'] == 2){
$num1 = Db::table('fa_szxc_information_useraddress')->where('area_id',$code)->group('village_id')->count();
$num1 = Db::table('fa_szxc_village')->where('area_id',$code)->where('village_id','>',0)->where('status',1)->count();
$num2 = Db::table('fa_szxc_information_useraddress')->where('area_id',$code)->count();
$num3 = Db::table('fa_szxc_information_usermsg')->where('is_hz',1)->where('area_id',$code)->count();
}
elseif($list['level'] == 3){
$num1 = Db::table('fa_szxc_information_useraddress')->where('street_id',$code)->group('village_id')->count();
$num1 = Db::table('fa_szxc_village')->where('street_id',$code)->where('village_id','>',0)->where('status',1)->count();
$num2 = Db::table('fa_szxc_information_useraddress')->where('street_id',$code)->count();
$num3 = Db::table('fa_szxc_information_usermsg')->where('is_hz',1)->where('street_id',$code)->count();
}else{
@ -238,7 +238,15 @@ class Village extends BaseController
];
$this->apiSuccess('获取成功', $list);
} else {
$this->apiError('获取失败');
$num1 = Db::table('fa_szxc_village')->where('street_id',$code)->where('village_id','>',0)->where('status',1)->count();
$num2 = Db::table('fa_szxc_information_useraddress')->where('street_id',$code)->count();
$num3 = Db::table('fa_szxc_information_usermsg')->where('is_hz',1)->where('street_id',$code)->count();
$list['data'] = [
['num'=>$num1,'text'=>'村庄数'],
['num'=>$num2,'text'=>'村民数'],
['num'=>$num3,'text'=>'户数'],
];
$this->apiSuccess('获取成功', $list);
}
}