kevin_zhangl vor 2 Jahren
Ursprung
Commit
afa62336ac
1 geänderte Dateien mit 8 neuen und 5 gelöschten Zeilen
  1. 8 5
      common/models/forms/ApproachOrderForm.php

+ 8 - 5
common/models/forms/ApproachOrderForm.php

@@ -171,11 +171,7 @@ class ApproachOrderForm extends Model
         if (!$receiveAddress = ReceiveAddress::find()->where(' ID=:ID', [':ID' => $this->addressId])->asArray()->one()) {
             $this->addError($attribute, '收货地址不存在');
         } else {
-            if (($this->scenario == 'verifyIPay88') && (!$receiveAddress['ZIP_CODE'])){
-                $this->addError($attribute, '收货地址没有邮编');
-            } else {
-                $this->_address = $receiveAddress;
-            }
+            $this->_address = $receiveAddress;
         }
     }
 
@@ -299,6 +295,13 @@ class ApproachOrderForm extends Model
             return null;
         }
 
+        // 收货地址校验
+        if (!$receiveAddress = ReceiveAddress::find()->where(' ID=:ID', [':ID' => $this->addressId])->asArray()->one()) {
+            throw new Exception('收货地址不存在');
+        } else if (!$receiveAddress['ZIP_CODE']){
+            throw new Exception('收货地址中没有填写邮编');
+        }
+
         $ids = $this->goodsId;
         $totalAmount = 0;
         $totalPv = 0;