Browse Source

Merge branch 'master' into dev

shish 2 months ago
parent
commit
3b38cb9fe9
2 changed files with 18 additions and 13 deletions
  1. 18 11
      app-ghs/controllers/ConsoleController.php
  2. 0 2
      biz-ghs/order/classes/RefundOrderClass.php

+ 18 - 11
app-ghs/controllers/ConsoleController.php

@@ -125,23 +125,30 @@ class ConsoleController extends BaseController
         ]);
     }
 
-    //获取昨天的收入 ssh 20240830
+    /**
+     * 昨日各渠道收入合计(与 stat-kd/profile、kdIncome 页「合计」口径一致)
+     */
     public function actionGetYesterdayIncome()
     {
-        $mainId = $this->mainId;
-        $respond = StatSaleClass::profile($mainId);
-        $incomeList = $respond['income'] ?? [];
-        $sale = 0;
+        if (empty($this->mainId)) {
+            util::success(['income' => 0]);
+            return;
+        }
+        // 固定查昨日,避免与 kdIncome 选「昨天」日期不一致
+        Yii::$app->request->setQueryParams(array_merge(Yii::$app->request->get(), [
+            'searchTime' => 'yesterday',
+        ]));
+        $contain = intval(Yii::$app->request->get('contain', 0));
+        $return = StatKdClass::eachChannelIncome($this->mainId, $this->shop, $contain);
+        $incomeList = $return['incomeList'] ?? [];
+        $totalIncome = '0.00';
         if (!empty($incomeList)) {
-            //这里有二个地方同时要修改,请搜索关键词:index_show_income
             foreach ($incomeList as $item) {
-                if (isset($item['id']) && $item['id'] == 'allot') {
-                    continue;
-                }
-                $sale = bcadd($sale, $item['amount'], 2);
+                $amount = $item['amount'] ?? 0;
+                $totalIncome = bcadd($totalIncome, $amount, 2);
             }
         }
-        util::success(['income' => $sale]);
+        util::success(['income' => floatval($totalIncome)]);
     }
 
     //今日概况 ssh 20220723

+ 0 - 2
biz-ghs/order/classes/RefundOrderClass.php

@@ -338,12 +338,10 @@ class RefundOrderClass extends BaseClass
                 $order->realPrice = $currentRealPrice;
                 $order->save();
 
-                $purchaseId = intval($order->purchaseId ?? 0);
                 // 花店采购余额付:扣款在 xhGhsCustom/xhGhs 成对账户,不走 ghs 门店 main 余额
                 $pair = GhsRechargeSettleService::lockAccountPair($custom);
                 CustomClass::refundBalancePayToPair($pair['custom'], $pair['ghs'], $refund, $order);
 
-
             } elseif ($payWay == dict::getDict('payWay', 'cash')) {
                 $moneyData = [
                     'shopId' => $shopId,