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
d4605eef
Commit
d4605eef
authored
Jul 02, 2020
by
杨昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
f5703297
Pipeline
#9770
passed with stages
in 33 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
49 deletions
+96
-49
MediaController.php
app/Http/Controllers/Web/MediaController.php
+3
-2
MediaModel.php
app/Model/MediaModel.php
+27
-6
media_list.blade.php
resources/views/admin/media/media_list.blade.php
+65
-40
api.php
routes/api.php
+1
-1
No files found.
app/Http/Controllers/Web/MediaController.php
View file @
d4605eef
...
...
@@ -14,13 +14,14 @@ class MediaController extends Controller
$medias
=
MediaModel
::
mediaList
(
$request
);
return
view
(
'admin.media.media_list'
,
[
'
user
s'
=>
$medias
,
'
media
s'
=>
$medias
,
'start_time'
=>
substr
(
$request
->
start_time
,
0
,
10
),
'end_time'
=>
substr
(
$request
->
end_time
,
0
,
10
),
'name'
=>
$request
->
name
,
'STATUS'
=>
[
'启用'
,
'停用'
],
]);
}
}
app/Model/MediaModel.php
View file @
d4605eef
...
...
@@ -3,10 +3,10 @@
namespace
App\Model
;
use
App\Exceptions\DatabaseException
;
use
Illuminate\Database\Eloquent\Model
;
use
Jenssegers\Mongodb\Eloquent\Model
as
Eloquent
;
use
Illuminate\Support\Facades\DB
;
class
MediaModel
extends
Model
class
MediaModel
extends
Eloquent
{
protected
$collection
=
'media'
;
...
...
@@ -24,14 +24,35 @@ class MediaModel extends Model
$where
[
'name'
]
=
$request
->
name
;
}
// MediaModel::insertGetId([
//
// "_id" => 'mda-'.generateRandomNum(16),
// "url" => 'http://www.baidu.com',
// "QR_code"=> 'test',
// 'video_url'=>"http://www.sfdjlsdjflsaj,coanldsfjsalj.sdafljasdofjasp",
// "create_time" => date("Y-m-d H:i:s",time())
//
// ]);
//
// var_dump("fsd");die;
$medias
=
DB
::
connection
(
'mongodb'
)
->
collection
(
'media'
)
->
where
(
$where
)
->
paginate
(
10
);
foreach
(
$medias
as
&
$user
){
$idArr
=
(
$user
[
'_id'
])
->
jsonSerialize
();
$user
[
'_id'
]
=
$idArr
[
'$oid'
];
}
//
foreach ( $medias as &$user){
//
$idArr = ($user['_id'])->jsonSerialize();
//
$user['_id'] = $idArr['$oid'];
//
}
}
catch
(
\Exception
$exception
){
...
...
resources/views/admin/media/media_list.blade.php
View file @
d4605eef
...
...
@@ -53,40 +53,34 @@
<thead>
<tr
class=
"bg-info text-white"
>
<th>
序号
</th>
<th>
用户名
</th>
<th>
用户类型
</th>
<th>
加入时间
</th>
<th>
状态
</th>
<th>
媒资编号
</th>
<th>
视频地址
</th>
<th>
二维码
</th>
<th>
创建时间
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
@if(count($
user
s)>0)
@foreach ($
users as $key => $user
)
@if(count($
media
s)>0)
@foreach ($
medias as $key => $media
)
<tr
class=
"
<?php
if
(
$key
%
2
==
0
)
echo
'table-success'
;
?>
"
>
<td>
{{$key+1}}
</td>
<td
>
{{$user['name
']}}
</td>
<td>
@if($user['user_type']) 管理员@else 普通用户 @endif
</td>
<td
style=
"max-width: 150px;"
>
{{$media['_id
']}}
</td>
<td
style=
"max-width: 300px;"
>
{{$media['video_url']}}
</td
>
<td>
{{$media['QR_code']}}
</td>
<
td
style=
"max-width: 100px;"
>
{{$media['create_time']}}
<
/td>
<td>
{{$user['create_time']}}
</td>
<td
class=
"td-status"
>
<span
class=
"label "
>
已{{$STATUS[$user['status']]}}
</span>
</td>
<td
class=
"td-manage"
>
<a
onclick=
"member_stop(this,'{{$user["
_id
"]}}')"
href=
"javascript:;"
status=
"{{$user['status']}}"
>
<i
class=
"iconfont"
>
@if( $user['status'] == 1 )

@else

@endif
</i>
</a>
<a
title=
"编辑"
href=
"/web/member/{{$user['_id']}}/edit"
>
<a
title=
"编辑"
href=
"/web/member/{{$media['_id']}}/edit"
>
<i
class=
"iconfont"
>

</i>
</a>
{{--
<a
onclick=
"x_admin_show('修改密码','/web/password/{{$user->id}}',500,300)"
title=
"修改密码"
--
}}
{{
--href=
"javascript:;"
>
--}}
{{--
<i
class=
"iconfont"
>

</i>
--}}
{{--
</a>
--}}
<a
title=
"删除"
onclick=
"member_del(this,'{{$
user
["
_id
"]}}')"
href=
"javascript:;"
>
<a
title=
"删除"
onclick=
"member_del(this,'{{$
media
["
_id
"]}}')"
href=
"javascript:;"
>
<i
class=
"iconfont"
>

</i>
</a>
</td>
...
...
@@ -102,7 +96,7 @@
<div
class=
"page"
>
<div>
{{$
user
s->appends(['name'=>$name])->links()}}
{{$
media
s->appends(['name'=>$name])->links()}}
</div>
</div>
</div>
...
...
@@ -276,34 +270,65 @@
});
}
updateConfig
(
1
);
// updateConfig(1);
$
(
'#endDate'
).
bind
(
"onclickOnce"
,
function
()
{
alert
(
'sdfs'
)
})
function
updateConfig
(
num
)
{
var
options
=
{};
options
.
locale
=
{
// direction: $('#rtl').is(':checked') ? 'rtl' : 'ltr',
// format: 'MM/DD/YYYY HH:mm',
format
:
'YYYY/MM/DD'
,
separator
:
' - '
,
applyLabel
:
'确定'
,
cancelLabel
:
'取消'
,
fromLabel
:
'From'
,
toLabel
:
'To'
,
customRangeLabel
:
'Custom'
,
daysOfWeek
:
[
'日'
,
'一'
,
'二'
,
'三'
,
'四'
,
'五'
,
'六'
],
monthNames
:
[
'一月'
,
'二月'
,
'三月'
,
'四月'
,
'五月'
,
'六月'
,
'七月'
,
'八月'
,
'九月'
,
'十月'
,
'十一月'
,
'十二月'
],
firstDay
:
1
,
autoApply
:
true
,
};
$
(
'#endDate'
).
daterangepicker
(
options
,
function
(
start
,
end
)
{
$
(
'#endDate'
).
daterangepicker
({
"startDate"
:
"06/26/2020"
,
"endDate"
:
"07/02/2020"
},
function
(
start
,
end
,
label
)
{
console
.
log
(
"New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')"
);
});
console
.
log
(
'New date range selected: '
+
start
.
format
(
'YYYY-MM-DD'
)
+
' to '
+
end
.
format
(
'YYYY-MM-DD'
)
);
});
// var options = {};
//
// options.locale = {
// // direction: $('#rtl').is(':checked') ? 'rtl' : 'ltr',
// // format: 'MM/DD/YYYY HH:mm',
//
// startDate:"",
// endDate:"",
// format: 'YYYY/MM/DD',
// separator: ' - ',
// applyLabel: '确定',
// cancelLabel: '取消',
// fromLabel: 'From',
// toLabel: 'To',
// customRangeLabel: 'Custom',
// daysOfWeek: ['日', '一', '二', '三', '四', '五','六'],
// monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
// firstDay: 1,
// autoApply:true,
// };
//
// $('#endDate').daterangepicker(options, function(start, end) {
//
//
// console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') );
//
//
// });
}
...
...
routes/api.php
View file @
d4605eef
...
...
@@ -24,7 +24,7 @@ Route::group(['namespace' => 'Api', 'prefix' => 'v1', 'middleware' => ['auth']],
Route
::
post
(
'users'
,
'Client\UsersController@store'
);
Route
::
get
(
'media_catg'
,
'Client\MediaCategoryController@index'
);
Route
::
get
(
'generate_media_id'
,
'Client\MediaController@
getMediaNum
'
);
Route
::
get
(
'generate_media_id'
,
'Client\MediaController@
index
'
);
Route
::
get
(
'upload_token'
,
'Client\MediaController@getUploadMediaToken'
);
...
...
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