Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-Server
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
李帅
2023-05-18 16:18:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
acbf05f8b2da83a11eb0337e894547ed71dbbd94
acbf05f8
1 parent
fb91cae4
1.修复一些bug
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletions
app/Http/Controllers/V1/ImmerseController.php
app/Jobs/UserMakeImmerse.php
app/Models/UserProfile.php
app/Http/Controllers/V1/ImmerseController.php
View file @
acbf05f
...
...
@@ -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个视频"
);
}
...
...
app/Jobs/UserMakeImmerse.php
View file @
acbf05f
...
...
@@ -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
;
}
...
...
app/Models/UserProfile.php
View file @
acbf05f
...
...
@@ -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'
);
...
...
Please
register
or
login
to post a comment