Ken 2 недель назад
Родитель
Сommit
bdcce6b020

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

@@ -18,6 +18,28 @@ class Withdraw extends Controller
 {
 
 
+    public function setNote()
+    {
+        try {
+
+
+            $params = request()->validate([
+                'id' => ['required', 'integer', 'min:1'],
+                'admin_note' => ['required', 'string', 'min:1', 'max:120'],
+            ]);
+            $w = WithdrawModel::where('id', $params['id'])->first();
+            if (!$w) throw new Exception("记录不存在", HttpStatus::CUSTOM_ERROR);
+            $w->admin_note = $params['admin_note'];
+            $w->save();
+        } catch (ValidationException $e) {
+            return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
+        } catch (Exception $e) {
+            return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
+        }
+        return $this->success();
+    }
+
+
     /**
      * @api {get} /admin/withdraw 提现列表
      * @apiGroup 提现管理
@@ -77,10 +99,7 @@ class Withdraw extends Controller
                 $item['service_charge'] = floatval($item['service_charge']);
                 $item['amount'] = floatval($item['amount']);
                 $item['to_account'] = floatval($item['to_account']);
-                $item['to_account_usdt'] = floatval(bcdiv($item['to_account'],$item['exchange_rate'],4));
-
-
-
+                $item['to_account_usdt'] = floatval(bcdiv($item['to_account'], $item['exchange_rate'], 4));
             }
 
 

+ 1 - 1
app/Models/Withdraw.php

@@ -8,7 +8,7 @@ class Withdraw extends BaseModel
 {
 
     protected $table = 'withdraws';
-    protected $fillable = ['member_id', 'amount', 'service_charge', 'to_account', 'after_balance', 'address', 'status', 'remark'];
+    protected $fillable = ['member_id', 'amount', 'service_charge', 'admin_note', 'to_account', 'after_balance', 'address', 'status', 'remark'];
     protected $hidden = [];
 
     public function member(): BelongsTo

+ 30 - 0
database/migrations/2026_01_12_154514_update_withdraw.php

@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration {
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+
+        Schema::table('withdraws', function (Blueprint $table) {
+            $table->string('admin_note')->nullable()->default('')->comment('管理员备注');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+};

+ 1 - 0
routes/admin.php

@@ -109,6 +109,7 @@ Route::middleware(['admin.jwt'])->group(function () {
         Route::prefix('/withdraw')->group(function () {
             Route::get('/', [Withdraw::class, 'index']);
             Route::post('setStatus', [Withdraw::class, 'setStatus']);
+            Route::post('/setNote', [Withdraw::class, 'setNote']);
 
         });