Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ruer_cms
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蔡闯
ruer_cms
Commits
79ea795c
Commit
79ea795c
authored
May 26, 2021
by
蔡闯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2021-5-26
parent
e99e8542
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
15 deletions
+25
-15
app/api/controller/Base.php
app/api/controller/Base.php
+6
-6
app/api/controller/User.php
app/api/controller/User.php
+19
-9
No files found.
app/api/controller/Base.php
View file @
79ea795c
...
@@ -11,12 +11,12 @@ class Base extends \app\BaseController
...
@@ -11,12 +11,12 @@ class Base extends \app\BaseController
parent
::
__construct
(
$app
);
parent
::
__construct
(
$app
);
if
(
Request
::
header
(
"token"
)){
//
if(Request::header("token")){
$decodeData
=
(
array
)
JWT
::
decode
(
Request
::
header
(
'token'
),
config
(
'app.jwt_key'
),
array
(
"HS256"
));
//
$decodeData= (array)JWT::decode(Request::header('token'),config('app.jwt_key'),array("HS256"));
$this
->
uid
=
$decodeData
[
'uid'
];
//
$this->uid = $decodeData['uid'];
}
else
{
//
} else {
echo
json_encode
([
'code'
=>
401
,
'msg'
=>
"token不存在!"
]);
exit
;
//
echo json_encode(['code'=>401,'msg'=>"token不存在!"]);exit;
}
//
}
}
}
}
}
\ No newline at end of file
app/api/controller/User.php
View file @
79ea795c
...
@@ -8,6 +8,7 @@ namespace app\api\controller;
...
@@ -8,6 +8,7 @@ namespace app\api\controller;
use
app\common\controller\Common
;
use
app\common\controller\Common
;
use
think\facade\Db
;
use
think\facade\Db
;
use
think\facade\Request
;
use
think\facade\Request
;
use
function
fast\e
;
class
User
extends
Base
class
User
extends
Base
{
{
...
@@ -255,21 +256,30 @@ class User extends Base
...
@@ -255,21 +256,30 @@ class User extends Base
//多图片能上传接口
//多图片能上传接口
public
function
uploadImgs
()
{
public
function
uploadImgs
()
{
$file
=
request
()
->
file
(
'images'
);
$file
=
$_FILES
[
'images'
];
$path
=
"/feedback"
;
$arr
=
[];
foreach
(
$file
as
$v
)
{
foreach
(
$file
[
'type'
]
as
$k
){
$path
=
'/'
.
$path
;
$ext_arr
=
explode
(
'/'
,
$k
);
$data
=
Common
::
uploadImg
(
$v
,
$path
);
if
(
!
in_array
(
$ext_arr
[
1
],[
'jpeg'
,
'jpg'
,
'gif'
,
'bmp'
,
'png'
]))
{
$arr
[]
=
$data
[
'data'
];
return
$this
->
returnJson
([],
'请上传图片文件'
,
400
);
}
$ext
[]
=
$ext_arr
[
1
];
}
foreach
(
$file
[
'tmp_name'
]
as
$k
=>
$v
)
{
$path
=
'./upload/feedback/'
;
$filename
=
date
(
"YmdHis"
)
.
rand
(
0
,
10
)
.
'.'
.
$ext
[
$k
];
if
(
move_uploaded_file
(
$v
,
$path
.
$filename
)){
$arr
[]
=
"http://"
.
$_SERVER
[
'SERVER_NAME'
]
.
"/upload/feedback/"
.
$filename
;
}
else
{
return
$this
->
returnJson
([],
'图片上传失败!'
,
400
);
}
}
}
if
(
$arr
)
{
if
(
$arr
)
{
return
$this
->
returnJson
(
$arr
,
'success'
);
return
$this
->
returnJson
(
$arr
,
'success'
);
}
else
{
}
else
{
return
$this
->
returnJson
([],
'
请上传图片文件
'
,
400
);
return
$this
->
returnJson
([],
'
图片上传失败!
'
,
400
);
}
}
}
}
//设置本次登入的房间未最近一次登入的,下次登入自动切换
//设置本次登入的房间未最近一次登入的,下次登入自动切换
public
function
setUserBind
(){
public
function
setUserBind
(){
$bind_id
=
Request
::
param
(
'house_user_bind_id'
);
$bind_id
=
Request
::
param
(
'house_user_bind_id'
);
...
...
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