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

feat: NG-27: Qualified bonus regulations 奖金合格制度:活动期间购买指定商品,BV≥27即可维持活跃度.

kevin 1 год назад
Родитель
Сommit
47e145c9b9
1 измененных файлов с 12 добавлено и 1 удалено
  1. 12 1
      common/helpers/bonus/Calc/PushBaseDataToCalc.php

+ 12 - 1
common/helpers/bonus/Calc/PushBaseDataToCalc.php

@@ -15,6 +15,7 @@ use common\models\CalcBonusQY;
 use common\models\CalcRecord;
 use common\models\EmployLevel;
 use common\models\forms\DeclarationForm;
+use common\models\Order;
 use common\models\PerfMonth;
 use common\models\PerfOrder;
 use common\models\PerfPeriod;
@@ -530,7 +531,17 @@ class PushBaseDataToCalc extends BaseBusiness
                     }
                     $field = implode(',', $fieldArray);
                     $model = 'common\models\\' . ucfirst($method);
-                    $data  = $model::find()->select($field)->limit($this->_limit)->offset($_offset * $this->_limit)->asArray()->all();
+
+                    $where = '1=1';
+                    if ($table == 'order') {
+                        $where = 'PERIOD_NUM=' . $this->_periodNum;
+                    }
+                    if ($table == 'orderGoods') {
+                        $orderSn = Order::find()->select(['SN'])->where('PERIOD_NUM=' . $this->_periodNum)->asArray()->all();
+                        $where = 'ORDER_SN IN (' . implode(',', $orderSn) . ')';
+                    }
+
+                    $data  = $model::find()->select($field)->where($where)->limit($this->_limit)->offset($_offset * $this->_limit)->asArray()->all();
                     if (!empty($data)) {
                         $_offset += 1;
                         \Yii::$app->$db->createCommand()->batchInsert($table, $fieldArray, $data)->execute();