修复无法退回操作

dev
曾超新 5 years ago
parent b5454a2a0c
commit ae26fc5310
  1. 2
      common/models/OrderGiftT.php
  2. 2
      frontend/controllers/BaseController.php
  3. 22
      frontend/controllers/InsurerController.php

@ -84,6 +84,6 @@ class OrderGiftT extends \common\models\Base
public function getGift() public function getGift()
{ {
return $this->hasOne(GiftType3T::className(),['id'=>'gift_id']); return $this->hasOne(GiftT::className(),['id'=>'gift_id']);
} }
} }

@ -61,7 +61,7 @@ class BaseController extends \yii\web\Controller
$log_info->remark = $info; $log_info->remark = $info;
$log_info->info = ''; $log_info->info = '';
if(!$log_info->save()) { if(!$log_info->save()) {
var_dump($log_info->errors); throw new \Exception(print_r($log_info->getErrors(), true));
} }
} }
public function addNonLog($non_id,$info,$type) public function addNonLog($non_id,$info,$type)

@ -3344,31 +3344,25 @@ class InsurerController extends BaseController
$row->return_remark = $return_remark; $row->return_remark = $return_remark;
$row->return_time = time(); $row->return_time = time();
$row->lock_id = 0; $row->lock_id = 0;
$row->save(); if(!$row->save()) {
throw new \Exception(print_r($row->getErrors(), true));
}
//处理操作人员状态 //处理操作人员状态
$order_user_info = OrderUserT::findOne(['order_id'=>$row->id,'user_id'=>$this->my->id,'status'=>0]); $order_user_info = OrderUserT::findOne(['order_id'=>$row->id,'user_id'=>$this->my->id,'status'=>0]);
if($order_user_info) { if($order_user_info) {
$order_user_info->status = 2; //退回 $order_user_info->status = 2; //退回
$order_user_info->save(); if(!$order_user_info->save()) {
throw new \Exception(print_r($order_user_info->getErrors(), true));
}
$order_user_info2 = new OrderUserT(); $order_user_info2 = new OrderUserT();
$order_user_info2->user_id = $row->user_id; $order_user_info2->user_id = $row->user_id;
$order_user_info2->order_id = $row->id; $order_user_info2->order_id = $row->id;
$order_user_info2->type_id = 1; $order_user_info2->type_id = 1;
$order_user_info2->status = 0; $order_user_info2->status = 0;
$order_user_info2->save(); if(!$order_user_info2->save()) {
} throw new \Exception(print_r($order_user_info2->getErrors(), true));
//
//处理礼品数量
$sel_gifts = OrderGiftT::find()
->where('order_id='.$order_id)
->all();
foreach($sel_gifts as $sel_gift) {
$gift_info = $sel_gift->gift;
if($gift_info && $gift_info->total > -1) {
$gift_info->total = $gift_info->total + 1;
$gift_info->save();
} }
} }

Loading…
Cancel
Save