Ken hai 1 semana
pai
achega
0a99968e66

+ 1 - 0
app/Http/Controllers/admin/ActivityReward.php

@@ -53,6 +53,7 @@ class ActivityReward extends Controller
                 'start_time' => ['required', 'date', 'date_format:Y-m-d'],
                 'end_time' => ['required', 'date', 'date_format:Y-m-d'],
                 'detail_image' => ['required', 'url', 'regex:/\.(jpeg|jpg|png|webp)$/i'],
+                'status' => ['nullable', 'integer', 'min:0', 'max:1'],
             ]);
             ActivityRewardService::submit($params);
             DB::commit();

+ 2 - 0
app/Http/Controllers/api/ActivityReward.php

@@ -7,6 +7,7 @@ use App\Services\ActivityRewardService;
 use Illuminate\Validation\ValidationException;
 use Exception;
 
+
 class ActivityReward extends BaseController
 {
     public function index()
@@ -16,6 +17,7 @@ class ActivityReward extends BaseController
             $list = ActivityRewardModel::where(ActivityRewardService::getWhere([
                 'start_time' => ['<=', $time],
                 'end_time' => ['>=', $time],
+                'status' => ActivityRewardModel::STATUS_UP
             ]))->orderByDesc('id')->get()->toArray();
         } catch (ValidationException $e) {
             return $this->error($e->validator->errors()->first());

+ 4 - 1
app/Models/ActivityReward.php

@@ -7,8 +7,11 @@ use App\Constants\Util;
 
 class ActivityReward extends BaseModel
 {
+    const STATUS_UP = 1;
+    const STATUS_DOWN = 0;
+
     protected $table = 'activity_rewards';
-    protected $fillable = ['title', 'sub_title', 'detail_image', 'start_time', 'end_time'];
+    protected $fillable = ['title', 'sub_title', 'detail_image', 'start_time', 'end_time', 'status'];
 
     protected function getDetailImageAttribute($value)
     {

+ 30 - 0
database/migrations/2026_01_22_160834_update_activity_rewards.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('activity_rewards', function (Blueprint $table) {
+            $table->tinyInteger('status')->default(1)->comment('0下架,1上架');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+};