Explorar el Código

昆明发货,客户算了一次打包费和运费,第二次就不再算了

包括正常下单和欠款下单
shish hace 2 años
padre
commit
c514008d4e

+ 10 - 2
app-hd/controllers/NoticeController.php

@@ -70,12 +70,20 @@ class NoticeController extends PublicController
             if ($capitalType == dict::getDict('capitalType', 'xhPurchase', 'id')) {
                 $cg = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
 
-                if (isset($cg->sendType) && $cg->sendType == 4) {
-                    //标记当天发快递方式已收一次包装费,岭南批发市场用的功能
+                if (isset($cg->localOrder) && $cg->localOrder == 1) {
+                    //昆明发货,客户算了一次打包费和运费,第二次就不再算了
                     $customId = $cg->customId ?? 0;
                     $current = date("Y_m_d");
                     $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
                     Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
+                } else {
+                    if (isset($cg->sendType) && $cg->sendType == 4) {
+                        //标记当天发快递方式已收一次包装费,岭南批发市场用的功能
+                        $customId = $cg->customId ?? 0;
+                        $current = date("Y_m_d");
+                        $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
+                        Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
+                    }
                 }
 
                 if (!empty($cg) && $cg->payStatus == 1) {

+ 21 - 2
app-hd/controllers/PurchaseController.php

@@ -319,6 +319,11 @@ class PurchaseController extends BaseController
                 if ($transType == 4 || $transType == 5) {
                     $packCost = 0;
                 }
+                //如果已经算过一次打包费和运费了,则不再费了
+                $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId);
+                if ($needAdd == false) {
+                    $packCost = 0;
+                }
 
                 $post['packCost'] = $packCost;
 
@@ -360,6 +365,13 @@ class PurchaseController extends BaseController
                         }
                     }
                 }
+
+                //如果已经算过一次打包费和运费了,则不再费了
+                $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId);
+                if ($needAdd == false) {
+                    $sendCost = 0;
+                }
+
                 $post['sendCost'] = $sendCost;
                 //标记为昆明到地方订单
                 $post['localOrder'] = 1;
@@ -461,11 +473,18 @@ class PurchaseController extends BaseController
             PurchaseService::debt($info);
             $transaction->commit();
 
-            if (isset($info->sendType) && $info->sendType == 4) {
-                //标记当天已收一次包装费,岭南批发市场用的功能
+            if (isset($info->localOrder) && $info->localOrder == 1) {
+                //昆明发货,客户算了一次打包费和运费,第二次就不再算了
                 $current = date("Y_m_d");
                 $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
                 Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
+            } else {
+                if (isset($info->sendType) && $info->sendType == 4) {
+                    //标记当天已收一次包装费,岭南批发市场用的功能
+                    $current = date("Y_m_d");
+                    $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
+                    Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
+                }
             }
 
             //app新订单通知