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
debaddca
Commit
debaddca
authored
Nov 29, 2019
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
f6c1cea1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
1 deletions
+87
-1
bigdata/app/base/api/impl/auth/accessAuth.js
+73
-1
bigdata/app/base/service/impl/auth/userSve.js
+14
-0
No files found.
bigdata/app/base/api/impl/auth/accessAuth.js
View file @
debaddca
...
...
@@ -184,7 +184,25 @@ class AccessAuthAPI extends APIBase {
}
return
system
.
getResult
(
ruser
);
}
//根据openid登录
async
loginByOpenId
(
p
,
q
,
req
){
var
openid
=
p
.
openid
;
if
(
!
openid
)
{
return
system
.
getResult
(
null
,
"openid不能为空"
);
}
var
param
=
{
app_id
:
req
.
app
.
id
,
openid
:
openid
,
}
var
ruser
=
await
this
.
userSve
.
checkWxBind
(
param
);
if
(
!
ruser
){
return
system
.
getResult
(
null
,
"用户未绑定微信"
);
}
var
opencode
=
super
.
getUUID
();
var
authUrl
=
req
.
app
.
authUrl
+
"?opencode="
+
opencode
;
await
this
.
cacheManager
[
"OpenCodeCache"
].
cache
(
opencode
,
ruser
,
120
);
return
system
.
getResultSuccess
({
auth_url
:
authUrl
,
opencode
:
opencode
});
}
//wxbind
async
wxBind
(
pobj
,
qobj
,
req
)
{
var
appkey
=
req
.
app
.
appkey
;
...
...
@@ -561,6 +579,60 @@ class AccessAuthAPI extends APIBase {
rtnType
:
"json object{status:-1,data:2030),验证码错误,成功:{status:0,...}"
},
{
methodDesc
:
"按照微信openid检查是否绑定,访问地址:http://......../api/auth/accessAuth/checkWxBind,访问token需要放置到后续API方法调用的请求头中"
,
methodName
:
"checkWxBind"
,
paramdescs
:
[
{
paramDesc
:
"微信openid"
,
paramName
:
"openid"
,
paramType
:
"string"
,
defaultValue
:
""
,
}
],
rtnTypeDesc
:
"返回绑定后的用户"
,
rtnType
:
"成功:{status:0,data:{}),未绑定:{status:-1}"
},
{
methodDesc
:
"按照手机号、验证码,微信ID,绑定账号,访问地址:http://......../api/auth/accessAuth/wxBind,访问token需要放置到后续API方法调用的请求头中"
,
methodName
:
"wxBind"
,
paramdescs
:
[
{
paramDesc
:
"手机号"
,
paramName
:
"mobile"
,
paramType
:
"string"
,
defaultValue
:
""
,
},
{
paramDesc
:
"验证码"
,
paramName
:
"vcode"
,
paramType
:
"string"
,
defaultValue
:
""
,
},
{
paramDesc
:
"微信openid"
,
paramName
:
"openid"
,
paramType
:
"string"
,
defaultValue
:
""
,
}
],
rtnTypeDesc
:
"返回绑定后的获取用户的code"
,
rtnType
:
"成功:{status:0,data:{auth_url: xxxxx/auth?opencode=xxxxx,opencode:yyyy})"
},
{
methodDesc
:
"按照微信ID进行登录,访问地址:http://......../api/auth/accessAuth/loginByOpenId,访问token需要放置到后续API方法调用的请求头中"
,
methodName
:
"loginByOpenId"
,
paramdescs
:
[
{
paramDesc
:
"微信openid"
,
paramName
:
"openid"
,
paramType
:
"string"
,
defaultValue
:
""
,
}
],
rtnTypeDesc
:
"返回绑定后的获取用户的code"
,
rtnType
:
"成功:{status:0,data:{auth_url: xxxxx/auth?opencode=xxxxx,opencode:yyyy})"
},
{
methodDesc
:
"按照手机号、验证码修改密码,访问地址:http://......../api/auth/accessAuth/modiPasswordByUserName,访问token需要放置到后续API方法调用的请求头中"
,
methodName
:
"modiPasswordByUserName"
,
paramdescs
:
[
...
...
bigdata/app/base/service/impl/auth/userSve.js
View file @
debaddca
...
...
@@ -341,6 +341,20 @@ class UserService extends ServiceBase {
}
return
user
;
}
async
wxBind
(
u
)
{
var
self
=
this
;
return
this
.
db
.
transaction
(
async
function
(
t
)
{
var
user
=
await
self
.
dao
.
model
.
findOne
({
where
:
{
mobile
:
u
.
mobile
,
app_id
:
u
.
app_id
}});
if
(
!
user
){
return
null
;
}
else
{
user
.
wxopenid
=
u
.
openid
;
await
user
.
save
();
return
user
;
}
});
}
async
getUserByUserMobile
(
u
)
{
//勇于从别的应用中,点击页面连接,跳转到平台应用中进行管理
var
user
=
await
this
.
dao
.
model
.
findOne
({
...
...
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