Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
61bcb046
Commit
61bcb046
authored
May 12, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
d34d3957
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
center-manage/app/base/controller/impl/auth/userCtl.js
+5
-6
center-manage/app/base/service/impl/auth/userSve.js
+15
-5
No files found.
center-manage/app/base/controller/impl/auth/userCtl.js
View file @
61bcb046
...
@@ -3,7 +3,6 @@ const http = require("http")
...
@@ -3,7 +3,6 @@ const http = require("http")
const
querystring
=
require
(
'querystring'
);
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
var
cacheBaseComp
=
null
;
class
UserCtl
extends
CtlBase
{
class
UserCtl
extends
CtlBase
{
constructor
()
{
constructor
()
{
super
(
"auth"
,
CtlBase
.
getServiceName
(
UserCtl
));
super
(
"auth"
,
CtlBase
.
getServiceName
(
UserCtl
));
...
@@ -23,11 +22,11 @@ class UserCtl extends CtlBase {
...
@@ -23,11 +22,11 @@ class UserCtl extends CtlBase {
return
system
.
getResultSuccess
(
rtn
);
return
system
.
getResultSuccess
(
rtn
);
}
}
//获取验证码,发送给指定手机
//获取验证码,发送给指定手机
async
sendVCode
(
pobj
,
qobj
,
req
)
{
//
async sendVCode(pobj, qobj, req) {
var
mobile
=
pobj
.
mobile
;
//
var mobile = pobj.mobile;
let
v
=
await
this
.
smsS
.
sendVCode
(
mobile
);
//
let v = await this.smsS.sendVCode(mobile);
return
system
.
getResult
({
vcodestr
:
v
});
//
return system.getResult({ vcodestr: v });
}
//
}
async
exit
(
pobj
,
qobj
,
req
)
{
async
exit
(
pobj
,
qobj
,
req
)
{
}
}
...
...
center-manage/app/base/service/impl/auth/userSve.js
View file @
61bcb046
...
@@ -173,12 +173,14 @@ class UserService extends ServiceBase {
...
@@ -173,12 +173,14 @@ class UserService extends ServiceBase {
}
else
{
}
else
{
//检查是否在库里存在
//检查是否在库里存在
//appkey--company_id---需要控制器基类里设置到p对象里
//appkey--company_id---需要控制器基类里设置到p对象里
let
user
=
await
this
.
dao
.
model
.
findOne
({
let
user
=
await
this
.
cacheManager
[
"UserCache"
].
cache
(
mobile
)
where
:
{
userName
:
mobile
,
app_id
:
settings
.
pmappid
},
include
:
[{
model
:
this
.
db
.
models
.
company
,
raw
:
true
,
attributes
:
[
"companykey"
]
}]
}
);
if
(
user
)
{
if
(
user
)
{
let
roleids
=
user
.
Roles
.
map
(
item
=>
{
return
item
.
id
})
let
auths
=
await
this
.
authS
.
findAuthsByRole
(
roleids
)
user
[
"access"
]
=
auths
//生成token
//生成token
let
token
=
await
this
.
cmakejwt
(
user
.
jwtkey
,
user
.
jwtsecret
,
null
);
let
token
=
await
this
.
cmakejwt
(
user
.
jwtkey
,
user
.
jwtsecret
,
null
);
rtn
.
token
=
token
;
rtn
.
token
=
token
;
...
@@ -190,6 +192,14 @@ class UserService extends ServiceBase {
...
@@ -190,6 +192,14 @@ class UserService extends ServiceBase {
let
token
=
await
this
.
cmakejwt
(
regrtn
.
user
.
jwtkey
,
regrtn
.
user
.
jwtsecret
,
null
);
let
token
=
await
this
.
cmakejwt
(
regrtn
.
user
.
jwtkey
,
regrtn
.
user
.
jwtsecret
,
null
);
// rtn.token = token;
// rtn.token = token;
// rtn.user = u;
// rtn.user = u;
let
userfind
=
await
this
.
cacheManager
[
"UserCache"
].
cache
(
mobile
)
let
roleids
=
userfind
.
Roles
.
map
(
item
=>
{
return
item
.
id
})
let
auths
=
await
this
.
authS
.
findAuthsByRole
(
roleids
)
userfind
[
"access"
]
=
auths
regrtn
.
user
=
userfind
regrtn
.
token
=
token
regrtn
.
token
=
token
return
regrtn
;
return
regrtn
;
}
}
...
...
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