Browse Source

修改查询方式

kevin_zhangl 2 years ago
parent
commit
d5bfd10ae7
1 changed files with 9 additions and 2 deletions
  1. 9 2
      common/models/forms/ApproachOrderForm.php

+ 9 - 2
common/models/forms/ApproachOrderForm.php

@@ -146,12 +146,19 @@ class ApproachOrderForm extends Model
     {
         $parentValidate = parent::beforeValidate();
         if ($this->sn) {
-            $this->_model = ApproachOrder::find()->where('SN=:SN', [':SN' => $this->sn])->one();
+            $this->_model = Order::findOne(['SN'=>$this->sn]);
+            if (!$this->_model){
+                $this->addError('sn', '订单不存在');
+                return false;
+            }
+        }
+//        if ($this->sn) {
+//            $this->_model = ApproachOrder::find()->where('SN=:SN', [':SN' => $this->sn])->one();
 //            if (!$this->_model){
 //                $this->addError('sn', '订单不存在. ' . json_encode($this->_model));
 //                return false;
 //            }
-        }
+//        }
 
 //        if ($this->scenario == 'verifyIPay88'){
 //            if ($this->_model->STATUS != \Yii::$app->params['orderStatus']['notPaid']['value']) {