瀏覽代碼

统计数据

lizhen_gitee 1 年之前
父節點
當前提交
d67fd243eb
共有 1 個文件被更改,包括 17 次插入2 次删除
  1. 17 2
      application/api/controller/company/Index.php

+ 17 - 2
application/api/controller/company/Index.php

@@ -130,12 +130,27 @@ class Index extends Apic
     }
 
     public function datacenter_two(){
-        $usernumber = Db::name('user_wallet')->where('company_id',$this->auth->company_id)->count();
-        $summoney = Db::name('user_wallet')->where('company_id',$this->auth->company_id)->sum('money');
+        $usernumber = Db::name('user_wallet')->where('company_id',$this->auth->company_id)->count();//充卡客户数量
+        $summoney = Db::name('user_wallet')->where('company_id',$this->auth->company_id)->sum('money');//充卡余额
+        //客户类别
+        $comefrom_config = ['自然进店','平台引流','线下新客','老带新'];
+        $comefrom_bili = [];
+        $comefrom_array = [];
+        foreach($comefrom_config as $key => $val){
+            $number = Db::name('user_wallet')->where('company_id',$this->auth->company_id)->where('comefrom',$val)->count();
+            $bili = bcdiv($number*100,$usernumber,2).'%';
+
+            $comefrom_bili[] = $bili;
+            $comefrom_array[$val] = $bili;
+        }
 
+        //
         $result = [
             'usernumber' => $usernumber,
             'summoney' => $summoney,
+            'comefrom_config' => $comefrom_config,
+            'comefrom_bili'   => $comefrom_bili,
+            'comefrom_array'  => $comefrom_array,
         ];
 
         $this->success(1,$result);