kevin_zhangl 2 лет назад
Родитель
Сommit
0aee45df92
1 измененных файлов с 5 добавлено и 8 удалено
  1. 5 8
      common/models/forms/ApproachOrderForm.php

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

@@ -171,7 +171,11 @@ class ApproachOrderForm extends Model
         if (!$receiveAddress = ReceiveAddress::find()->where(' ID=:ID', [':ID' => $this->addressId])->asArray()->one()) {
             $this->addError($attribute, '收货地址不存在');
         } else {
-            $this->_address = $receiveAddress;
+            if (!$receiveAddress['ZIP_CODE']){
+                $this->addError($attribute, '收货地址没有填写邮编');
+            } else {
+                $this->_address = $receiveAddress;
+            }
         }
     }
 
@@ -295,13 +299,6 @@ 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;