root 3 vuotta sitten
vanhempi
commit
8f89f85eb8
1 muutettua tiedostoa jossa 18 lisäystä ja 16 poistoa
  1. 18 16
      common/models/forms/DeclarationUpgradeForm.php

+ 18 - 16
common/models/forms/DeclarationUpgradeForm.php

@@ -191,7 +191,7 @@ class DeclarationUpgradeForm extends Model
             $insertConId = $baseInfo['CON_UID'];
             $insertRecId = $baseInfo['REC_UID'];
             if(!($decResult = $this->addDecOrder($insertConId,$insertRecId, $baseInfo['DEC_LV'],$isObserve,$this->remark))) {
-                throw new Exception(Form::formatErrorsForApi($decResult->getErrors()));
+                throw new Exception("操作失败");
             }
         }
         return true;
@@ -286,21 +286,23 @@ class DeclarationUpgradeForm extends Model
         if(!$addressModel->save()){
             throw new Exception(Form::formatErrorsForApi($addressModel->getErrors()));
         }
-        
-        // 扣报单人现金钱包
-        Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'升级报单']);
-        // 为被升级人进行升级操作
-        $decLevelLog = new DecLevelLog();
-        $decLog = [
-            'userId' => $this->_insertUserId,//会员ID
-            'fromId' => $oriDecLv, // 变动前的级别
-            'levelId' => $this->decLv,// 变动后的级别
-            'actionId' => \Yii::$app->user->id,
-            'remark' => $this->remark,
-            'lvPv' => $this->_decPv
-        ];
-        $modifyDecLv = $decLevelLog->frontendChange($decLog);
-
+        try{
+            // 扣报单人现金钱包
+            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'升级报单']);
+            // 为被升级人进行升级操作
+            $decLevelLog = new DecLevelLog();
+            $decLog = [
+                'userId' => $this->_insertUserId,//会员ID
+                'fromId' => $oriDecLv, // 变动前的级别
+                'levelId' => $this->decLv,// 变动后的级别
+                'actionId' => \Yii::$app->user->id,
+                'remark' => $this->remark,
+                'lvPv' => $this->_decPv
+            ];
+            $modifyDecLv = $decLevelLog->frontendChange($decLog);
+        } catch (Exception $e) {
+            throw new Exception($e->getMessage());
+        }
         return $modifyDecLv;
     }