李帅

1.修复一些bug

......@@ -53,7 +53,7 @@ class ImmerseController extends Controller
$user_id = $request->user()->id;
$user_profile = UserProfile::query()->where('user_id', $user_id)->first();
if ($user_profile->is_vip == UserProfile::NO_VIP && $user_profile->video_count > 5) {
if ($user_profile->is_vip == UserProfile::NO_VIP && $user_profile->video_count > UserProfile::MAX_FREE_QUOTA) {
return Response::fail("非VIP用户最多发布5个视频");
}
......
......@@ -12,6 +12,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
......@@ -61,6 +62,10 @@ class UserMakeImmerse implements ShouldQueue
$this->output_width = 720;
$this->output_height = 1280;
}else{
if ($profile->video_count > UserProfile::MAX_FREE_QUOTA) {
Log::channel("daily")->alert("超过最大免费配额了");
return ;
}
$this->output_width = 540;
$this->output_height = 960;
}
......@@ -259,6 +264,8 @@ class UserMakeImmerse implements ShouldQueue
$this->immerse->size = $video_info['format']['size'];
$this->immerse->save();
$profile->video_count ++;
$profile->save();
return ;
}
......
......@@ -20,6 +20,8 @@ class UserProfile extends Model
const WAIT_VIP = 2; // 已付款,等待处理(回调不及时,需要等待)
const MAX_FREE_QUOTA = 5;
public function user()
{
return $this->belongsTo('App\Models\User', 'id', 'user_id');
......