This commit is contained in:
彭桃 2023-02-09 16:33:35 +08:00
parent d4c1354ee7
commit d6f985b808
2 changed files with 24 additions and 20 deletions

View File

@ -31,7 +31,7 @@ class Analysis extends BaseController
public function index()
{
if (request()->isAjax()) {
$mmm = $www = [];
$mmm = $www = $where = [];
$post = get_params();
//权限组信息
@ -39,23 +39,23 @@ class Analysis extends BaseController
$find = Db::table('fa_szxc_information_useraddress')->where('admin_id', $this->adminInfo['id'])->find();
if ($find) {
if ($find['auth_range'] == 1) {
$mmm['b.village_id'] = $www['d.village_id'] = $find['village_id'];
$mmm['b.village_id'] = $www['d.village_id'] = $where[] = $find['village_id'];
} elseif ($find['auth_range'] == 2) {
$mmm['b.street_id'] = $www['d.street_id'] = $find['street_id'];
$mmm['b.street_id'] = $www['d.street_id'] = $where[] = $find['street_id'];
} elseif ($find['auth_range'] == 3) {
$mmm['b.area_id'] = $www['d.area_id'] = $find['area_id'];
$mmm['b.area_id'] = $www['d.area_id'] = $where[] = $find['area_id'];
}
}
}
if ($post) {
if (isset($post['area_id']) && !empty($post['area_id'])) {
$mmm['b.area_id'] = $www['d.area_id'] = $post['area_id'];
$mmm['b.area_id'] = $www['d.area_id'] = $where[] = $post['area_id'];
}
if (isset($post['street_id']) && !empty($post['street_id'])) {
$mmm['b.street_id'] = $www['d.street_id'] = $post['street_id'];
$mmm['b.street_id'] = $www['d.street_id'] = $where[] = $post['street_id'];
}
if (isset($post['village_id']) && !empty($post['village_id'])) {
$mmm['b.village_id'] = $www['d.village_id'] = $post['village_id'];
$mmm['b.village_id'] = $www['d.village_id'] = $where[] = $post['village_id'];
}
// if (isset($post['brigade_id']) && !empty($post['brigade_id'])) {
// $mmm['b.brigade_id'] = $www['d.brigade_id'] = $post['brigade_id'];
@ -66,7 +66,7 @@ class Analysis extends BaseController
$map[] = ['a.status','=',1];
$map[] = ['a.is_del','=',0];
//企业农产品销量
$list['num_2'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->join('nk_lihaink_cn.eb_product_order_log c','a.mer_id = c.mer_id')->where($mmm)->where($map)->where('c.status',1)->count();
$list['num_2'] = Db::table('eb_product_order_log')->where($where)->where('status',1)->where('mer_type_id','in','2,3')->count();
//本镇已录入的商户
$list['num_4'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->where($mmm)->where($map)->count();
@ -86,18 +86,18 @@ class Analysis extends BaseController
return table_assign(0, '', $result);
}
//权限组信息
$mmm = $www = [];
$mmm = $www = $where = [];
if ($this->adminInfo['group_access'] != 1) { //不是超级管理员
$www['admin_id'] = $this->adminInfo['id'];
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
if ($user_address) {
if ($user_address['auth_range'] == 1) {
$mmm['b.village_id'] = $www['d.village_id'] = $user_address['village_id'];
$mmm['b.village_id'] = $www['d.village_id'] = $where[] = $user_address['village_id'];
} elseif ($user_address['auth_range'] == 2) {
$mmm['b.street_id'] = $www['d.street_id'] = $user_address['street_id'];
$mmm['b.street_id'] = $www['d.street_id'] = $where[] = $user_address['street_id'];
} elseif ($user_address['auth_range'] == 3) {
$mmm['b.area_id'] = $www['d.area_id'] = $user_address['area_id'];
$mmm['b.area_id'] = $www['d.area_id'] = $where[] = $user_address['area_id'];
}
if ($user_address['auth_range'] <=3 &&$user_address['auth_range'] >=1 ) {
@ -129,7 +129,7 @@ class Analysis extends BaseController
$map[] = ['a.status','=',1];
$map[] = ['a.is_del','=',0];
//企业农产品销量
$list['num_2'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->join('nk_lihaink_cn.eb_product_order_log c','a.mer_id = c.mer_id')->where($mmm)->where($map)->where('c.status',1)->count();
$list['num_2'] = Db::table('eb_product_order_log')->where($where)->where('status',1)->where('mer_type_id','in','2,3')->count();
//本镇已录入的商户
$list['num_4'] = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->where($mmm)->where($map)->count();

View File

@ -320,14 +320,18 @@ class Statistics extends BaseController
$num5 = Db::table('fa_szxc_information_usermsg')->where('education',75)->where($where)->count();
//不详
$num6 = Db::table('fa_szxc_information_usermsg')->where('education',76)->where($where)->count();
$total = $num2 + $num3 + $num4 + $num5;
$bcdiv1 = bcmul(bcdiv($num2,$total,3),100,1);
$bcdiv2 = bcmul(bcdiv($num3,$total,3),100,1);
$bcdiv3 = bcmul(bcdiv($num4,$total,3),100,1);
$bcdiv4 = bcmul(bcdiv($num5,$total,3),100,1);
$return = [
['value'=>$num1,'name'=>'文盲及半文盲'],
['value'=>$num2,'name'=>'小学'],
['value'=>$num3,'name'=>'初中'],
['value'=>$num4,'name'=>'高中/技校/中专'],
['value'=>$num5,'name'=>'大学专科及以上'],
['value'=>$num6,'name'=>'不详'],
// ['value'=>$num1,'name'=>'文盲及半文盲'],
['value'=>$num2,'name'=>'小学','bfb'=>$bcdiv1],
['value'=>$num3,'name'=>'初中','bfb'=>$bcdiv2],
['value'=>$num4,'name'=>'高中/技校/中专','bfb'=>$bcdiv3],
['value'=>$num5,'name'=>'大学专科及以上','bfb'=>$bcdiv4],
// ['value'=>$num6,'name'=>'不详'],
];
$this->apiSuccess('获取成功',$return);
}