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-03-24 01:46:09 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2a2de295490eea013b58e8262d3e3384b96d17ac
2a2de295
1 parent
9b29518c
1.优化一言添加
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
77 additions
and
35 deletions
app/Admin/Controllers/AdminMakeVideoController.php
app/Admin/Controllers/VideoTempController.php
app/Admin/Renderable/TemplateTable.php
app/Jobs/AdminMakeImmerse.php
app/Jobs/UserMakeImmerse.php
app/Models/Immerse.php
app/Models/VideoTemp.php
resources/views/admin/form/phone.blade.php
app/Admin/Controllers/AdminMakeVideoController.php
View file @
2a2de29
...
...
@@ -126,8 +126,8 @@ class AdminMakeVideoController extends AdminController
->
title
(
'一言诗词库'
)
->
from
(
PoemTable2
::
make
())
->
model
(
OnePoem2
::
class
,
'id'
,
'title'
);
$form
->
textarea
(
'feel'
,
'有感'
);
$form
->
text
(
'weather'
,
'天气'
);
$form
->
textarea
(
'feel'
,
'有感'
)
->
default
(
'读此一言,仿佛身临其境!'
)
;
$form
->
text
(
'weather'
,
'天气'
)
->
default
(
'多云'
)
;
$form
->
text
(
'huangli'
,
'黄历'
)
->
default
(
'宜'
);
$form
->
radio
(
'thumbnail'
,
'封面'
)
...
...
app/Admin/Controllers/VideoTempController.php
View file @
2a2de29
...
...
@@ -120,32 +120,27 @@ class VideoTempController extends AdminController
'date'
=>
'日期组件'
,
'feel'
=>
'临境有感组件'
,
]);
$form
->
select
(
'position'
,
'组件位置'
)
->
options
(
VideoTemp
::
POSITION_OPTIONS
);
$form
->
select
(
'position'
,
'组件位置'
)
->
options
(
VideoTemp
::
POSITION_OPTIONS
)
->
addElementClass
(
'position'
);
$form
->
selectTable
(
'font_file'
,
'字体'
)
->
title
(
'字体选择'
)
->
from
(
FontTable
::
make
())
->
model
(
Font
::
class
,
'file'
,
'name'
);
$form
->
number
(
'font_size'
,
'字号'
)
->
default
(
24
)
->
min
(
12
);
$form
->
color
(
'text_color'
,
'字体颜色'
)
->
default
(
'#f5f5f5'
)
->
addElementClass
(
'text_color'
);
$form
->
radio
(
'draw'
,
'文字效果'
)
->
options
([
'fade'
=>
'淡入淡出'
,
'fix'
=>
'固定显示'
])
->
default
(
'fade'
)
->
when
(
'fade'
,
function
(
Form\NestedForm
$form
){
$form
->
number
(
'fade_time'
,
'fade时间'
)
->
default
(
1500
);
$form
->
selectTable
(
'font_file'
,
'字体'
)
->
title
(
'字体选择'
)
->
from
(
FontTable
::
make
())
->
model
(
Font
::
class
,
'file'
,
'name'
);
$form
->
number
(
'font_size'
,
'字号'
)
->
default
(
12
)
->
min
(
12
);
$form
->
color
(
'text_color'
,
'字体颜色'
)
->
default
(
'#f5f5f5'
)
->
addElementClass
(
'text_color'
);
})
->
when
(
'fix'
,
function
(
Form\NestedForm
$form
){
$form
->
number
(
'text_bg_box'
,
'背景厚度'
)
->
default
(
0
)
->
addElementClass
(
'text_bg_box'
)
->
help
(
'设置背景块边缘厚度(用于在背景块边缘用背景色填充一圈),默认为0'
);
$form
->
color
(
'text_bg_color'
,
'背景色'
)
->
default
(
'#5c6bc6'
)
->
addElementClass
(
'text_bg_color'
);
$form
->
selectTable
(
'font_file'
,
'字体'
)
->
title
(
'字体选择'
)
->
from
(
FontTable
::
make
())
->
model
(
Font
::
class
,
'file'
,
'name'
);
$form
->
number
(
'font_size'
,
'字号'
)
->
default
(
12
)
->
min
(
12
);
$form
->
color
(
'text_color'
,
'字体颜色'
)
->
default
(
'#f5f5f5'
)
->
addElementClass
(
'text_color'
);
$form
->
number
(
'opacity'
,
'透明度'
)
->
min
(
0
)
->
max
(
100
)
->
addElementClass
(
'opacity'
)
->
default
(
100
)
->
help
(
'范围为0-100,100表示不透明,0表示完全透明'
);
$form
->
number
(
'text_bg_box'
,
'背景厚度'
)
->
default
(
0
)
->
addElementClass
(
'text_bg_box'
)
->
help
(
'设置背景块边缘厚度(用于在背景块边缘用背景色填充一圈),默认为0'
);
});
});
...
...
app/Admin/Renderable/TemplateTable.php
View file @
2a2de29
...
...
@@ -24,7 +24,7 @@ class TemplateTable extends LazyRenderable
$grid
->
column
(
''
,
'组件信息'
)
->
display
(
'展开'
)
->
expand
(
function
(){
$th
=
[
'id'
,
'模板id'
,
'名称'
,
'位置'
,
'字号'
];
$th
=
[
'id'
,
'模板id'
,
'名称'
,
'位置'
,
'字号'
,
'文字颜色'
,
'文字效果'
,
'fade时间'
,
'背景色'
,
'透明度'
,
'背景厚度'
];
return
Table
::
make
(
$th
,
$this
->
componentsTable
->
toArray
())
->
withBorder
();
});
...
...
app/Jobs/AdminMakeImmerse.php
View file @
2a2de29
...
...
@@ -63,11 +63,11 @@ class AdminMakeImmerse implements ShouldQueue
// 判断双轨 没有则制作空轨
$is_bgm
=
$this
->
adminMakeVideo
->
temp
->
bg_music
==
1
;
//是否手动上传背景音
$bgm
=
$this
->
getAbsolutePath
(
$this
->
adminMakeVideo
->
temp
->
bgm_url
);
if
(
$this
->
media_info
[
'format'
][
'nb_streams'
]
>=
2
)
{
/** 音频视频轨都有 */
if
(
$is_bgm
)
{
// 有背景音 融合
$audio
=
$this
->
getAbsolutePath
(
$this
->
getTempPath
(
'.mp3'
,
'audio'
));
$bgm
=
$this
->
getAbsolutePath
(
$this
->
adminMakeVideo
->
temp
->
bgm_url
);
$cmd
=
$this
->
ffmpeg
.
' -y -i '
.
escapeshellarg
(
$file
)
.
' -y -i '
.
escapeshellarg
(
$bgm
)
.
...
...
@@ -93,7 +93,6 @@ class AdminMakeImmerse implements ShouldQueue
if
(
$is_bgm
)
{
// 有背景音 融合
$audio_empty
=
$audio
;
$bgm
=
$this
->
getAbsolutePath
(
$this
->
adminMakeVideo
->
temp
->
bgm_url
);
$audio
=
$this
->
getAbsolutePath
(
$this
->
getTempPath
(
'.mp3'
,
'audio'
));
$cmd
=
$this
->
ffmpeg
.
' -y -i '
.
escapeshellarg
(
$audio_empty
)
.
...
...
@@ -150,7 +149,8 @@ class AdminMakeImmerse implements ShouldQueue
if
(
!
$this
->
execCmd
(
$cmd
))
return
;
// 分析视频 入库
$video_info
=
$this
->
mediainfo
(
$this
->
getAbsolutePath
(
$output
));
$video_info
=
$this
->
mediaInfo
(
$this
->
getAbsolutePath
(
$output
));
Immerse
::
query
()
->
create
([
'user_id'
=>
1
,
'title'
=>
''
,
...
...
@@ -184,8 +184,6 @@ class AdminMakeImmerse implements ShouldQueue
public
function
mediaInfo
(
$file
)
{
if
(
$this
->
media_info
)
return
$this
->
media_info
;
$cmd
=
$this
->
ffprobe
.
' -v quiet -print_format json -show_format -show_streams '
.
escapeshellarg
(
$file
);
$output
=
$this
->
execCmd
(
$cmd
);
$data
=
json_decode
(
$output
,
true
);
...
...
@@ -199,6 +197,7 @@ class AdminMakeImmerse implements ShouldQueue
public
function
execCmd
(
$cmd
)
{
echo
$cmd
.
"
\n
"
.
"
\n
"
;
return
shell_exec
(
"
{
$cmd
}
2>&1"
);
}
...
...
app/Jobs/UserMakeImmerse.php
View file @
2a2de29
This diff is collapsed. Click to expand it.
app/Models/Immerse.php
View file @
2a2de29
...
...
@@ -58,6 +58,11 @@ class Immerse extends Model
return
$this
->
hasOne
(
OnePoem
::
class
,
'id'
,
'poem_id'
);
}
public
function
poem2
()
{
return
$this
->
hasOne
(
OnePoem2
::
class
,
'id'
,
'poem_id'
);
}
public
function
temp
()
{
return
$this
->
hasOne
(
VideoTemp
::
class
,
'id'
,
'temp_id'
);
...
...
app/Models/VideoTemp.php
View file @
2a2de29
...
...
@@ -34,7 +34,8 @@ class VideoTemp extends Model
public
function
componentsTable
()
{
return
$this
->
hasMany
(
'App\Models\Component'
,
'temp_id'
)
->
select
([
'id'
,
'temp_id'
,
'name'
,
'position'
,
'font_size'
,
'text_color'
,
'text_bg_color'
,
'text_bg_box'
,
'opacity'
]);
->
select
([
'id'
,
'temp_id'
,
'name'
,
'position'
,
'font_size'
,
'text_color'
,
'draw'
,
'fade_time'
,
'text_bg_color'
,
'text_bg_box'
,
'opacity'
]);
}
public
function
admin_make_video
()
...
...
resources/views/admin/form/phone.blade.php
View file @
2a2de29
...
...
@@ -40,7 +40,7 @@
}
.poem-title
{
font-size
:
26
px
;
font-size
:
14
px
;
font-weight
:
bold
;
margin
:
10px
;
}
...
...
@@ -51,7 +51,7 @@
}
.poem-content
{
font-size
:
24
px
;
font-size
:
12
px
;
margin
:
0
;
}
...
...
@@ -64,13 +64,13 @@
<div
class=
"text"
>
模板
</div>
<img
src=
"{{asset('storage/images/mobile-head.png')}}"
alt=
""
width=
"360"
height=
"80"
>
<div
class=
"bg-box"
>
<img
width=
"360"
height=
"625"
class=
"bg_img"
style=
"display: none"
>
<video
width=
"360"
height=
"625"
id=
"bg_video"
style=
"display: none"
></video>
<audio
id=
"bg_audio"
></audio>
{{--
<img
width=
"360"
height=
"625"
class=
"bg_img"
style=
"display: none"
>
--}}
{{--
<video
width=
"360"
height=
"625"
id=
"bg_video"
style=
"display: none"
></video>
--}}
{{--
<audio
id=
"bg_audio"
></audio>
--}}
</div>
<div
class=
"poem-block"
>
<p
class=
"poem-title"
>
题破山寺后禅院
</p>
<p
class=
"poem-author"
>
-- 常建
</p>
{{--
<p
class=
"poem-title"
>
题破山寺后禅院
</p>
--}}
{{--
<p
class=
"poem-author"
>
-- 常建
</p>
--}}
<p
class=
"poem-content"
>
清晨入古寺,初日照高林。
</p>
<p
class=
"poem-content"
>
曲径通幽处,禅房花木深。
</p>
<p
class=
"poem-content"
>
山光悦鸟性,潭影空人心。
</p>
...
...
@@ -86,20 +86,62 @@
$
(
document
).
off
(
'click'
,
'.sync'
).
on
(
'click'
,
'.sync'
,
function
()
{
let
ori_top
=
80
;
let
top
=
parseInt
(
$
(
'.field_top'
).
val
())
+
ori_top
;
let
left
=
$
(
'.field_left'
).
val
()
;
let
top
=
0
+
ori_top
;
let
left
=
0
;
let
font
=
$
(
'.field_font_size'
).
val
();
let
content_size
=
12
+
parseInt
(
font
);
let
title_size
=
14
+
parseInt
(
font
);
let
content_size
=
parseInt
(
font
);
let
title_size
=
parseInt
(
font
);
let
text_color
=
$
(
'.text_color'
).
val
()
||
'whitesmoke'
;
let
text_bg_color
=
$
(
'.text_bg_color'
).
val
()
||
'#5c6bc6'
;
let
opacity
=
parseInt
(
$
(
'.opacity'
).
val
())
/
100
;
let
pos
=
$
(
'.field_position'
).
val
();
$
(
'.poem-block'
).
css
(
'top'
,
top
+
'px'
).
css
(
'left'
,
left
+
'px'
)
.
css
(
'background-color'
,
text_bg_color
).
css
(
'opacity'
,
opacity
);
$
(
'.poem-title'
).
css
(
'font-size'
,
title_size
+
'px'
).
css
(
'color'
,
text_color
);
$
(
'.poem-content'
).
css
(
'font-size'
,
content_size
+
'px'
).
css
(
'color'
,
text_color
);
let
block_w
=
$
(
'.poem-block'
).
width
();
let
block_h
=
$
(
'.poem-block'
).
height
();
switch
(
pos
)
{
case
'topLeft'
:
top
=
0
+
ori_top
;
left
=
0
;
break
;
case
'topMiddle'
:
top
=
0
+
ori_top
;
left
=
(
360
-
block_w
)
/
2
;
break
;
case
'topRight'
:
top
=
0
+
ori_top
;
left
=
360
-
block_w
;
break
;
case
'midLeft'
:
top
=
(
640
-
block_h
)
/
2
+
ori_top
;
left
=
0
;
break
;
case
'midMiddle'
:
top
=
(
640
-
block_h
)
/
2
+
ori_top
;
left
=
(
360
-
block_w
)
/
2
;
break
;
case
'midRight'
:
top
=
(
640
-
block_h
)
/
2
+
ori_top
;
left
=
360
-
block_w
;
break
;
case
'botLeft'
:
top
=
640
-
block_h
+
ori_top
;
left
=
0
;
break
;
case
'botMiddle'
:
top
=
640
-
block_h
+
ori_top
;
left
=
(
360
-
block_w
)
/
2
;
break
;
case
'botRight'
:
top
=
640
-
block_h
+
ori_top
;
left
=
360
-
block_w
;
break
;
}
$
(
'.poem-block'
).
css
(
'top'
,
top
+
'px'
).
css
(
'left'
,
left
+
'px'
)
let
bg_img_url
=
$
(
'.bg_img_url'
).
find
(
"input[type='hidden'][name='bg_url']"
).
val
();
if
(
bg_img_url
!==
''
)
{
...
...
Please
register
or
login
to post a comment