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
aaee50f9
Commit
aaee50f9
authored
Jul 02, 2020
by
杨昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
6395be7b
Pipeline
#9765
passed with stages
in 32 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
32 deletions
+45
-32
MediaController.php
app/Http/Controllers/Api/Client/MediaController.php
+1
-1
UsersController.php
app/Http/Controllers/Api/Client/UsersController.php
+17
-2
MediaRoute.php
app/Http/Routes/Web/MediaRoute.php
+1
-1
MediaModel.php
app/Model/MediaModel.php
+6
-9
module.json
public/module.json
+18
-19
left.blade.php
resources/views/admin/common/left.blade.php
+2
-0
No files found.
app/Http/Controllers/Api/Client/MediaController.php
View file @
aaee50f9
...
@@ -22,7 +22,7 @@ class MediaController extends Controller
...
@@ -22,7 +22,7 @@ class MediaController extends Controller
* @return \Illuminate\Http\JsonResponse
* @return \Illuminate\Http\JsonResponse
* @throws \App\Exceptions\ControllerException
* @throws \App\Exceptions\ControllerException
*/
*/
public
function
getMediaNum
(
Request
$request
){
public
function
index
(
Request
$request
){
$result
=
handler_drive
(
function
()
use
(
$request
)
{
$result
=
handler_drive
(
function
()
use
(
$request
)
{
return
[
"mediaID"
=>
date
(
'YmdHis'
,
time
())
.
generateRandomNum
(
8
)];
return
[
"mediaID"
=>
date
(
'YmdHis'
,
time
())
.
generateRandomNum
(
8
)];
...
...
app/Http/Controllers/Api/Client/UsersController.php
View file @
aaee50f9
...
@@ -58,8 +58,14 @@ class UsersController extends Controller
...
@@ -58,8 +58,14 @@ class UsersController extends Controller
'create_time'
=>
date
(
'Y-m-d H:i:s'
,
time
()),
'create_time'
=>
date
(
'Y-m-d H:i:s'
,
time
()),
'user_type'
=>
1
'user_type'
=>
1
];
];
DB
::
connection
(
"mongodb"
)
->
collection
(
"users"
)
->
insertGetId
(
$data
);
$id
=
DB
::
connection
(
"mongodb"
)
->
collection
(
"users"
)
->
insertGetId
(
$data
);
if
(
!
$id
){
$result
=
false
;
}
else
{
$result
=
true
;
$result
=
true
;
}
}
else
{
}
else
{
if
(
$user
[
'password'
]
==
md5
(
$password
)){
if
(
$user
[
'password'
]
==
md5
(
$password
)){
...
@@ -102,6 +108,11 @@ class UsersController extends Controller
...
@@ -102,6 +108,11 @@ class UsersController extends Controller
$idArr
=
(
$user
[
'_id'
])
->
jsonSerialize
();
$idArr
=
(
$user
[
'_id'
])
->
jsonSerialize
();
}
else
{
}
else
{
$id
=
DB
::
connection
(
"mongodb"
)
->
collection
(
"users"
)
->
insertGetId
(
$data
);
$id
=
DB
::
connection
(
"mongodb"
)
->
collection
(
"users"
)
->
insertGetId
(
$data
);
if
(
!
$id
){
throw
new
DatabaseException
(
'用户存储失败'
);
}
$idArr
=
(
$id
)
->
jsonSerialize
();
$idArr
=
(
$id
)
->
jsonSerialize
();
}
}
...
@@ -109,7 +120,11 @@ class UsersController extends Controller
...
@@ -109,7 +120,11 @@ class UsersController extends Controller
$newtoken
=
encrypt
(
$_id
.
'|'
.
$token
.
"|1ZGHd3pCc87AsQFBLLJeMjM4t57cli6Ar78qowe7"
);
$newtoken
=
encrypt
(
$_id
.
'|'
.
$token
.
"|1ZGHd3pCc87AsQFBLLJeMjM4t57cli6Ar78qowe7"
);
$data
[
'token'
]
=
$newtoken
;
$data
[
'token'
]
=
$newtoken
;
DB
::
connection
(
'mongodb'
)
->
collection
(
'users'
)
->
where
(
'_id'
,
$_id
)
->
update
(
$data
);
$flag
=
DB
::
connection
(
'mongodb'
)
->
collection
(
'users'
)
->
where
(
'_id'
,
$_id
)
->
update
(
$data
);
if
(
!
$flag
){
throw
new
DatabaseException
(
'用户名信息更新失败'
);
}
return
$newtoken
;
return
$newtoken
;
...
...
app/Http/Routes/Web/MediaRoute.php
View file @
aaee50f9
...
@@ -14,7 +14,7 @@ class MediaRoute extends AuthenRoute
...
@@ -14,7 +14,7 @@ class MediaRoute extends AuthenRoute
{
{
public
function
map
(
Registrar
$router
,
$callback
){
public
function
map
(
Registrar
$router
,
$callback
){
parent
::
map
(
$router
,
function
()
use
(
$router
){
parent
::
map
(
$router
,
function
()
use
(
$router
){
$router
->
resource
(
'media'
,
'MediaController'
);
$router
->
resource
(
'media
_manager
'
,
'MediaController'
);
});
});
}
}
...
...
app/Model/MediaModel.php
View file @
aaee50f9
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
namespace
App\Model
;
namespace
App\Model
;
use
App\Exceptions\DatabaseException
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Support\Facades\DB
;
class
MediaModel
extends
Model
class
MediaModel
extends
Model
{
{
...
@@ -22,26 +24,21 @@ class MediaModel extends Model
...
@@ -22,26 +24,21 @@ class MediaModel extends Model
$where
[
'name'
]
=
$request
->
name
;
$where
[
'name'
]
=
$request
->
name
;
}
}
$medias
=
DB
::
connection
(
'mongodb'
)
->
collection
(
'media'
)
$users
=
DB
::
connection
(
'mongodb'
)
->
collection
(
'media'
)
->
where
(
$where
)
->
where
(
$where
)
->
paginate
(
10
);
->
paginate
(
10
);
foreach
(
$medias
as
&
$user
){
// dd($users);die;
foreach
(
$users
as
&
$user
){
$idArr
=
(
$user
[
'_id'
])
->
jsonSerialize
();
$idArr
=
(
$user
[
'_id'
])
->
jsonSerialize
();
$user
[
'_id'
]
=
$idArr
[
'$oid'
];
$user
[
'_id'
]
=
$idArr
[
'$oid'
];
}
}
}
catch
(
\Exception
$exception
){
}
catch
(
\Exception
$exception
){
throw
new
DatabaseException
(
$exception
->
getMessage
());
throw
new
DatabaseException
(
$exception
->
getMessage
());
}
}
return
$users
;
return
$medias
;
}
}
...
...
public/module.json
View file @
aaee50f9
...
@@ -130,14 +130,25 @@
...
@@ -130,14 +130,25 @@
"description"
:
""
,
"description"
:
""
,
"show"
:
1
,
"show"
:
1
,
"sort"
:
2
,
"sort"
:
2
,
"key_name"
:
"manager_
role_block
"
,
"key_name"
:
"manager_
media
"
,
"son"
:
[{
"son"
:
[{
"id"
:
15
,
"pid"
:
11
,
"name"
:
"媒资列表"
,
"icon"
:
""
,
"link"
:
"/media_manager"
,
"slug"
:
"media_manager.index"
,
"description"
:
""
,
"show"
:
1
,
"sort"
:
25
,
"key_name"
:
"media_list"
},{
"id"
:
23
,
"id"
:
23
,
"pid"
:
11
,
"pid"
:
11
,
"name"
:
"媒资删除"
,
"name"
:
"媒资删除"
,
"icon"
:
""
,
"icon"
:
""
,
"link"
:
""
,
"link"
:
""
,
"slug"
:
"media.destroy"
,
"slug"
:
"media
_manager
.destroy"
,
"description"
:
""
,
"description"
:
""
,
"show"
:
0
,
"show"
:
0
,
"sort"
:
25
,
"sort"
:
25
,
...
@@ -148,7 +159,7 @@
...
@@ -148,7 +159,7 @@
"name"
:
"媒资添加保存"
,
"name"
:
"媒资添加保存"
,
"icon"
:
""
,
"icon"
:
""
,
"link"
:
""
,
"link"
:
""
,
"slug"
:
"media.store"
,
"slug"
:
"media
_manager
.store"
,
"description"
:
""
,
"description"
:
""
,
"show"
:
0
,
"show"
:
0
,
"sort"
:
25
,
"sort"
:
25
,
...
@@ -159,7 +170,7 @@
...
@@ -159,7 +170,7 @@
"name"
:
"媒资修改保存"
,
"name"
:
"媒资修改保存"
,
"icon"
:
""
,
"icon"
:
""
,
"link"
:
""
,
"link"
:
""
,
"slug"
:
"media.update"
,
"slug"
:
"media
_manager
.update"
,
"description"
:
""
,
"description"
:
""
,
"show"
:
0
,
"show"
:
0
,
"sort"
:
25
,
"sort"
:
25
,
...
@@ -170,7 +181,7 @@
...
@@ -170,7 +181,7 @@
"name"
:
"媒资编辑"
,
"name"
:
"媒资编辑"
,
"icon"
:
""
,
"icon"
:
""
,
"link"
:
""
,
"link"
:
""
,
"slug"
:
"media.edit"
,
"slug"
:
"media
_manager
.edit"
,
"description"
:
""
,
"description"
:
""
,
"show"
:
0
,
"show"
:
0
,
"sort"
:
25
,
"sort"
:
25
,
...
@@ -180,22 +191,11 @@
...
@@ -180,22 +191,11 @@
"pid"
:
11
,
"pid"
:
11
,
"name"
:
"媒资添加"
,
"name"
:
"媒资添加"
,
"icon"
:
""
,
"icon"
:
""
,
"link"
:
"/media/create"
,
"link"
:
"/media
_manager
/create"
,
"slug"
:
"media.create"
,
"slug"
:
"media
_manager
.create"
,
"description"
:
""
,
"description"
:
""
,
"show"
:
0
,
"show"
:
0
,
"sort"
:
25
,
"sort"
:
25
,
"key_name"
:
"media_create"
"key_name"
:
"media_create"
},{
"id"
:
15
,
"pid"
:
11
,
"name"
:
"媒资列表"
,
"icon"
:
""
,
"link"
:
"/media"
,
"slug"
:
"media.index"
,
"description"
:
""
,
"show"
:
1
,
"sort"
:
25
,
"key_name"
:
"media_list"
}]
}]
}]
}]
\ No newline at end of file
resources/views/admin/common/left.blade.php
View file @
aaee50f9
...
@@ -105,6 +105,8 @@
...
@@ -105,6 +105,8 @@
//设置选择项颜色
//设置选择项颜色
$
(
li_arr
[
i
]).
children
(
"a:eq(0)"
).
addClass
(
'choice'
);
$
(
li_arr
[
i
]).
children
(
"a:eq(0)"
).
addClass
(
'choice'
);
console
.
log
(
'$(li_arr[i])'
,
$
(
li_arr
[
i
]))
console
.
log
(
'$(li_arr[i])'
,
$
(
li_arr
[
i
]))
}
}
}
}
...
...
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