shish před 3 roky
rodič
revize
0afccea511
1 změnil soubory, kde provedl 63 přidání a 0 odebrání
  1. 63 0
      app-hd/controllers/ConsoleController.php

+ 63 - 0
app-hd/controllers/ConsoleController.php

@@ -99,4 +99,67 @@ class ConsoleController extends BaseController
         util::success(['dict' => $dict, 'shop' => $shop]);
     }
 
+    //系统收入、客服收入、欠款
+    public function actionStrokeCount()
+    {
+
+        if (empty($this->mainId)) {
+            util::success([
+                'systemIncome' => 0,
+                'systemCount' => 0,
+                'debtCount' => 0,
+                'debtIncome' => 0,
+                'kfWxCount' => 0,
+                'kfWxIncome' => 0,
+                'cashCount' => 0,
+                'cashIncome' => 0,
+            ]);
+        }
+
+        $incomeList = \bizGhs\stat\classes\StatKdClass::eachChannelIncome($this->mainId, $this->shop);
+
+        $systemIncome1 = $incomeList['system']['category']['ls']['amount'] ?? 0;
+        $systemCount1 = $incomeList['system']['category']['ls']['num'] ?? 0;
+        $systemIncome2 = $incomeList['system']['category']['pf']['amount'] ?? 0;
+        $systemCount2 = $incomeList['system']['category']['pf']['num'] ?? 0;
+
+        $systemCount = bcadd($systemCount1, $systemCount2);
+        $systemIncome = bcadd($systemIncome1, $systemIncome2, 2);
+
+        $debtIncome1 = $incomeList['debt']['category']['ls']['amount'] ?? 0;
+        $debtCount1 = $incomeList['debt']['category']['ls']['num'] ?? 0;
+        $debtIncome2 = $incomeList['debt']['category']['pf']['amount'] ?? 0;
+        $debtCount2 = $incomeList['debt']['category']['pf']['num'] ?? 0;
+
+        $debtIncome = bcadd($debtIncome1, $debtIncome2, 2);
+        $debtCount = bcadd($debtCount1, $debtCount2);
+
+        $kfWxIncome1 = $incomeList['kfWx']['category']['ls']['amount'] ?? 0;
+        $kfWxCount1 = $incomeList['kfWx']['category']['ls']['num'] ?? 0;
+        $kfWxIncome2 = $incomeList['kfWx']['category']['pf']['amount'] ?? 0;
+        $kfWxCount2 = $incomeList['kfWx']['category']['pf']['num'] ?? 0;
+
+        $kfWxIncome = bcadd($kfWxIncome1, $kfWxIncome2, 2);
+        $kfWxCount = bcadd($kfWxCount1, $kfWxCount2);
+
+        $cashIncome1 = $incomeList['cash']['category']['ls']['amount'] ?? 0;
+        $cashCount1 = $incomeList['cash']['category']['ls']['num'] ?? 0;
+        $cashIncome2 = $incomeList['cash']['category']['pf']['amount'] ?? 0;
+        $cashCount2 = $incomeList['cash']['category']['pf']['num'] ?? 0;
+
+        $cashIncome = bcadd($cashIncome1, $cashIncome2, 2);
+        $cashCount = bcadd($cashCount1, $cashCount2);
+
+        util::success([
+            'systemIncome' => $systemIncome,
+            'systemCount' => $systemCount,
+            'debtCount' => $debtCount,
+            'debtIncome' => $debtIncome,
+            'kfWxCount' => $kfWxCount,
+            'kfWxIncome' => $kfWxIncome,
+            'cashCount' => $cashCount,
+            'cashIncome' => $cashIncome,
+        ]);
+    }
+
 }