Ken 1 неделя назад
Родитель
Сommit
af80def390

+ 2 - 5
app/Http/Controllers/admin/ActivityReward.php

@@ -49,13 +49,10 @@ class ActivityReward extends Controller
             $params = request()->validate([
                 'id' => ['nullable', 'integer', 'min:1'],
                 'title' => ['required', 'string', 'min:1', 'max:140'],
-                'gift_amount' => ['required', 'numeric', 'min:0.01', 'regex:/^\d+(\.\d{1,2})?$/'],
-                'flow_amount' => ['required', 'numeric', 'min:0', 'regex:/^\d+(\.\d{1,2})?$/'],
-                'participant_count' => ['required', 'integer', 'min:0'],
-                'activity_total' => ['required', 'integer', 'min:-1'],
-                'maximum_participation' => ['required', 'integer', 'min:0'],
+                'sub_title' => ['required', 'string', 'min:1', 'max:140'],
                 'start_time' => ['required', 'date', 'date_format:Y-m-d'],
                 'end_time' => ['required', 'date', 'date_format:Y-m-d'],
+                'detail_image' => [],
             ]);
             ActivityRewardService::submit($params);
             DB::commit();

+ 2 - 10
app/Http/Controllers/admin/Upload.php

@@ -72,22 +72,14 @@ class Upload extends Controller
     {
         try {
             request()->validate([
-                'file' => [
-                    'required',
-                    'file',
-                    'mimes:jpg,jpeg,png,webp,mp4,mov,avi,webm',
-                    'max:51200' // 最大 50MB,单位KB
-                ],
+                'file' => ['required', 'file', 'mimes:jpg,jpeg,png,webp,mp4,mov,avi,webm', 'max:51200'],// 最大 50MB,单位KB
             ]);
-
             if (request()->hasFile('file')) {
                 $file = request()->file('file');
                 $fileName = md5_file($file->getRealPath());
-
                 // 获取原始扩展名
                 $extension = $file->getClientOriginalExtension();
                 $fileName .= $extension ? ('.' . $extension) : '';
-
                 // 根据类型判断存放目录(可选)
                 $isImage = in_array(strtolower($extension), ['jpg', 'jpeg', 'png', 'webp']);
                 $dir = $isImage ? 'images' : 'videos';
@@ -106,7 +98,7 @@ class Upload extends Controller
         } catch (ValidationException $e) {
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
         } catch (Exception $e) {
-            return $this->error($e->getCode());
+            return $this->error($e->getCode(), $e->getMessage());
         }
 
         return $this->success(['path' => Util::ensureUrl($path)]);