shish %!s(int64=3) %!d(string=hai) anos
pai
achega
c76d365598
Modificáronse 1 ficheiros con 11 adicións e 1 borrados
  1. 11 1
      app-ghs/controllers/StatKdController.php

+ 11 - 1
app-ghs/controllers/StatKdController.php

@@ -21,7 +21,17 @@ class StatKdController extends BaseController
         $get = Yii::$app->request->get();
         $contain = $get['contain'] ?? 0;
         $incomeList = StatKdClass::eachChannelIncome($this->mainId, $this->shop, $contain);
-        util::success(['list' => $incomeList]);
+
+        $totalIncome = 0;
+        if (!empty($incomeList)) {
+            foreach ($incomeList as $item) {
+                $amount = $item['amount'] ?? 0;
+                $totalIncome = bcadd($totalIncome, $amount, 2);
+                $totalIncome = floatval($totalIncome);
+            }
+        }
+
+        util::success(['list' => $incomeList, 'totalIncome' => $totalIncome]);
     }
 
 }