|
|
@ -3502,6 +3502,45 @@ class InsurerController extends BaseController |
|
|
|
} |
|
|
|
} |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function actionGiftCancel() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Yii::$app->response->format = Response::FORMAT_JSON; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$request = Yii::$app->request; |
|
|
|
|
|
|
|
$result = array(); |
|
|
|
|
|
|
|
$result['success'] = false; |
|
|
|
|
|
|
|
$result['msg'] = '保存失败'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($request->isPost) { |
|
|
|
|
|
|
|
$id = $request->post('order_id', 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$order_info = OrderT::findOne($id); |
|
|
|
|
|
|
|
if (!$order_info) { |
|
|
|
|
|
|
|
$result['msg'] = '订单不存在'; |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tran = OrderT::getDb()->beginTransaction(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
// 删除礼品/券库信息 |
|
|
|
|
|
|
|
GiftTicketTUse::deleteAll('order_id=' . $order_info->id); |
|
|
|
|
|
|
|
// 修改订单礼品/券信息 |
|
|
|
|
|
|
|
OrderGiftT::updateAll(['gift_src'=>''],['order_id'=>$order_info->id]); |
|
|
|
|
|
|
|
// 修改订单状态 |
|
|
|
|
|
|
|
$order_info->gift_status = 0; |
|
|
|
|
|
|
|
$order_info->save(); |
|
|
|
|
|
|
|
$result['success'] = true; |
|
|
|
|
|
|
|
$result['msg'] = '保存成功'; |
|
|
|
|
|
|
|
$tran->commit(); |
|
|
|
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
|
|
$tran->rollBack(); |
|
|
|
|
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getGift($k, $v, $car_no, $order_info, $order_gift_id) |
|
|
|
public function getGift($k, $v, $car_no, $order_info, $order_gift_id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$result = array(); |
|
|
|
$result = array(); |
|
|
@ -3565,7 +3604,7 @@ class InsurerController extends BaseController |
|
|
|
|
|
|
|
|
|
|
|
if ($shiwu_use) { |
|
|
|
if ($shiwu_use) { |
|
|
|
$new_shiwu->gift_shuzi = $shiwu_use->gift_shuzi + 1; |
|
|
|
$new_shiwu->gift_shuzi = $shiwu_use->gift_shuzi + 1; |
|
|
|
$new_shiwu->code = sprintf("%04d", $gift_use->gift_shuzi + 1); |
|
|
|
$new_shiwu->code = sprintf("%04d", $shiwu_use->gift_shuzi + 1); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$new_shiwu->gift_shuzi = 1; |
|
|
|
$new_shiwu->gift_shuzi = 1; |
|
|
|
$new_shiwu->code = sprintf("%04d", 1); |
|
|
|
$new_shiwu->code = sprintf("%04d", 1); |
|
|
|