Ken 1 hafta önce
ebeveyn
işleme
d4c7a1ab2d
1 değiştirilmiş dosya ile 4 ekleme ve 0 silme
  1. 4 0
      app/Http/Controllers/admin/Withdraw.php

+ 4 - 0
app/Http/Controllers/admin/Withdraw.php

@@ -20,6 +20,7 @@ class Withdraw extends Controller
 {
 {
     function setRmbNote()
     function setRmbNote()
     {
     {
+        DB::beginTransaction();
         try {
         try {
             $params = request()->validate([
             $params = request()->validate([
                 'id' => ['required', 'integer', 'min:1'],
                 'id' => ['required', 'integer', 'min:1'],
@@ -30,9 +31,12 @@ class Withdraw extends Controller
             if (!$po) throw new Exception("记录不存在", HttpStatus::CUSTOM_ERROR);
             if (!$po) throw new Exception("记录不存在", HttpStatus::CUSTOM_ERROR);
             $po->admin_note = $params['admin_note'];
             $po->admin_note = $params['admin_note'];
             $po->save();
             $po->save();
+            DB::commit();
         } catch (ValidationException $e) {
         } catch (ValidationException $e) {
+            DB::rollBack();
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
         } catch (Exception $e) {
         } catch (Exception $e) {
+            DB::rollBack();
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
         }
         }
         return $this->success();
         return $this->success();