|
|
@@ -29,7 +29,33 @@ class RefundController extends BaseController
|
|
|
$get = Yii::$app->request->get();
|
|
|
$id = $get['id'] ?? 0;
|
|
|
$amount = $get['amount'] ?? 0;
|
|
|
- util::complete();
|
|
|
+ $refund = RefundOrderClass::getById($id, true);
|
|
|
+ RefundOrderClass::valid($refund, $this->mainId);
|
|
|
+ if (is_numeric($amount) == false) {
|
|
|
+ util::fail('请填写金额');
|
|
|
+ }
|
|
|
+ if ($refund->status != 0) {
|
|
|
+ util::fail('待审核订单才能修改');
|
|
|
+ }
|
|
|
+ $connection = Yii::$app->db;
|
|
|
+ $transaction = $connection->beginTransaction();
|
|
|
+ try {
|
|
|
+ $refund->refundPrice = $amount;
|
|
|
+ $refund->save();
|
|
|
+ $cgRefundId = $refund->cgRefundId ?? 0;
|
|
|
+ $cgRefund = CgRefundClass::getById($cgRefundId, true);
|
|
|
+ if (empty($cgRefund)) {
|
|
|
+ util::fail('没有找到退款信息');
|
|
|
+ }
|
|
|
+ $cgRefund->refundPrice = $amount;
|
|
|
+ $cgRefund->save();
|
|
|
+ $transaction->commit();
|
|
|
+ util::complete();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ Yii::info("操作失败原因:" . $e->getMessage());
|
|
|
+ util::fail('操作失败');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//修改申请原因 ssh 20240302
|