From 43ed390805ea8e1b2f5a1d7210b57d48661f7538 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 15 Feb 2023 13:38:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B910?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Statistics.php | 40 +++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/app/api/controller/Statistics.php b/app/api/controller/Statistics.php index e7920b1..853d71c 100644 --- a/app/api/controller/Statistics.php +++ b/app/api/controller/Statistics.php @@ -794,8 +794,18 @@ class Statistics extends BaseController if ($village_id){ $where[] = ['village_id', '=', $village_id]; } + $find=Db::connect('shop')->table('eb_merchant_address')->where($where)->select(); + $list=[]; + if (empty($find)){ + foreach ($find as $k=>$v){ + $arr[]=$v['mer_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') + ->limit(10) + ->where('mer_id','in',$arr)->select(); + } - $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); } @@ -848,8 +858,18 @@ class Statistics extends BaseController // 镇分佣 $return['fenyong'] = 0; //总市场流量 - $return['liuliang'] = bcmul(bcdiv($z_order,$return['total_order'],2),100); -// $return['liuliang'] = 15; + $m=Db::connect('shop')->table('eb_product_order_log') + ->where($where) + ->where('status',1) + + ->count(); + $max=Db::connect('shop')->table('eb_product_order_log') + ->where('status',1) + ->count(); + if ($m!=0 && $max!=0){ + $m = bcmul(bcdiv($m,$max,3),100,1); + } + $return['liuliang'] = $m; $return['month'] = 12; // 商品销量前十 $return['data'] = Db::connect('shop')->table('eb_store_product') @@ -897,7 +917,7 @@ class Statistics extends BaseController ->select() ->toarray(); foreach ($return as $k =>$v){ - $return[$k]['demand'] = $v['value']; + $return[$k]['demand'] = ''; $return[$k]['minnum'] = [ ['month'=>'1月','value'=>0], ['month'=>'2月','value'=>$v['price']], @@ -1072,8 +1092,20 @@ class Statistics extends BaseController $m=Db::connect('shop')->table('eb_product_order_log') ->where($where) ->count(); + $max=Db::connect('shop')->table('eb_product_order_log') + ->where('mer_type_id',7) + ->count(); + if ($m!=0 && $max!=0){ + $m = bcmul(bcdiv($m,$max,3),100,1); + $max=100-$m; + }else{ + $m=0; + $max=0; + } + $return = [ ['name' => '种植','value'=>$m], + ['name' => '种植总销量','value'=>$max], ]; $this->apiSuccess('获取成功',$return); }