shish 3 năm trước cách đây
mục cha
commit
8ffe1e9448
2 tập tin đã thay đổi với 47 bổ sung38 xóa
  1. 0 38
      app-pt/controllers/DebtController.php
  2. 47 0
      console/controllers/DebtController.php

+ 0 - 38
app-pt/controllers/DebtController.php

@@ -2,47 +2,9 @@
 
 namespace pt\controllers;
 
-use biz\shop\classes\ShopClass;
-use bizGhs\custom\classes\CustomClass;
-use bizGhs\order\classes\OrderClass;
-use common\components\wxUtil;
 use Yii;
 
 class DebtController extends BaseController
 {
     public $guestAccess = [];
-
-    // ./yii debt/init
-    public function actionInit()
-    {
-        $list = ShopClass::getAllByCondition(['ptStyle' => 2], null, '*', null, true);
-        if (!empty($list)) {
-            foreach ($list as $shop) {
-                $shopId = $shop->id ?? 0;
-                $mainId = $shop->mainId ?? 0;
-                $shopName = $shop->shopName ?? '';
-                $customList = CustomClass::getAllByCondition(['ownMainId' => $mainId], null, '*', null, true);
-                $customDebt = 0;
-                if (!empty($customList)) {
-                    foreach ($customList as $custom) {
-                        $debtAmount = $custom->debtAmount ?? 0;
-                        $customDebt = bcadd($customDebt, $debtAmount, 2);
-                    }
-                }
-                $orderDebt = 0;
-                $orderList = OrderClass::getAllByCondition(['shopId' => $shopId], null, '*', null, true);
-                if (!empty($orderList)) {
-                    foreach ($orderList as $order) {
-                        $remainDebtPrice = $order->remainDebtPrice ?? 0;
-                        $orderDebt = bcadd($remainDebtPrice, $orderDebt, 2);
-                    }
-                }
-                if (floatval($customDebt) != floatval($orderDebt)) {
-                    echo "门店:{$shopName} 订单和客户欠款不一致 \n";
-                }
-                //$lsShopId = $shop->lsShopId ?? 0;
-            }
-        }
-    }
-
 }

+ 47 - 0
console/controllers/DebtController.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace console\controllers;
+
+use yii\console\Controller;
+use biz\shop\classes\ShopClass;
+use bizGhs\custom\classes\CustomClass;
+use bizGhs\order\classes\OrderClass;
+use Yii;
+
+class DebtController extends Controller
+{
+
+    // ./yii debt/init
+    public function actionInit()
+    {
+        $list = ShopClass::getAllByCondition(['ptStyle' => 2], null, '*', null, true);
+        if (!empty($list)) {
+            foreach ($list as $shop) {
+                $shopId = $shop->id ?? 0;
+                $mainId = $shop->mainId ?? 0;
+                $shopName = $shop->shopName ?? '';
+                $customList = CustomClass::getAllByCondition(['ownMainId' => $mainId], null, '*', null, true);
+                $customDebt = 0;
+                if (!empty($customList)) {
+                    foreach ($customList as $custom) {
+                        $debtAmount = $custom->debtAmount ?? 0;
+                        $customDebt = bcadd($customDebt, $debtAmount, 2);
+                    }
+                }
+                $orderDebt = 0;
+                $orderList = OrderClass::getAllByCondition(['shopId' => $shopId], null, '*', null, true);
+                if (!empty($orderList)) {
+                    foreach ($orderList as $order) {
+                        $remainDebtPrice = $order->remainDebtPrice ?? 0;
+                        $orderDebt = bcadd($remainDebtPrice, $orderDebt, 2);
+                    }
+                }
+                if (floatval($customDebt) != floatval($orderDebt)) {
+                    echo "门店:{$shopName} 订单和客户欠款不一致 \n";
+                }
+                //$lsShopId = $shop->lsShopId ?? 0;
+            }
+        }
+    }
+
+}