From cf81c9f4ebb29a3e1be17cdd414e36216b84f51f Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 14 Feb 2023 19:17:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Index.php | 8 ++- app/admin/controller/nk/Merchant.php | 2 +- app/admin/view/nk/merchant/index.html | 12 ++++ app/admin/view/nk/merchant/read.html | 4 ++ app/api/controller/Statistics.php | 81 +++++++++++++++------------ 5 files changed, 68 insertions(+), 39 deletions(-) diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 4c5d9ee..9b68589 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -45,9 +45,10 @@ class Index extends BaseController public function main() { if ($this->adminInfo['group_access']==4){ - return ' + $street_id=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->value('street_id'); + return << - 店铺地址 + {$read.mer_address} + diff --git a/app/api/controller/Statistics.php b/app/api/controller/Statistics.php index c87f924..9d83c94 100644 --- a/app/api/controller/Statistics.php +++ b/app/api/controller/Statistics.php @@ -348,12 +348,28 @@ 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(); +// $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); + if ($num2!=0){ + $bcdiv1 = bcmul(bcdiv($num2,$total,3),100,1); + }else{ + $bcdiv1=0; + } + if ($num3!=0){ + $bcdiv2 = bcmul(bcdiv($num3,$total,3),100,1); + }else{ + $bcdiv2=0; + } + if ($num4!=0){ + $bcdiv3 = bcmul(bcdiv($num4,$total,3),100,1); + }else{ + $bcdiv3=0; + } + if ($num5!=0){ + $bcdiv4 = bcmul(bcdiv($num5,$total,3),100,1); + }else{ + $bcdiv4=0; + } $return = [ // ['value'=>$num1,'name'=>'文盲及半文盲'], ['value'=>$num2,'name'=>'小学','bfb'=>$bcdiv1], @@ -685,15 +701,23 @@ class Statistics extends BaseController if ($village_id){ $where[] = ['village_id', '=', $village_id]; } + $find=Db::connect('shop')->table('eb_merchant_address')->where($where)->limit(6)->select(); + $count=Db::connect('shop')->table('eb_merchant_address')->where($where)->count(); + $select=[]; + if ($find){ + foreach ($find as $k=>$v){ + $arr[]=$v['mer_id']; + } + $select=Db::connect('shop')->table('eb_merchant')->where('mer_id','in',$arr)->field('mer_avatar value,mer_name name')->limit(6)->select(); + } + $product_price=Db::connect('shop')->table('eb_product_order_log')->where($where)->sum('product_price'); + $where[]=['group_id','=',14]; + $user_product_price=Db::connect('shop')->table('eb_product_order_log')->where($where)->sum('product_price'); - $return['msg'] = [['value'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230112/e0ce290ac9ff41da33f00f6ae72d02f1.png','name'=>'百合山药企业'], - ['value'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230112/e0ce290ac9ff41da33f00f6ae72d02f1.png','name'=>'通滩山药企业'], - ['value'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230112/e0ce290ac9ff41da33f00f6ae72d02f1.png','name'=>'百合土豆企业'], - ['value'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230112/e0ce290ac9ff41da33f00f6ae72d02f1.png','name'=>'云龙土豆企业'], - ['value'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230112/e0ce290ac9ff41da33f00f6ae72d02f1.png','name'=>'奇峰山药企业']]; - $return['total'] = '62'; - $return['xl'] = ['43','1.68']; - $return['cgl'] = ['24','1.21']; + $return['msg'] = $select; + $return['total'] = $count; + $return['xl'] = ['0',$product_price]; + $return['cgl'] = ['0',$user_product_price]; $this->apiSuccess('获取成功',$return); } @@ -754,15 +778,15 @@ class Statistics extends BaseController //企业直播 public function get_num18($area_id=0,$street_id=0,$village_id=0){ $where = []; -// if ($area_id){ -// $where[] = ['area_id', '=', $area_id]; -// } -// if ($street_id){ -// $where[] = ['street_id', '=', $street_id]; -// } -// if ($village_id){ -// $where[] = ['village_id', '=', $village_id]; -// } + if ($area_id){ + $where[] = ['area_id', '=', $area_id]; + } + if ($street_id){ + $where[] = ['street_id', '=', $street_id]; + } + if ($village_id){ + $where[] = ['village_id', '=', $village_id]; + } $list = Db::connect('shop')->table('eb_broadcast_room')->field('room_id,name,cover_img,share_img,start_time,end_time,anchor_name,anchor_wechat,phone,live_status')->where($where)->select(); $this->apiSuccess('获取成功',$list); @@ -791,19 +815,6 @@ class Statistics extends BaseController ->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'=>'陈辰'], -// ]; $this->apiSuccess('获取成功',$list); }