Przeglądaj źródła

1. fix bug: 充值是否成为vip的临界点问题重新确认 2. 余额支付不产生积分与成长值(但记录消费)

shizhongqi 3 miesięcy temu
rodzic
commit
d6362a6333

+ 2 - 2
app-hd/controllers/ShopController.php

@@ -561,10 +561,10 @@ class ShopController extends BaseController
         $data = Yii::$app->request->post();
         $rechargeWeal = intval($data['rechargeRule']);
         $isVipMember = intval($data['isVipMember']);
-        if ($isVipMember == 1 && $data['vipAmount'] >= 0) {
+        if ($isVipMember == 1 && $data['vipAmount'] >= 0.01) {
             $reachVip = floatval($data['vipAmount']);
         } else {
-            $reachVip = -1;
+            $reachVip = 0;
         }
         $hbPayable = intval($data['hbPayable']);
         if ($rechargeWeal == 2 && $hbPayable == 0) {

+ 7 - 0
biz-hd/custom/models/Custom.php

@@ -12,6 +12,13 @@ class Custom extends Base
      */
     public $listend = true;
 
+    /**
+     * xhCustom 的 $notRecordGrowthAndIntegral 是否执行记录成功值与积分
+     *
+     * @var bool
+     */
+    public $recordGrowthAndIntegral = true;
+
     /**
      * mainId(运行时临时属性,不入库)。
      * 传递必要参数 mainId

+ 6 - 1
biz-hd/custom/observers/BuyAmountObserver.php

@@ -24,7 +24,7 @@ class BuyAmountObserver extends Behavior
 	{
 		/** @var ActiveRecord $model */
 		$model = $this->owner;
-		if ($model->listend === false) { //根据总开关判断是否执行记录积分与成长值变动
+		if ($model->listend === false) { //根据总开关判断是否执行记录
 		    return;
         }
 
@@ -59,6 +59,11 @@ class BuyAmountObserver extends Behavior
 		];
 		UserBuyAmountClass::add($consumeData);
 
+		// 判断是否执行记录成功值与积分
+		if ($model->recordGrowthAndIntegral === false) {
+		    return;
+        }
+
 		$oldGrowth = array_key_exists('growth', $event->changedAttributes)
 			? $event->changedAttributes['growth']
 			: $model->getAttribute('growth'); // changedAttributes 里没有 growth 时,说明这次更新没改 growth,这时直接取模型当前值即可(它就等于旧值)。

+ 4 - 0
biz-hd/order/classes/OrderClass.php

@@ -493,6 +493,10 @@ class OrderClass extends BaseClass
             if ($order->forward == 0) { //0 常规订单
                 $myCustom->recentExpend = date("Y-m-d H:i:s");
                 $myCustom->visitTime = date("Y-m-d H:i:s");
+                $shopExt = \bizHd\shop\classes\ShopExtClass::getByCondition(['shopId' => $order->shopId], false, false, 'reachVip');
+                if ($shopExt['reachVip'] > 0 && $payWay == dict::getDict('payWay', 'balancePay')) {
+                    $myCustom->recordGrowthAndIntegral = false;
+                }
                 $myCustom->buyAmount = bcadd($myCustom->buyAmount, $order->realPrice, 2);
                 $myCustom->eventRemark = trim($eventPrefix . '下单' . $orderSnText);
             } elseif ($order->forward == 1) { //1 售后付款单(红冲)