Explorar o código

财务统计相关变动

xialei hai 1 ano
pai
achega
55388bfb79

+ 99 - 28
app/common/repositories/finance/FinanceRepository.php

@@ -154,10 +154,12 @@ class FinanceRepository extends BaseRepository
154
         $userByCodeCount = array_column($userByCodeCount, 'count', 'temp1');
154
         $userByCodeCount = array_column($userByCodeCount, 'count', 'temp1');
155
 
155
 
156
         $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[1] ?? 0), 'name' => '消费者'];
156
         $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[1] ?? 0), 'name' => '消费者'];
157
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[2] ?? 0), 'name' => 'V客'];
158
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[3] ?? 0), 'name' => '大V经理'];
159
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[5] ?? 0), 'name' => '区县代理'];
160
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[6] ?? 0), 'name' => '省级代理'];
157
+        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[2] ?? 0), 'name' => '业务员'];
158
+        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[3] ?? 0), 'name' => '业务经理'];
159
+        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[5] ?? 0), 'name' => '初级合伙人'];
160
+        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[6] ?? 0), 'name' => '中级合伙人'];
161
+        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[7] ?? 0), 'name' => '高级合伙人'];
162
+        $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[8] ?? 0), 'name' => '董事'];
161
         $list1 = array(
163
         $list1 = array(
162
             array('className' => 'el-icon-s-goods', 'count' => intval($maker['4-2'] ?? 0), 'name' => '集团会员'),//is_show=2
164
             array('className' => 'el-icon-s-goods', 'count' => intval($maker['4-2'] ?? 0), 'name' => '集团会员'),//is_show=2
163
             array('className' => 'el-icon-s-goods', 'count' => intval($maker['4-1'] ?? 0), 'name' => '电商创客'),
165
             array('className' => 'el-icon-s-goods', 'count' => intval($maker['4-1'] ?? 0), 'name' => '电商创客'),
@@ -240,10 +242,34 @@ class FinanceRepository extends BaseRepository
240
                     $query->where('mer_id', $mer_id);
242
                     $query->where('mer_id', $mer_id);
241
                 })
243
                 })
242
                 ->where('day', $lastDay)->value('balance');
244
                 ->where('day', $lastDay)->value('balance');
245
+
246
+
243
             $integral = Db::name('user_sign_score')
247
             $integral = Db::name('user_sign_score')
244
                 ->where('pm', 1)
248
                 ->where('pm', 1)
245
-                ->whereBetween('settlement_time', date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600))
249
+                ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
246
                 ->sum('reward_socre');
250
                 ->sum('reward_socre');
251
+
252
+            $gongxian = Db::name('user_sign_gongxian')
253
+                ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
254
+                ->sum('number');
255
+
256
+            $jingdou = Db::name('user_sign_jingdou')
257
+                ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
258
+                ->sum('number');
259
+
260
+            $hongbao = Db::name('user_sign_hongbao')
261
+                ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
262
+                ->sum('number');
263
+
264
+            $fugou = Db::name('user_sign_fugou')
265
+                ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
266
+                ->sum('number');
267
+
268
+            $vr = Db::name('user_sign_vr')
269
+                ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
270
+                ->sum('number');
271
+
272
+
247
         } else if ($type == 2 and $day != '') {
273
         } else if ($type == 2 and $day != '') {
248
             $date = new \DateTime($day);
274
             $date = new \DateTime($day);
249
             $year = $date->format('Y');
275
             $year = $date->format('Y');
@@ -304,6 +330,27 @@ class FinanceRepository extends BaseRepository
304
                 ->where('pm', 1)
330
                 ->where('pm', 1)
305
                 ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
331
                 ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
306
                 ->sum('reward_socre');
332
                 ->sum('reward_socre');
333
+
334
+            $gongxian = Db::name('user_sign_gongxian')
335
+                ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
336
+                ->sum('number');
337
+
338
+            $jingdou = Db::name('user_sign_jingdou')
339
+                ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
340
+                ->sum('number');
341
+
342
+            $hongbao = Db::name('user_sign_hongbao')
343
+                ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
344
+                ->sum('number');
345
+
346
+            $fugou = Db::name('user_sign_fugou')
347
+                ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
348
+                ->sum('number');
349
+
350
+            $vr = Db::name('user_sign_vr')
351
+                ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
352
+                ->sum('number');
353
+
307
         } else {
354
         } else {
308
             $ruzhang = Db::name('enterprise_platform_income_detail')->where("deal_time <'" . date('Y-m-d H:i:s') . "'")
355
             $ruzhang = Db::name('enterprise_platform_income_detail')->where("deal_time <'" . date('Y-m-d H:i:s') . "'")
309
                 ->when($mer_id, function ($query) use ($mer_id) {
356
                 ->when($mer_id, function ($query) use ($mer_id) {
@@ -349,13 +396,28 @@ class FinanceRepository extends BaseRepository
349
             $integral = Db::name('user_sign_score')
396
             $integral = Db::name('user_sign_score')
350
                 ->where('pm', 1)
397
                 ->where('pm', 1)
351
                 ->sum('reward_socre');
398
                 ->sum('reward_socre');
399
+
400
+            $gongxian = Db::name('user_sign_gongxian')
401
+            ->sum('number');
402
+
403
+            $jingdou = Db::name('user_sign_jingdou')
404
+            ->sum('number');
405
+
406
+            $hongbao = Db::name('user_sign_hongbao')
407
+            ->sum('number');
408
+
409
+            $fugou = Db::name('user_sign_fugou')
410
+            ->sum('number');
411
+
412
+            $vr = Db::name('user_sign_vr')
413
+            ->sum('number');
352
         }
414
         }
353
 
415
 
354
 
416
 
355
         $yingyemoney = Db::name('store_order')->where($where)->sum('pay_price');
417
         $yingyemoney = Db::name('store_order')->where($where)->sum('pay_price');
356
         $hf_fee_amt = Db::name('store_order')->where($where_order)->sum('hf_fee_amt');//汇付手续费
418
         $hf_fee_amt = Db::name('store_order')->where($where_order)->sum('hf_fee_amt');//汇付手续费
357
 
419
 
358
-        return compact('yingyemoney', 'hf_fee_amt', 'my_money', 'tixinan', 'ruzhang', 'shouyi', 'jieyu', 'integral', 'yanglao');
420
+        return compact('yingyemoney', 'hf_fee_amt', 'my_money', 'tixinan', 'ruzhang', 'shouyi', 'jieyu', 'integral', 'yanglao', 'gongxian', 'jingdou', 'hongbao', 'fugou', 'vr');
359
 
421
 
360
     }
422
     }
361
 
423
 
@@ -402,6 +464,7 @@ class FinanceRepository extends BaseRepository
402
             });
464
             });
403
         $query1 = clone $query;
465
         $query1 = clone $query;
404
         $query2 = clone $query;
466
         $query2 = clone $query;
467
+        $query3 = clone $query;
405
         $data['list'] = $this->date_where($query, $where['date'], 'ub.create_time')
468
         $data['list'] = $this->date_where($query, $where['date'], 'ub.create_time')
406
             ->field('ub.bill_id,ub.title,ub.number,ub.take_time,ub.commission_type,u.uid,u.phone,u.nickname,u.user_group,ub.order_sn,ub.take_time,ub.status,ub.create_time')
469
             ->field('ub.bill_id,ub.title,ub.number,ub.take_time,ub.commission_type,u.uid,u.phone,u.nickname,u.user_group,ub.order_sn,ub.take_time,ub.status,ub.create_time')
407
             ->order('ub.bill_id', 'desc')
470
             ->order('ub.bill_id', 'desc')
@@ -415,28 +478,35 @@ class FinanceRepository extends BaseRepository
415
         $data['count'] = $query->count();
478
         $data['count'] = $query->count();
416
         $statistics = $query1->field('sum(ub.number) money,ub.commission_type')->group('ub.commission_type')->select()->toArray();
479
         $statistics = $query1->field('sum(ub.number) money,ub.commission_type')->group('ub.commission_type')->select()->toArray();
417
         $statistics = array_column($statistics, 'money', 'commission_type');
480
         $statistics = array_column($statistics, 'money', 'commission_type');
481
+
482
+        $statistics_tow = $query3->field('sum(ub.number) money,ub.status')->group('ub.status')->select()->toArray();
483
+        $statistics_tow = array_column($statistics_tow, 'money', 'status');
484
+
418
         //佣金类型 1代理费 2 消费佣金 3直推奖√ 4辖区佣金\r\n5 养老金√ 6 广告费 7 跨店奖励√ 8平台奖励 9渠道商\r\n10 推荐创客收益√ 11分红奖金√ 12区县代区域收益√ 13消费循环佣金  14-推荐代理收益√ 15邀请小区团长升级√ 16大V经理分享奖√ 17创客合伙人√ 18积分奖励√ 19创客补贴√' 20省级代理区域收益√
485
         //佣金类型 1代理费 2 消费佣金 3直推奖√ 4辖区佣金\r\n5 养老金√ 6 广告费 7 跨店奖励√ 8平台奖励 9渠道商\r\n10 推荐创客收益√ 11分红奖金√ 12区县代区域收益√ 13消费循环佣金  14-推荐代理收益√ 15邀请小区团长升级√ 16大V经理分享奖√ 17创客合伙人√ 18积分奖励√ 19创客补贴√' 20省级代理区域收益√
419
         $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim(array_sum($statistics)), 'name' => '佣金奖励总额'];
486
         $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim(array_sum($statistics)), 'name' => '佣金奖励总额'];
420
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[3] ?? 0), 'name' => '直推奖'];
421
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[16] ?? 0), 'name' => '大V经理分享奖'];
422
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[14] ?? 0), 'name' => '推荐代理商收益'];
423
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[10] ?? 0), 'name' => '推荐创客收益'];
424
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[12] ?? 0), 'name' => '区县代区域收益'];
425
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[20] ?? 0), 'name' => '省级代理区域收益'];
426
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[15] ?? 0), 'name' => '邀请小区团长升级奖'];
427
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[7] ?? 0), 'name' => '跨店奖励'];
428
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[19] ?? 0), 'name' => '创客实际补贴'];
487
+        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics_tow[1] ?? 0), 'name' => '已结算佣金'];
488
+        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics_tow[0] ?? 0), 'name' => '未结算佣金'];
489
+        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim(0), 'name' => '转VR佣金'];
490
+        $user_extra_money = Db::name('user_extract')->where('status', 1)->sum('extract_price');
491
+        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($user_extra_money), 'name' => '已提现佣金'];
492
+        $data['statistics'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($user_extra_money), 'name' => '已提现金额'];
493
+
494
+        // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[3] ?? 0), 'name' => '直推奖'];
495
+        // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[16] ?? 0), 'name' => '大V经理分享奖'];
496
+        // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[14] ?? 0), 'name' => '推荐代理商收益'];
497
+        // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[10] ?? 0), 'name' => '推荐创客收益'];
498
+        // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[12] ?? 0), 'name' => '区县代区域收益'];
499
+        // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[20] ?? 0), 'name' => '省级代理区域收益'];
500
+        // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[15] ?? 0), 'name' => '邀请小区团长升级奖'];
501
+        // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[7] ?? 0), 'name' => '跨店奖励'];
502
+        // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[19] ?? 0), 'name' => '创客实际补贴'];
429
 
503
 
430
         $statistics = $query2->field('sum(ub.number) money,ub.status')->group('ub.status')->select()->toArray();
504
         $statistics = $query2->field('sum(ub.number) money,ub.status')->group('ub.status')->select()->toArray();
431
         $statistics = array_column($statistics, 'money', 'status');
505
         $statistics = array_column($statistics, 'money', 'status');
506
+        $data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim(array_sum($statistics)), 'name' => '养老金总额'];
432
         $data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[1] ?? 0), 'name' => '已结算养老金'];
507
         $data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[1] ?? 0), 'name' => '已结算养老金'];
433
         $data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[0] ?? 0), 'name' => '未结算养老金'];
508
         $data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[0] ?? 0), 'name' => '未结算养老金'];
434
         $data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[-1] ?? 0), 'name' => '已失效养老金'];
509
         $data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[-1] ?? 0), 'name' => '已失效养老金'];
435
-        $user_extra_money = Db::name('user_extract')
436
-            ->where('status', 1)
437
-            ->sum('extract_price');
438
-        $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($user_extra_money), 'name' => '已提现金额'];
439
-        $data['statistics'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($user_extra_money), 'name' => '已提现金额'];
440
         return $data;
510
         return $data;
441
     }
511
     }
442
 
512
 
@@ -564,9 +634,9 @@ class FinanceRepository extends BaseRepository
564
         $date['statistics']['all'] = decimal2($query1->where('pm', 1)->sum('reward_socre'));
634
         $date['statistics']['all'] = decimal2($query1->where('pm', 1)->sum('reward_socre'));
565
         $date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->where('pm', 1)->sum('reward_socre'));
635
         $date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->where('pm', 1)->sum('reward_socre'));
566
         $date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->where('pm', 1)->sum('reward_socre'));
636
         $date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->where('pm', 1)->sum('reward_socre'));
567
-        $date['statistics']['lost'] = decimal2($query4->where('uss.status', 0)->where('pm', 1)->sum('reward_socre'));
568
-        $date['statistics']['deduct'] = decimal2($query5->where('uss.status', 1)->where('pm', 2)->sum('reward_socre'));
569
-        $date['statistics']['all_mp1'] = decimal2($query6->where('uss.status', 1)->where('pm', 1)->sum('reward_socre') - $query7->where('uss.status', 1)->where('pm', 2)->sum('reward_socre'));
637
+        $date['statistics']['lost'] = decimal2($query4->where('pm', 2)->sum('reward_socre'));
638
+        // $date['statistics']['deduct'] = decimal2($query5->where('uss.status', 1)->where('pm', 2)->sum('reward_socre'));
639
+        // $date['statistics']['all_mp1'] = decimal2($query6->where('uss.status', 1)->where('pm', 1)->sum('reward_socre') - $query7->where('uss.status', 1)->where('pm', 2)->sum('reward_socre'));
570
 
640
 
571
         return $date;
641
         return $date;
572
     }
642
     }
@@ -629,7 +699,7 @@ class FinanceRepository extends BaseRepository
629
         $date['statistics']['all'] = decimal2($query1->sum('number'));
699
         $date['statistics']['all'] = decimal2($query1->sum('number'));
630
         $date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->sum('number'));
700
         $date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->sum('number'));
631
         $date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->sum('number'));
701
         $date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->sum('number'));
632
-        $date['statistics']['lost'] = decimal2($query4->where('uss.status', 0)->sum('number'));
702
+        $date['statistics']['lost'] = decimal2($query4->where('uss.type', 2)->sum('number'));
633
  
703
  
634
         return $date;
704
         return $date;
635
     }
705
     }
@@ -680,7 +750,7 @@ class FinanceRepository extends BaseRepository
680
         $date['list'] = $this->date_where($query, $where['date'], 'uss.addtime', '-', 2)
750
         $date['list'] = $this->date_where($query, $where['date'], 'uss.addtime', '-', 2)
681
             ->field('uss.id,uss.addtime,u.nickname,u.phone,uss.number,o.order_sn,uss.status,uss.mark,u.score')
751
             ->field('uss.id,uss.addtime,u.nickname,u.phone,uss.number,o.order_sn,uss.status,uss.mark,u.score')
682
             ->page($page, $limit)
752
             ->page($page, $limit)
683
-            ->order('uss.id', 'desc')
753
+            ->order('uss.number', 'desc')
684
             ->select()
754
             ->select()
685
             ->each(function ($item) {
755
             ->each(function ($item) {
686
                 $item['mark'] = $item['mark'];
756
                 $item['mark'] = $item['mark'];
@@ -754,7 +824,7 @@ class FinanceRepository extends BaseRepository
754
         $date['statistics']['all'] = decimal2($query1->sum('number'));
824
         $date['statistics']['all'] = decimal2($query1->sum('number'));
755
         $date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->sum('number'));
825
         $date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->sum('number'));
756
         $date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->sum('number'));
826
         $date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->sum('number'));
757
-        $date['statistics']['lost'] = decimal2($query4->where('uss.status', 0)->sum('number'));
827
+        $date['statistics']['lost'] = decimal2($query4->where('uss.type', 2)->sum('number'));
758
  
828
  
759
         return $date;
829
         return $date;
760
     }
830
     }
@@ -816,7 +886,8 @@ class FinanceRepository extends BaseRepository
816
         $date['statistics']['all'] = decimal2($query1->sum('number'));
886
         $date['statistics']['all'] = decimal2($query1->sum('number'));
817
         $date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->sum('number'));
887
         $date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->sum('number'));
818
         $date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->sum('number'));
888
         $date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->sum('number'));
819
-        $date['statistics']['lost'] = decimal2($query4->where('uss.status', 0)->sum('number'));
889
+        $date['statistics']['tixian'] = decimal2($query4->where('uss.status', 0)->sum('number'));
890
+        $date['statistics']['zhuan_vr'] = decimal2('0');
820
  
891
  
821
         return $date;
892
         return $date;
822
     }
893
     }
@@ -877,7 +948,7 @@ class FinanceRepository extends BaseRepository
877
             });
948
             });
878
         $date['count'] = $query->count();
949
         $date['count'] = $query->count();
879
         $date['statistics']['all'] = decimal2($query1->sum('number'));
950
         $date['statistics']['all'] = decimal2($query1->sum('number'));
880
-        $date['statistics']['clear'] = decimal2($query2->where('uss.type', 1)->sum('number'));
951
+        // $date['statistics']['clear'] = decimal2($query2->where('uss.type', 1)->sum('number'));
881
         $date['statistics']['nclear'] = decimal2($query3->where('uss.type', 2)->sum('number'));
952
         $date['statistics']['nclear'] = decimal2($query3->where('uss.type', 2)->sum('number'));
882
  
953
  
883
         return $date;
954
         return $date;

+ 33 - 23
app/controller/admin/finance/Finance.php

@@ -42,7 +42,7 @@ class Finance extends BaseController
42
             return app('json')->success($date);
42
             return app('json')->success($date);
43
         } catch (\Exception $e) {
43
         } catch (\Exception $e) {
44
             Db::name('log')->insert(['data' => '积分统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
44
             Db::name('log')->insert(['data' => '积分统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
45
-            return app('json')->fail('积分统计失败'.$e->getMessage());
45
+            return app('json')->fail('积分统计失败');
46
         }
46
         }
47
     }
47
     }
48
 
48
 
@@ -58,7 +58,7 @@ class Finance extends BaseController
58
             return app('json')->success($date);
58
             return app('json')->success($date);
59
         } catch (\Exception $e) {
59
         } catch (\Exception $e) {
60
             Db::name('log')->insert(['data' => '京豆统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
60
             Db::name('log')->insert(['data' => '京豆统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
61
-            return app('json')->fail('京豆统计失败'.$e->getMessage());
61
+            return app('json')->fail('京豆统计失败');
62
         }
62
         }
63
     }
63
     }
64
 
64
 
@@ -75,7 +75,7 @@ class Finance extends BaseController
75
             return app('json')->success($date);
75
             return app('json')->success($date);
76
         } catch (\Exception $e) {
76
         } catch (\Exception $e) {
77
             Db::name('log')->insert(['data' => '贡献值统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
77
             Db::name('log')->insert(['data' => '贡献值统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
78
-            return app('json')->fail('贡献值统计失败'.$e->getMessage());
78
+            return app('json')->fail('贡献值统计失败');
79
         }
79
         }
80
     }
80
     }
81
 
81
 
@@ -93,7 +93,7 @@ class Finance extends BaseController
93
             return app('json')->success($date);
93
             return app('json')->success($date);
94
         } catch (\Exception $e) {
94
         } catch (\Exception $e) {
95
             Db::name('log')->insert(['data' => '复购金统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
95
             Db::name('log')->insert(['data' => '复购金统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
96
-            return app('json')->fail('复购金统计失败'.$e->getMessage());
96
+            return app('json')->fail('复购金统计失败');
97
         }
97
         }
98
     }
98
     }
99
 
99
 
@@ -111,7 +111,7 @@ class Finance extends BaseController
111
             return app('json')->success($date);
111
             return app('json')->success($date);
112
         } catch (\Exception $e) {
112
         } catch (\Exception $e) {
113
             Db::name('log')->insert(['data' => '红包统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
113
             Db::name('log')->insert(['data' => '红包统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
114
-            return app('json')->fail('红包统计失败'.$e->getMessage());
114
+            return app('json')->fail('红包统计失败');
115
         }
115
         }
116
     }
116
     }
117
 
117
 
@@ -130,7 +130,7 @@ class Finance extends BaseController
130
             return app('json')->success($date);
130
             return app('json')->success($date);
131
         } catch (\Exception $e) {
131
         } catch (\Exception $e) {
132
             Db::name('log')->insert(['data' => 'VR统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
132
             Db::name('log')->insert(['data' => 'VR统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
133
-            return app('json')->fail('VR统计失败'.$e->getMessage());
133
+            return app('json')->fail('VR统计失败');
134
         }
134
         }
135
     }
135
     }
136
 
136
 
@@ -159,24 +159,34 @@ class Finance extends BaseController
159
      */
159
      */
160
     public function transaction_overview()
160
     public function transaction_overview()
161
     {
161
     {
162
-        $type = input('type', 1);
163
-        $day = input('day', '');
164
-        $mer_id = $this->request->merId();
165
 
162
 
166
-        $financeRepository = app()->make(FinanceRepository::class);
167
-        $arr = $financeRepository->jieyu($type,$day,$mer_id);
168
-
169
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['yingyemoney']), 'name' => '营业总额'];
170
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['ruzhang']), 'name' => '入账总额'];
171
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['shouyi']), 'name' => '佣金奖励总额'];
172
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['jieyu']), 'name' => '结余总额'];
173
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['hf_fee_amt']), 'name' => '汇付通道服务费金额'];
174
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['integral']), 'name' => '积分总数'];
175
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['tixinan']), 'name' => '提现支出总额'];
176
-        $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['yanglao']), 'name' => '养老金总额'];
177
-
178
-
179
-        return app('json')->success('ok', $data);
163
+        try {
164
+            $type = input('type', 1);
165
+            $day = input('day', '');
166
+            $mer_id = $this->request->merId();
167
+    
168
+            $financeRepository = app()->make(FinanceRepository::class);
169
+            $arr = $financeRepository->jieyu($type,$day,$mer_id);
170
+    
171
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['yingyemoney']), 'name' => '营业总额'];
172
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['ruzhang']), 'name' => '入账总额'];
173
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['shouyi']), 'name' => '佣金奖励总额'];
174
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['jieyu']), 'name' => '结余总额'];
175
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['hf_fee_amt']), 'name' => '汇付通道服务费金额'];
176
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['integral']), 'name' => '积分总数'];
177
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['tixinan']), 'name' => '提现支出总额'];
178
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['yanglao']), 'name' => '养老金总额'];
179
+    
180
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['gongxian']), 'name' => '贡献值总额'];
181
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['jingdou']), 'name' => '京豆总额'];
182
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['hongbao']), 'name' => '红包总额'];
183
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['fugou']), 'name' => '复购金总额'];
184
+            $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($arr['vr']), 'name' => 'VR总额'];
185
+            return app('json')->success('ok', $data);
186
+        } catch (\Exception $e) {
187
+            Db::name('log')->insert(['data' => '交易详情统计错误:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
188
+            return app('json')->fail('统计失败'. $e->getMessage());
189
+        }
180
     }
190
     }
181
 
191
 
182
     public function day_bill_list()
192
     public function day_bill_list()