|
@@ -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);
|