Ken 2 tygodni temu
rodzic
commit
9fb9583dac

+ 18 - 1
app/Http/Controllers/admin/Withdraw.php

@@ -18,7 +18,24 @@ use App\Models\Config;
 
 class Withdraw extends Controller
 {
-
+function setRmbNote()
+{
+    try {
+        $params = request()->validate([
+            'id' => ['required', 'integer', 'min:1'],
+            'admin_note' => ['required', 'string', 'min:1', 'max:120'],
+        ]);
+        $po = PaymentOrder::where('id', $params['id'])->first();
+        if (!$po) throw new Exception("记录不存在", HttpStatus::CUSTOM_ERROR);
+        $po->admin_note = $params['admin_note'];
+        $po->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();
+}
     public function rmb()
     {
         try {

+ 1 - 1
app/Models/PaymentOrder.php

@@ -16,7 +16,7 @@ class PaymentOrder extends BaseModel
 {
 
     protected $table = 'payment_orders';
-    protected $fillable = ['type', 'order_no', 'member_id', 'amount', 'channel', 'bank_name', 'account', 'card_no', 'status', 'callback_url', 'callback_data', 'remark', 'pay_no', 'pay_url', 'pay_data', 'fee'];
+    protected $fillable = ['type', 'order_no', 'member_id', 'amount', 'channel', 'admin_note','bank_name', 'account', 'card_no', 'status', 'callback_url', 'callback_data', 'remark', 'pay_no', 'pay_url', 'pay_data', 'fee'];
     protected $hidden = [];
     // // 添加这个
     // protected $visible = [

+ 30 - 0
database/migrations/2026_01_13_174445_update_payment_order.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('payment_orders', function (Blueprint $table) {
+            $table->string('admin_note')->nullable()->default('')->comment('管理员备注');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+};

+ 2 - 0
routes/admin.php

@@ -111,6 +111,8 @@ Route::middleware(['admin.jwt'])->group(function () {
             Route::get('/rmb', [Withdraw::class, 'rmb']);
             Route::post('setStatus', [Withdraw::class, 'setStatus']);
             Route::post('/setNote', [Withdraw::class, 'setNote']);
+            Route::post('/setRmbNote', [Withdraw::class, 'setRmbNote']);
+
 
         });