接口修改10

This commit is contained in:
彭桃 2023-02-14 18:01:16 +08:00
parent b767bff804
commit c3d84e9149

View File

@ -492,14 +492,14 @@ class Statistics extends BaseController
if ($post) {
if (isset($post['area_id']) && !empty($post['area_id'])) {
$where['area_id'] = $post['area_id'];
$where['area_id'] = $map['area_id'] = $post['area_id'];
}
if (isset($post['street_id']) && !empty($post['street_id'])) {
$where['street_id'] = $post['street_id'];
$where['street_id'] = $map['street_id'] = $post['street_id'];
}
if (isset($post['village_id']) && !empty($post['village_id'])) {
$where['village_id'] = $post['village_id'];
$where['village_id'] = $map['village_id'] = $post['village_id'];
}
}
@ -524,10 +524,16 @@ class Statistics extends BaseController
if($land_area_num >= 100000){
$land_area_num = bcdiv($land_area_num,10000).'万';
}
//总人数
$num1 = Db::table('fa_szxc_information_usermsg')->where($map)->where('status',1)->count();
//男
$num2 = Db::table('fa_szxc_information_usermsg')->where($map)->where('gender',1)->count();
//女
$num3 = Db::table('fa_szxc_information_usermsg')->where($map)->where('gender',2)->count();
$return = [
'villagernum' => 1000,
'mannum' => 600,
'wumannum' => 400,
'villagernum' => $num1,
'mannum' => $num2,
'wumannum' => $num3,
'married' => 600,
'unmarried' => 400,
'skillnum' => 20,
@ -580,30 +586,54 @@ class Statistics extends BaseController
public function get_num13($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
$where[] = ['u.area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
$where[] = ['u.street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
$where[] = ['u.village_id', '=', $village_id];
}
// 国家机关、党群组织、企业、事业单位负责人
$num1 = 1358;
$num1 = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_usermsg'=>'p'], 'u.user_id = p.user_id and p.occupation=77')->count();
// 专业技术人员
$num2 = 2578;
$num2 = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_usermsg'=>'p'], 'u.user_id = p.user_id and p.occupation=78')->count();
// 办事人员和有关人员
$num3 = 3684;
$num3 = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_usermsg'=>'p'], 'u.user_id = p.user_id and p.occupation=79')->count();
// 社会生产服务和生活服务人员
$num4 = 8524;
$num4 = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_usermsg'=>'p'], 'u.user_id = p.user_id and p.occupation=80')->count();
// 农、林、牧、渔业生产及辅助人员
$num5 = 9687;
$num5 = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_usermsg'=>'p'], 'u.user_id = p.user_id and p.occupation=81')->count();
// 生产、运输设备操作人员及有关人员
$num6 = 1458;
$num6 = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_usermsg'=>'p'], 'u.user_id = p.user_id and p.occupation=82')->count();
// 军人
$num7 = 998;
$num7 = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_usermsg'=>'p'], 'u.user_id = p.user_id and p.occupation=83')->count();
// 不便分类的其他从业人员
$num8 = 8745;
$num8 = Db::table('fa_szxc_information_useraddress')
->alias('u')
->where($where)
->join(['fa_szxc_information_usermsg'=>'p'], 'u.user_id = p.user_id and p.occupation=84')->count();
$return = [
['value'=>$num1,'name'=>'国家机关、党群组织、企业、事业单位负责人'],
@ -751,29 +781,29 @@ class Statistics extends BaseController
$where[] = ['b.village_id', '=', $village_id];
}
// $list = Db::connect('shop')->table('eb_merchant')
// ->alias('a')
// ->join('eb_merchant_address b','a.mer_id = b.mer_id')
// ->field('mer_name,real_name,mer_phone,mer_address,mer_keyword,mer_avatar,sales,category_id')
// ->withAttr('category',function ($value,$data){
// return Db::connect('shop')->table('eb_merchant_category')->where('merchant_category_id',$data['category_id'])->value('category_name');
// })
// ->where($where)
// ->select();
$list = Db::connect('shop')->table('eb_merchant')
->alias('a')
->join('eb_merchant_address b','a.mer_id = b.mer_id')
->field('mer_name,real_name,mer_phone,mer_address,mer_keyword,mer_avatar,sales,category_id')
->withAttr('category',function ($value,$data){
return Db::connect('shop')->table('eb_merchant_category')->where('merchant_category_id',$data['category_id'])->value('category_name');
})
->where($where)
->select();
// 先给假数据
$list = [
['mer_name'=>'得德店铺','category'=>'番茄,白菜','sales'=>'211','real_name'=>'赵德'],
['mer_name'=>'梦瑜店铺','category'=>'土豆,山药','sales'=>'365','real_name'=>'钱凯'],
['mer_name'=>'庆磊店铺','category'=>'玉米,萝卜','sales'=>'687','real_name'=>'孙佳镇'],
['mer_name'=>'先敬店铺','category'=>'鸡,鸭','sales'=>'456','real_name'=>'李需任'],
['mer_name'=>'葵魁店铺','category'=>'鱼,虾','sales'=>'527','real_name'=>'周开江'],
['mer_name'=>'泰盛店铺','category'=>'红薯,地瓜','sales'=>'369','real_name'=>'武艺'],
['mer_name'=>'瑞科店铺','category'=>'猪,羊','sales'=>'875','real_name'=>'郑成'],
['mer_name'=>'通骏店铺','category'=>'牛,鹅','sales'=>'489','real_name'=>'王爱国'],
['mer_name'=>'荫应店铺','category'=>'大米,小麦','sales'=>'702','real_name'=>'冯安康'],
['mer_name'=>'享翔店铺','category'=>'萝卜,白菜','sales'=>'635','real_name'=>'陈辰'],
];
// $list = [
// ['mer_name'=>'得德店铺','category'=>'番茄,白菜','sales'=>'211','real_name'=>'赵德'],
// ['mer_name'=>'梦瑜店铺','category'=>'土豆,山药','sales'=>'365','real_name'=>'钱凯'],
// ['mer_name'=>'庆磊店铺','category'=>'玉米,萝卜','sales'=>'687','real_name'=>'孙佳镇'],
// ['mer_name'=>'先敬店铺','category'=>'鸡,鸭','sales'=>'456','real_name'=>'李需任'],
// ['mer_name'=>'葵魁店铺','category'=>'鱼,虾','sales'=>'527','real_name'=>'周开江'],
// ['mer_name'=>'泰盛店铺','category'=>'红薯,地瓜','sales'=>'369','real_name'=>'武艺'],
// ['mer_name'=>'瑞科店铺','category'=>'猪,羊','sales'=>'875','real_name'=>'郑成'],
// ['mer_name'=>'通骏店铺','category'=>'牛,鹅','sales'=>'489','real_name'=>'王爱国'],
// ['mer_name'=>'荫应店铺','category'=>'大米,小麦','sales'=>'702','real_name'=>'冯安康'],
// ['mer_name'=>'享翔店铺','category'=>'萝卜,白菜','sales'=>'635','real_name'=>'陈辰'],
// ];
$this->apiSuccess('获取成功',$list);
}