李帅

1.修复一些bug

...@@ -53,7 +53,7 @@ class ImmerseController extends Controller ...@@ -53,7 +53,7 @@ class ImmerseController extends Controller
53 53
54 $user_id = $request->user()->id; 54 $user_id = $request->user()->id;
55 $user_profile = UserProfile::query()->where('user_id', $user_id)->first(); 55 $user_profile = UserProfile::query()->where('user_id', $user_id)->first();
56 - if ($user_profile->is_vip == UserProfile::NO_VIP && $user_profile->video_count > 5) { 56 + if ($user_profile->is_vip == UserProfile::NO_VIP && $user_profile->video_count > UserProfile::MAX_FREE_QUOTA) {
57 return Response::fail("非VIP用户最多发布5个视频"); 57 return Response::fail("非VIP用户最多发布5个视频");
58 } 58 }
59 59
......
...@@ -12,6 +12,7 @@ use Illuminate\Contracts\Queue\ShouldQueue; ...@@ -12,6 +12,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
12 use Illuminate\Foundation\Bus\Dispatchable; 12 use Illuminate\Foundation\Bus\Dispatchable;
13 use Illuminate\Queue\InteractsWithQueue; 13 use Illuminate\Queue\InteractsWithQueue;
14 use Illuminate\Queue\SerializesModels; 14 use Illuminate\Queue\SerializesModels;
15 +use Illuminate\Support\Facades\Log;
15 use Illuminate\Support\Facades\Storage; 16 use Illuminate\Support\Facades\Storage;
16 use Illuminate\Support\Str; 17 use Illuminate\Support\Str;
17 18
...@@ -61,6 +62,10 @@ class UserMakeImmerse implements ShouldQueue ...@@ -61,6 +62,10 @@ class UserMakeImmerse implements ShouldQueue
61 $this->output_width = 720; 62 $this->output_width = 720;
62 $this->output_height = 1280; 63 $this->output_height = 1280;
63 }else{ 64 }else{
65 + if ($profile->video_count > UserProfile::MAX_FREE_QUOTA) {
66 + Log::channel("daily")->alert("超过最大免费配额了");
67 + return ;
68 + }
64 $this->output_width = 540; 69 $this->output_width = 540;
65 $this->output_height = 960; 70 $this->output_height = 960;
66 } 71 }
...@@ -259,6 +264,8 @@ class UserMakeImmerse implements ShouldQueue ...@@ -259,6 +264,8 @@ class UserMakeImmerse implements ShouldQueue
259 $this->immerse->size = $video_info['format']['size']; 264 $this->immerse->size = $video_info['format']['size'];
260 $this->immerse->save(); 265 $this->immerse->save();
261 266
267 + $profile->video_count ++;
268 + $profile->save();
262 return ; 269 return ;
263 } 270 }
264 271
......
...@@ -20,6 +20,8 @@ class UserProfile extends Model ...@@ -20,6 +20,8 @@ class UserProfile extends Model
20 20
21 const WAIT_VIP = 2; // 已付款,等待处理(回调不及时,需要等待) 21 const WAIT_VIP = 2; // 已付款,等待处理(回调不及时,需要等待)
22 22
23 + const MAX_FREE_QUOTA = 5;
24 +
23 public function user() 25 public function user()
24 { 26 {
25 return $this->belongsTo('App\Models\User', 'id', 'user_id'); 27 return $this->belongsTo('App\Models\User', 'id', 'user_id');
......