Просмотр исходного кода

Merge branch 'clear-cg' into dev

shish 2 месяцев назад
Родитель
Сommit
100b5abc2e

+ 4 - 4
console/controllers/BalanceMergeController.php

@@ -43,9 +43,9 @@ class BalanceMergeController extends Controller
     protected function mergeCustomRows($dry)
     {
         $count = 0;
-        $where = ['and', ['>', 'debtAmount', 0]];
+        $where = ['debtAmount>' => 0];
         if ($this->columnExists('xhGhsCustom', 'balanceMerged')) {
-            $where = ['and', ['>', 'debtAmount', 0], ['balanceMerged' => 0]];
+            $where['balanceMerged'] = 0;
         }
         $list = CustomClass::getAllByCondition($where, null, '*', null, true);
         foreach ($list as $custom) {
@@ -66,9 +66,9 @@ class BalanceMergeController extends Controller
     protected function mergeGhsRows($dry)
     {
         $count = 0;
-        $where = ['and', ['>', 'debtAmount', 0]];
+        $where = ['debtAmount>' => 0];
         if ($this->columnExists('xhGhs', 'balanceMerged')) {
-            $where = ['and', ['>', 'debtAmount', 0], ['balanceMerged' => 0]];
+            $where['balanceMerged'] = 0;
         }
         $list = BizGhsClass::getAllByCondition($where, null, '*', null, true);
         foreach ($list as $ghs) {

+ 12 - 5
console/controllers/GhsPurchaseBalanceMergeController.php

@@ -49,11 +49,15 @@ class GhsPurchaseBalanceMergeController extends Controller
 
         $count = 0;
         $purchasePtStyles = $this->getGhsAppPurchasePtStyles();
-        $where = ['and', ['>', 'ownShopId', 0], ['in', 'ownPtStyle', $purchasePtStyles]];
+        // 本项目 conditionQuery 只支持哈希条件,不支持 Yii 的 ['and', ...] 写法
+        $where = [
+            'ownShopId>' => 0,
+            'ownPtStyle' => ['in', $purchasePtStyles],
+        ];
         if ($this->columnExists('xhGhs', 'balanceMerged')) {
-            $where = ['and', ['>', 'ownShopId', 0], ['in', 'ownPtStyle', $purchasePtStyles], ['balanceMerged' => 0]];
+            $where['balanceMerged'] = 0;
         } else {
-            $where = ['and', ['>', 'ownShopId', 0], ['in', 'ownPtStyle', $purchasePtStyles], ['>', 'debtAmount', 0]];
+            $where['debtAmount>'] = 0;
         }
 
         $list = BizGhsClass::getAllByCondition($where, null, 'id,ownShopId,ownPtStyle,balance,debtAmount,balanceMerged', null, true);
@@ -64,9 +68,12 @@ class GhsPurchaseBalanceMergeController extends Controller
         }
 
         // ownPtStyle 未回填的历史行:再扫 ownPtStyle=0,由 isGhsAppPurchaseSupplierRow 按门店 ptStyle 判定
-        $legacyWhere = ['and', ['>', 'ownShopId', 0], ['ownPtStyle' => 0]];
+        $legacyWhere = [
+            'ownShopId>' => 0,
+            'ownPtStyle' => 0,
+        ];
         if ($this->columnExists('xhGhs', 'balanceMerged')) {
-            $legacyWhere = ['and', ['>', 'ownShopId', 0], ['ownPtStyle' => 0], ['balanceMerged' => 0]];
+            $legacyWhere['balanceMerged'] = 0;
         }
         $legacyList = BizGhsClass::getAllByCondition($legacyWhere, null, 'id,ownShopId,ownPtStyle,balance,debtAmount,balanceMerged', null, true);
         foreach ($legacyList as $ghs) {