Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uc_card
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
zhoujun
uc_card
Commits
cd107fe0
Commit
cd107fe0
authored
Jun 07, 2021
by
zhoujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片上传
parent
16233d1f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
src/app/Http/Controllers/Card/CardController.php
src/app/Http/Controllers/Card/CardController.php
+9
-4
No files found.
src/app/Http/Controllers/Card/CardController.php
View file @
cd107fe0
...
...
@@ -278,6 +278,8 @@ class CardController extends Controller
public
function
getUploadImg
(
Request
$request
)
{
$userId
=
$request
->
session
()
->
get
(
"uid"
);
$roleId
=
$request
->
input
(
'roleId'
);
$serverId
=
$request
->
input
(
'serverId'
);
$result
=
$this
->
getVerityLogin
(
$userId
);
if
(
$result
[
'code'
]
!=
200
)
return
$this
->
jsonReturn
(
$result
[
'code'
],
$result
[
'msg'
]);
$postData
=
$request
->
all
();
...
...
@@ -286,8 +288,10 @@ class CardController extends Controller
$upload
=
new
UploadServer
();
$result
=
$upload
->
getUpload
(
$postData
,
$file
);
if
(
$result
[
'code'
]
!=
200
)
return
$this
->
jsonReturn
(
$result
[
'code'
],
$result
[
'msg'
]);
$img
=
$this
->
getUpdateImg
(
$result
[
'data'
],
$userId
);
$tableName
=
'wx_card_role_'
.
$serverId
;
$role
=
DB
::
connection
(
'wx_mysql'
)
->
table
(
$tableName
)
->
where
(
'uid'
,
$userId
)
->
where
(
'role_id'
,
$roleId
)
->
select
(
'id'
)
->
first
();
$img
=
$this
->
getUpdateImg
(
$result
[
'data'
],
$userId
,
$role
->
id
);
if
(
$img
)
return
$this
->
jsonReturn
(
0
,
'上传成功'
,[
'src'
=>
$result
[
'data'
]]);
return
$this
->
jsonReturn
(
10060
,
'上传失败'
);
}
...
...
@@ -299,9 +303,9 @@ class CardController extends Controller
* @date 2021/06/01
* @author live
*/
public
function
getUpdateImg
(
$data
,
$userId
)
public
function
getUpdateImg
(
$data
,
$userId
,
$roleId
)
{
$img
=
WxUserImg
::
where
(
'uid'
,
$userId
)
->
first
();
$img
=
WxUserImg
::
where
(
'uid'
,
$userId
)
->
where
(
'role_id'
,
$roleId
)
->
first
();
if
(
$img
){
$img
->
loacl_url
=
$data
[
'url'
];
$img
->
img_url
=
$data
[
'yunUrl'
];
...
...
@@ -310,6 +314,7 @@ class CardController extends Controller
}
else
{
$row
=
new
WxUserImg
();
$row
->
uid
=
$userId
;
$row
->
role_id
=
$roleId
;
$row
->
loacl_url
=
$data
[
'url'
];
$row
->
img_url
=
$data
[
'yunUrl'
];
$row
->
status
=
0
;
...
...
@@ -338,7 +343,7 @@ class CardController extends Controller
$user
=
User
::
where
(
'uid'
,
$userId
)
->
select
(
'uid'
,
'account'
)
->
first
();
$data
[
'userName'
]
=
$user
->
account
??
''
;
$img
=
WxUserImg
::
where
(
'uid'
,
$userId
)
->
select
(
'id'
,
'img_url'
,
'status'
)
->
first
();
$img
=
WxUserImg
::
where
(
'uid'
,
$userId
)
->
where
(
'role_id'
,
$info
->
id
)
->
select
(
'id'
,
'img_url'
,
'status'
)
->
first
();
if
(
$img
){
$data
[
'userImgStatus'
]
=
$img
->
status
;
$data
[
'userImg'
]
=
$img
->
img_url
;
...
...
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