shish il y a 1 jour
Parent
commit
366789fd93

+ 8 - 12
app-hd/controllers/NoticeController.php

@@ -192,14 +192,13 @@ class NoticeController extends PublicController
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                     }
                 } else {
-                    //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                    //标记当配送方式已成功下过单,后续不再要求门槛或加收费用
                     $customId = $cg->customId ?? 0;
                     $current = date("Y_m_d");
-                    if (isset($cg->sendType) && in_array($cg->sendType, [0, 4])) {
+                    if (isset($cg->sendType)) {
                         $key = 'ghs_custom_today_has_get_pack_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
 
-                        // 兼容快递收运费的情况
                         $sendKey = 'ghs_custom_today_has_get_send_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                     }
@@ -411,14 +410,13 @@ class NoticeController extends PublicController
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                     }
                 } else {
-                    //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                    //标记当配送方式已成功下过单,后续不再要求门槛或加收费用
                     $customId = $cg->customId ?? 0;
                     $current = date("Y_m_d");
-                    if (isset($cg->sendType) && in_array($cg->sendType, [0, 4])) {
+                    if (isset($cg->sendType)) {
                         $key = 'ghs_custom_today_has_get_pack_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
 
-                        // 兼容快递收运费的情况
                         $sendKey = 'ghs_custom_today_has_get_send_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                     }
@@ -579,14 +577,13 @@ class NoticeController extends PublicController
                     }
                 } else {
 
-                    //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                    //标记当配送方式已成功下过单,后续不再要求门槛或加收费用
                     $customId = $cg->customId ?? 0;
                     $current = date("Y_m_d");
-                    if (isset($cg->sendType) && in_array($cg->sendType, [0, 4])) {
+                    if (isset($cg->sendType)) {
                         $key = 'ghs_custom_today_has_get_pack_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
 
-                        // 兼容快递收运费的情况
                         $sendKey = 'ghs_custom_today_has_get_send_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                     }
@@ -836,14 +833,13 @@ class NoticeController extends PublicController
                                 Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                             }
                         } else {
-                                //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                                //标记当配送方式已成功下过单,后续不再要求门槛或加收费用
                                 $customId = $cg->customId ?? 0;
                                 $current = date("Y_m_d");
-                                if (isset($cg->sendType) && in_array($cg->sendType, [0, 4])) {
+                                if (isset($cg->sendType)) {
                                     $key = 'ghs_custom_today_has_get_pack_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                                     Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
 
-                                    // 兼容快递收运费的情况
                                     $sendKey = 'ghs_custom_today_has_get_send_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                                     Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                                 }

+ 3 - 3
app-hd/controllers/PurchaseController.php

@@ -1036,13 +1036,13 @@ class PurchaseController extends BaseController
                     Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                 }
             } else {
-                //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                //标记当配送方式已收一次包装费/运费,只要有成功单就标记,后续不再重复要求门槛或加收费用
                 $current = date("Y_m_d");
-                if (isset($info->sendType) && in_array($info->sendType, [0, 4])) {
+                if (isset($info->sendType)) {
                     $key = 'ghs_custom_today_has_get_pack_cost_' . $info->sendType . '_' . $current . '_' . $customId;
                     Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
 
-                    // 兼容快递收运费的情况
+                    // 兼容快递/送货/跑腿收运费或限制下单的情况
                     $sendKey = 'ghs_custom_today_has_get_send_cost_' . $info->sendType . '_' . $current . '_' . $customId;
                     Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                 }

+ 3 - 7
app-hd/controllers/ShMethodController.php

@@ -56,13 +56,9 @@ class ShMethodController extends BaseController
                     $hasPaidSendCost = ShMethodClass::isSendCostPaidToday($customId, $style);
                     $hasPaidPackCost = ShMethodClass::isPackPaidToday($customId, $style);
 
-                    // 如果是加收运费或加收包装费,并且今天已经收过对应的费用
-                    // 则将前端展示的条件清空(设为0),从而不再显示要收附加费的提示
-                    if ($unMeet === 0 && $hasPaidSendCost) {
-                        $config['minAmount'] = 0;
-                        $config['minNum'] = 0;
-                        $config['unMeetFee'] = 0;
-                    } elseif ($unMeet === 1 && $hasPaidPackCost) {
+                    // 如果是加收运费、加收包装费或不能下单,并且今天已经成功下单/收取过费用
+                    // 则将前端展示的条件清空(设为0),从而不再显示要收附加费或限制下单的提示
+                    if (($unMeet === 0 && $hasPaidSendCost) || ($unMeet === 1 && $hasPaidPackCost) || ($unMeet === 2 && ($hasPaidSendCost || $hasPaidPackCost))) {
                         $config['minAmount'] = 0;
                         $config['minNum'] = 0;
                         $config['unMeetFee'] = 0;

+ 4 - 0
biz-ghs/order/classes/ShMethodClass.php

@@ -255,6 +255,10 @@ class ShMethodClass extends BaseClass
 
         // 不满最低消费且不允许下单
         if ($unMeet === 2) {
+            // 如果当天该配送方式已成功下过单,不再限制,直接放行
+            if (self::isPackPaidToday($customId, $style) || self::isSendCostPaidToday($customId, $style)) {
+                return '';
+            }
             if ($minAmount > 0 && (float)$actPrice < $minAmount) {
                 return "满{$minAmount}元 可{$methodName}";
             }