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
51c6c8d1
Commit
51c6c8d1
authored
Mar 25, 2021
by
杨昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加媒资类别倒序排列
parent
2c0c651a
Pipeline
#14027
passed with stages
in 3 minutes 26 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
MediaCategoryModel.php
app/Model/MediaCategoryModel.php
+7
-2
No files found.
app/Model/MediaCategoryModel.php
View file @
51c6c8d1
...
...
@@ -3,8 +3,10 @@
namespace
App\Model
;
use
App\Exceptions\DatabaseException
;
use
App\Tool\Constant
;
use
http\Env\Request
;
use
Jenssegers\Mongodb\Eloquent\Model
as
Eloquent
;
use
MongoDB\BSON\UTCDateTime
;
class
MediaCategoryModel
extends
Eloquent
{
...
...
@@ -85,7 +87,7 @@ class MediaCategoryModel extends Eloquent
$where
[
'name'
]
=
$request
->
name
;
}
$catgList
=
MediaCategoryModel
::
where
(
$where
)
->
paginate
(
10
);
$catgList
=
MediaCategoryModel
::
where
(
$where
)
->
orderBy
(
"create_time"
,
Constant
::
SORT_DESC
)
->
paginate
(
10
);
}
catch
(
\Exception
$exception
){
throw
new
DatabaseException
(
"类别不存在"
);
...
...
@@ -103,11 +105,14 @@ class MediaCategoryModel extends Eloquent
public
static
function
addMediaCatg
(
$request
){
try
{
$create_time
=
new
UTCDateTime
(
time
()
*
1000
);;
$data
=
[
'name'
=>
$request
->
name
,
'status'
=>
0
,
'media_category_id'
=>
$request
->
media_category_id
??
''
,
'description'
=>
$request
->
description
??
''
'description'
=>
$request
->
description
??
''
,
'create_time'
=>
$create_time
,
];
$mediaCatg
=
MediaCategoryModel
::
where
(
'name'
,
$request
->
name
)
->
first
();
...
...
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