接口修改1
This commit is contained in:
parent
c39740a07e
commit
768afd684a
@ -256,36 +256,64 @@ class Statistics extends BaseController
|
||||
public function get_num5($area_id=0,$street_id=0,$village_id=0){
|
||||
$where = [];
|
||||
if ($area_id){
|
||||
$where[] = ['b.area_id', '=', $area_id];
|
||||
$where[] = ['u.area_id', '=', $area_id];
|
||||
}
|
||||
if ($street_id){
|
||||
$where[] = ['b.street_id', '=', $street_id];
|
||||
$where[] = ['u.street_id', '=', $street_id];
|
||||
}
|
||||
if ($village_id){
|
||||
$where[] = ['b.village_id', '=', $village_id];
|
||||
$where[] = ['u.village_id', '=', $village_id];
|
||||
}
|
||||
// 总耕地面积
|
||||
$num1 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',70)->where($where)->sum('land_area');
|
||||
//园地
|
||||
$num2 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',69)->where($where)->sum('land_area');
|
||||
//林地
|
||||
$num3 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',214)->where($where)->sum('land_area');
|
||||
//牧草地
|
||||
$num4 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',215)->where($where)->sum('land_area');
|
||||
//养殖
|
||||
$num5 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',216)->where($where)->sum('land_area');
|
||||
// 总面积
|
||||
$num = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.land_area');
|
||||
|
||||
//农田水利
|
||||
$sum_218 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=218')->sum('p.land_area');
|
||||
//坑塘
|
||||
$num6 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',217)->where($where)->sum('land_area');
|
||||
//农田水利设施用地
|
||||
$num7 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',218)->where($where)->sum('land_area');
|
||||
$sum_217 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=217')->sum('p.land_area');
|
||||
//养殖
|
||||
$sum_yz = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=216')->sum('p.land_area');
|
||||
//牧草地
|
||||
$sum_215 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=215')->sum('p.land_area');
|
||||
//林地
|
||||
$sum_214 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=214')->sum('p.land_area');
|
||||
//耕地
|
||||
$sum_70 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=70')->sum('p.land_area');
|
||||
//园地
|
||||
$sum_69 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.land_area');
|
||||
|
||||
$return = [
|
||||
['value'=>$num1,'name'=>'耕地面积'],
|
||||
['value'=>$num2,'name'=>'园地'],
|
||||
['value'=>$num3,'name'=>'林地'],
|
||||
['value'=>$num4,'name'=>'牧草地'],
|
||||
['value'=>$num5,'name'=>'养殖'],
|
||||
['value'=>$num6,'name'=>'坑塘'],
|
||||
['value'=>$num7,'name'=>'农田水利设施用地']
|
||||
['value'=>$sum_70,'name'=>'耕地面积','land'=>$num],
|
||||
['value'=>$sum_69,'name'=>'园地','land'=>$num],
|
||||
['value'=>$sum_214,'name'=>'林地','land'=>$num],
|
||||
['value'=>$sum_215,'name'=>'牧草地','land'=>$num],
|
||||
['value'=>$sum_yz,'name'=>'养殖','land'=>$num],
|
||||
['value'=>$sum_217,'name'=>'坑塘','land'=>$num],
|
||||
['value'=>$sum_218,'name'=>'农田水利设施用地','land'=>$num]
|
||||
];
|
||||
$this->apiSuccess('获取成功',$return);
|
||||
}
|
||||
@ -457,6 +485,40 @@ class Statistics extends BaseController
|
||||
public function get_num11()
|
||||
{
|
||||
// $return = "{villagernum:1000,mannum:600,wumannum:400,married:600,unmarried:400,skillnum:20,policynum:20,agriculture:20,Jobnum:105,landsum:800,wasteland:100,breeding:200,planting500}";
|
||||
|
||||
$where = [];
|
||||
$post = get_params();
|
||||
|
||||
if ($post) {
|
||||
if (isset($post['area_id']) && !empty($post['area_id'])) {
|
||||
$where['area_id'] = $post['area_id'];
|
||||
}
|
||||
if (isset($post['street_id']) && !empty($post['street_id'])) {
|
||||
$where['street_id'] = $post['street_id'];
|
||||
|
||||
}
|
||||
if (isset($post['village_id']) && !empty($post['village_id'])) {
|
||||
$where['village_id'] = $post['village_id'];
|
||||
}
|
||||
}
|
||||
|
||||
//土地总面积
|
||||
$land_area_num = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.land_area');
|
||||
// 荒地面积
|
||||
$waste_land_area = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.waste_land_area');
|
||||
//养殖面积
|
||||
$sum_216 = Db::table('fa_szxc_information_useraddress')
|
||||
->alias('u')
|
||||
->where($where)
|
||||
->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.breed_area');
|
||||
//种植面积
|
||||
$zz_mianji = $land_area_num - $sum_216 - $waste_land_area;
|
||||
$return = [
|
||||
'villagernum' => 1000,
|
||||
'mannum' => 600,
|
||||
@ -467,10 +529,10 @@ class Statistics extends BaseController
|
||||
'policynum' => 20,
|
||||
'agriculture' => 20,
|
||||
'Jobnum' => 105,
|
||||
'landsum' => 800,
|
||||
'wasteland' => 100,
|
||||
'breeding' => 200,
|
||||
'planting' => 500
|
||||
'landsum' => $land_area_num,
|
||||
'wasteland' => $waste_land_area,
|
||||
'breeding' => $sum_216,
|
||||
'planting' => $zz_mianji < 0 ? 0:$zz_mianji
|
||||
];
|
||||
$this->apiSuccess('获取成功', $return);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user