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
04bf7d44
Commit
04bf7d44
authored
Aug 21, 2020
by
杨昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除媒资清除目标
parent
7d62c2c4
Pipeline
#10794
passed with stages
in 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
MediaModel.php
app/Model/MediaModel.php
+16
-7
media_list.blade.php
resources/views/admin/media/media_list.blade.php
+1
-1
No files found.
app/Model/MediaModel.php
View file @
04bf7d44
...
@@ -40,6 +40,15 @@ class MediaModel extends Eloquent
...
@@ -40,6 +40,15 @@ class MediaModel extends Eloquent
public
static
function
mediaList
(
$request
){
public
static
function
mediaList
(
$request
){
try
{
try
{
$medias
=
MediaModel
::
query
()
->
raw
(
function
(
$collection
)
use
(
$request
){
$medias
=
MediaModel
::
query
()
->
raw
(
function
(
$collection
)
use
(
$request
){
...
@@ -51,7 +60,7 @@ class MediaModel extends Eloquent
...
@@ -51,7 +60,7 @@ class MediaModel extends Eloquent
}
}
$page
=
$request
->
page
??
1
;
$page
=
$request
->
page
??
1
;
$aggregate
=
[];
/**
/**
* 默认降序
* 默认降序
*/
*/
...
@@ -68,6 +77,7 @@ class MediaModel extends Eloquent
...
@@ -68,6 +77,7 @@ class MediaModel extends Eloquent
$aggregate
[][
'$match'
][
'media_type_id'
]
=
$request
->
category_id
;
$aggregate
[][
'$match'
][
'media_type_id'
]
=
$request
->
category_id
;
}
}
// $aggregate[]['$match']['_id'] = 'mda-864371b9a82d1e21';
// $aggregate[]['$match']['_id'] = 'mda-864371b9a82d1e21';
if
(
isset
(
$request
->
media_name
)
&&
!
empty
(
$request
->
media_name
)){
if
(
isset
(
$request
->
media_name
)
&&
!
empty
(
$request
->
media_name
)){
...
@@ -92,16 +102,15 @@ class MediaModel extends Eloquent
...
@@ -92,16 +102,15 @@ class MediaModel extends Eloquent
$aggregate
[][
'$match'
][
'end_time'
]
=
[
'$lt'
=>
$end_time
];
$aggregate
[][
'$match'
][
'end_time'
]
=
[
'$lt'
=>
$end_time
];
}
}
$aggregate
[][
'$sort'
]
=
[
'start_time'
=>
$sort
]
;
$aggregate
1
=
$aggregate
;
$aggregate
1
=
$aggregate
;
$aggregate
[][
'$sort'
]
=
[
'start_time'
=>
$sort
]
;
$aggregate1
[][
'$group'
]
=
[
$aggregate1
[][
'$group'
]
=
[
'_id'
=>
null
,
//更具性别进行分组
'_id'
=>
array
()
,
//更具性别进行分组
'count'
=>
array
(
'$sum'
=>
1
)
'count'
=>
array
(
'$sum'
=>
1
)
];
];
$count
=
$collection
->
aggregate
(
$aggregate1
)
->
toArray
();
$count
=
$collection
->
aggregate
(
$aggregate1
)
->
toArray
();
if
(
isset
(
$count
[
0
])){
if
(
isset
(
$count
[
0
])){
...
@@ -136,7 +145,6 @@ class MediaModel extends Eloquent
...
@@ -136,7 +145,6 @@ class MediaModel extends Eloquent
}
}
}
}
return
new
LengthAwarePaginator
(
$tmp_arr
,
$count
,
$limit
,
$page
,[
return
new
LengthAwarePaginator
(
$tmp_arr
,
$count
,
$limit
,
$page
,[
'path'
=>
Paginator
::
resolveCurrentPath
(),
'path'
=>
Paginator
::
resolveCurrentPath
(),
'pageName'
=>
'page'
,
'pageName'
=>
'page'
,
...
@@ -405,7 +413,8 @@ class MediaModel extends Eloquent
...
@@ -405,7 +413,8 @@ class MediaModel extends Eloquent
if
(
empty
(
$media_catg
)){
if
(
empty
(
$media_catg
)){
throw
new
\Exception
(
"媒资类别不存在"
);
throw
new
\Exception
(
"媒资类别不存在"
);
}
}
$tmp
[]
=
MediaModel
::
select
(
"_id"
,
"book_num"
,
"book_name"
,
"secret_key"
,
"media_url"
)
->
whereIn
(
'book_num'
,
$media_ids
)
->
get
();
$tmp
[]
=
MediaModel
::
select
(
"_id"
,
"book_num"
,
"book_name"
,
"secret_key"
,
"media_url"
)
->
where
(
"media_type_id"
,
$media_catg
[
'_id'
])
->
whereIn
(
'book_num'
,
$media_ids
)
->
get
();
}
}
}
catch
(
\Exception
$exception
){
}
catch
(
\Exception
$exception
){
...
...
resources/views/admin/media/media_list.blade.php
View file @
04bf7d44
...
@@ -150,7 +150,7 @@
...
@@ -150,7 +150,7 @@
top
:
'50%'
top
:
'50%'
});
});
setTimeout
(
function
()
{
setTimeout
(
function
()
{
window
.
location
.
href
=
'/web/media_model'
;
window
.
location
.
href
=
'/web/media_model
?media_name={{$media_name}}&media_id={{$media_id}}&start_time={{$start_time}}&end_time={{$end_time}}&category_id={{$category_id}}&appid={{$appid}}
'
;
},
2000
)
},
2000
)
}
else
{
}
else
{
$
(
'body'
).
toast
({
$
(
'body'
).
toast
({
...
...
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