Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
media-resource
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨昕
media-resource
Commits
c305d0a9
Commit
c305d0a9
authored
Feb 03, 2021
by
杨昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设置预留
parent
fd9fc143
Pipeline
#13711
passed with stages
in 42 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
14 deletions
+17
-14
MediaController.php
app/Http/Controllers/Web/MediaController.php
+9
-2
MediaRoute.php
app/Http/Routes/Web/MediaRoute.php
+1
-1
MediaModel.php
app/Model/MediaModel.php
+1
-7
media_list.blade.php
resources/views/admin/media/media_list.blade.php
+6
-4
No files found.
app/Http/Controllers/Web/MediaController.php
View file @
c305d0a9
...
...
@@ -11,6 +11,11 @@ use App\Http\Controllers\Controller;
class
MediaController
extends
Controller
{
private
const
PREVIEW_DOMAIN
=
[
'test'
=>
'preview.t.eoffcn.com'
,
'master'
=>
'preview.eoffcn.com'
];
/**
* 媒资列表
* @param Request $request
...
...
@@ -175,8 +180,10 @@ class MediaController extends Controller
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public
function
media_preview
(
Request
$request
){
return
view
(
'errors.404'
);
public
function
media_preview
(
Request
$request
,
$mediaNum
){
$branch
=
!
empty
(
getenv
(
'branch'
))
?
getenv
(
'branch'
)
:
"test"
;
$url
=
"http://"
.
self
::
PREVIEW_DOMAIN
[
$branch
]
.
'/'
.
$mediaNum
;
return
redirect
(
$url
);
}
/**
...
...
app/Http/Routes/Web/MediaRoute.php
View file @
c305d0a9
...
...
@@ -16,7 +16,7 @@ class MediaRoute extends AuthenRoute
parent
::
map
(
$router
,
function
()
use
(
$router
){
$router
->
resource
(
'media_model'
,
'MediaController'
);
$router
->
get
(
'media_command'
,
'MediaController@media_command'
);
$router
->
get
(
'video_preview'
,
'MediaController@media_preview'
);
$router
->
get
(
'video_preview
/{media_num}
'
,
'MediaController@media_preview'
);
$router
->
post
(
'set_media_num'
,
'MediaController@setMediaNum'
);
});
...
...
app/Model/MediaModel.php
View file @
c305d0a9
...
...
@@ -819,18 +819,14 @@ class MediaModel extends Eloquent
$media_id
=
"mda-"
.
generateRandomNum
(
16
);
$media
=
MediaModel
::
find
(
$media_id
);
$i
++
;
}
while
(
$i
<
3
&&
!
empty
(
$media
)
);
if
(
$i
==
3
){
throw
new
\Exception
(
'获取媒资编号失败'
);
}
}
catch
(
\Exception
$exception
){
throw
new
DatabaseException
(
$exception
->
getMessage
());
}
return
$media_id
;
}
...
...
@@ -844,7 +840,7 @@ class MediaModel extends Eloquent
try
{
$media_id
=
$request
->
media_id
;
$data
=
[
'media_num'
=>
substr
(
$media_id
,
4
),
'media_num'
=>
md5
(
md5
(
$media_id
)
),
];
$flag
=
MediaModel
::
where
(
"_id"
,
$media_id
)
->
update
(
$data
);
}
catch
(
\Exception
$exception
){
...
...
@@ -852,6 +848,4 @@ class MediaModel extends Eloquent
}
return
$flag
;
}
}
resources/views/admin/media/media_list.blade.php
View file @
c305d0a9
...
...
@@ -82,7 +82,6 @@
<td
class=
"td-manage"
>
@if(permissionExist("manager_media","media_edit"))
<a
title=
"编辑"
href=
"/web/media_model/{{$media['_id']}}/edit"
>
<i
class=
"iconfont"
>

</i>
</a>
...
...
@@ -99,7 +98,7 @@
@endif
@if(isset($media["media_num"]))
<a
title=
"视频预览"
onclick=
"x_admin_show('/web/video_preview?media_id={{$media["
_id
"]}}')"
href=
"javascript:;
"
>
<a
title=
"视频预览"
href=
"/web/video_preview/{{$media['_id']}}
"
>
<i
class=
"iconfont"
>

</i>
</a>
@else
...
...
@@ -147,8 +146,6 @@
function
x_admin_show
(
url
){
window
.
location
.
href
=
url
;
// window.open(url);
}
...
...
@@ -194,6 +191,11 @@
});
}
/**
* 设置媒资随机码
* @param row
* @param id
*/
function
set_media_num
(
row
,
id
){
$
.
confirm
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment