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
6fd0109a
Commit
6fd0109a
authored
Mar 19, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
0cff6407
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
181 additions
and
42 deletions
+181
-42
center-channel/app/base/api/impl/opreceive/accessAuth.js
+135
-0
center-channel/app/base/service/impl/utilsSve/utilsOpOrderSve.js
+2
-2
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
+4
-7
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
+1
-1
center-channel/app/config/routes/api.js
+5
-0
center-channel/峰擎文档
+34
-32
No files found.
center-channel/app/base/api/impl/opreceive/accessAuth.js
0 → 100644
View file @
6fd0109a
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
AccessAuthAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
utilsAuthSve
=
system
.
getObject
(
"service.utilsSve.utilsAuthSve"
);
this
.
utilsNeedSve
=
system
.
getObject
(
"service.utilsSve.utilsNeedSve"
);
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
springBoard
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionProcess
)
{
return
system
.
getResult
(
null
,
"actionProcess参数不能为空"
);
}
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
system
.
getResult
(
null
,
"req Failure"
);
pobj
.
actionBody
.
userpin
=
pobj
.
actionBody
.
userpin
||
this
.
getUUID
();
switch
(
action_type
)
{
// sy
case
"test"
:
//测试
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
break
;
case
"getNeedUserPinByChannelUserId"
:
//渠道通过账户进行登录,有则返回用户信息,没有则创建用户
var
tmpOpResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
if
(
tmpOpResult
.
status
!=
0
&&
tmpOpResult
.
status
!=
2060
)
{
return
tmpOpResult
;
}
opResult
=
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
if
(
tmpOpResult
.
status
==
2060
)
{
opResult
.
msg
=
tmpOpResult
.
msg
;
opResult
.
data
.
userpin
=
tmpOpResult
.
data
.
userpin
;
}
//获取需求信息
pobj
.
actionType
=
"getItemByNeedNo"
;
var
needResult
=
await
this
.
utilsNeedSve
.
getItemByNeedNo
(
pobj
,
pobj
.
actionBody
);
if
(
needResult
.
status
!=
0
)
{
return
needResult
;
}
opResult
.
data
.
channelTypeCode
=
needResult
.
data
.
channelTypeCode
;
opResult
.
data
.
typeCode
=
needResult
.
data
.
typeCode
break
;
case
"getLoginByUserName"
:
//渠道通过账户进行登录,有则返回用户信息,没有则创建用户
opResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
!=
0
&&
opResult
.
status
!=
2060
)
{
return
opResult
;
}
opResult
=
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
if
(
opResult
.
status
==
2060
)
{
opResult
.
msg
=
opResult
.
msg
;
opResult
.
data
.
userpin
=
opResult
.
data
.
userpin
;
}
break
;
case
"getVerifyCode"
:
//获取默认模板的手机验证码
opResult
=
await
this
.
utilsAuthSve
.
getVerifyCodeByMoblie
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
()
}
break
;
case
"userPinByLgoin"
:
//通过账户和密码登录
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoin
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
break
;
case
"userPinByLgoinVcode"
:
//通过短信登录信息
pobj
.
actionBody
.
reqType
=
"login"
;
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
break
;
case
"userPinByRegister"
:
//通过短信注册信息
pobj
.
actionBody
.
reqType
=
"reg"
;
opResult
=
await
this
.
utilsAuthSve
.
getReqUserPinByLgoinVcode
(
pobj
,
pobj
.
actionBody
);
if
(
opResult
.
status
==
0
)
{
return
system
.
getResultSuccess
({
userpin
:
pobj
.
actionBody
.
userpin
})
}
break
;
case
"putUserPwdByMobile"
:
//通过手机验证码修改用户密码
opResult
=
await
this
.
utilsAuthSve
.
putUserPwdByMobile
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getLoginInfo"
:
//通过userpin获取用户登录信息
opResult
=
await
this
.
utilsAuthSve
.
getLoginInfo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"logout"
:
//用户退出
opResult
=
await
this
.
utilsAuthSve
.
userLogout
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
*/
async
getAppTokenByHosts
(
pobj
,
qobj
,
req
)
{
var
token
=
this
.
getUUID
();
pobj
.
actionBody
.
reqType
=
"hosts"
;
var
opResult
=
await
this
.
utilsAuthSve
.
getReqTokenByHosts
(
pobj
.
actionBody
,
token
);
if
(
opResult
.
status
!=
0
)
{
return
opResult
;
}
return
system
.
getResultSuccess
({
token
:
token
})
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
*/
async
getAppTokenByAppKey
(
pobj
,
qobj
,
req
)
{
var
token
=
this
.
getUUID
();
pobj
.
actionBody
.
reqType
=
"appkey"
;
var
opResult
=
await
this
.
utilsAuthSve
.
getReqTokenByHosts
(
pobj
.
actionBody
,
token
);
if
(
opResult
.
status
!=
0
)
{
return
opResult
;
}
return
system
.
getResultSuccess
({
token
:
token
})
}
}
module
.
exports
=
AccessAuthAPI
;
\ No newline at end of file
center-channel/app/base/service/impl/utilsSve/utilsOpOrderSve.js
View file @
6fd0109a
...
...
@@ -14,7 +14,7 @@ class UtilsOpOrderService extends AppServiceBase {
}
var
reqUrl
=
this
.
centerOrderUrl
+
"opaction/opOrder/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
this
.
opUpdatePushInfo
(
result
,
pobj
,
actionBody
,
"pushUpdateContacts"
);
this
.
opUpdatePushInfo
(
result
,
pobj
,
actionBody
,
"pushUpdate
Order
Contacts"
);
result
.
data
=
null
;
return
result
;
}
...
...
@@ -42,7 +42,7 @@ class UtilsOpOrderService extends AppServiceBase {
channel_nickname
:
pobj
.
userInfo
.
channel_nickname
};
delete
result
.
data
[
"orderStatus"
];
this
.
utilsPushSve
.
pushInfo
(
result
.
data
,
opType
,
1
);
this
.
utilsPushSve
.
push
Order
Info
(
result
.
data
,
opType
,
1
);
}
}
}
...
...
center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js
View file @
6fd0109a
...
...
@@ -79,16 +79,13 @@ class UtilsOrderService extends AppServiceBase {
return
verifyResult
;
}
pobj
.
actionType
=
"getProductInterface"
;
pobj
.
actionBody
.
product
PriceId
=
pobj
.
actionBody
.
product_info
.
price_item
.
id
;
pobj
.
actionBody
.
product
_id
=
pobj
.
actionBody
.
product_info
.
id
;
var
productItemInterfaceResult
=
await
this
.
restPostUrl
(
pobj
,
url
);
// if (productItemInterfaceResult.status != 0) {
// return productItemInterfaceResult;
// }
pobj
.
actionBody
.
product_info
.
interface_info
=
productItemInterfaceResult
.
data
;
pobj
.
actionType
=
"addOrder"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
console
.
log
(
pobj
);
//
console.log(pobj);
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
result
.
totalSum
=
actionBody
.
totalSum
;
return
result
;
...
...
@@ -444,8 +441,8 @@ class UtilsOrderService extends AppServiceBase {
channel_username
:
opResult
.
data
.
order_info
.
channelUserId
,
channel_nickname
:
opResult
.
data
.
order_info
.
channelUserId
};
// this.utilsPushSve.push
Info(opResult.data, "push
Business",0);
this
.
utilsPushSve
.
pushInfo
(
opResult
.
data
,
"pushOrder"
,
0
);
// this.utilsPushSve.push
OrderInfo(opResult.data, "pushOrder
Business",0);
this
.
utilsPushSve
.
push
Order
Info
(
opResult
.
data
,
"pushOrder"
,
0
);
}
opResult
.
data
=
null
;
return
opResult
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsPushSve.js
View file @
6fd0109a
...
...
@@ -7,7 +7,7 @@ class UtilsPushService extends AppServiceBase {
super
();
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
};
async
pushInfo
(
actionBody
,
opType
,
isDelProductInfo
)
{
async
push
Order
Info
(
actionBody
,
opType
,
isDelProductInfo
)
{
var
interface_list
=
actionBody
.
product_info
.
interface_info
;
if
(
!
interface_list
)
{
return
""
;
...
...
center-channel/app/config/routes/api.js
View file @
6fd0109a
...
...
@@ -183,6 +183,11 @@ module.exports = function (app) {
res
.
end
(
JSON
.
stringify
(
result
));
return
;
}
if
([
"getAppTokenByHosts"
,
"getAppTokenByAppKey"
].
indexOf
(
req
.
body
.
actionType
)
>=
0
)
{
req
.
body
.
actionBody
.
appHosts
=
req
.
host
;
next
();
return
;
}
if
(
!
req
.
body
.
actionType
)
{
result
.
msg
=
"actionType can not be empty"
;
res
.
end
(
JSON
.
stringify
(
result
));
...
...
center-channel/峰擎文档
View file @
6fd0109a
1.获取请
求token
1.获取请
求token
1.获取请求token
[/
web
/auth/accessAuth/getAppTokenByAppKey]
[/
api
/auth/accessAuth/getAppTokenByAppKey]
请求方式:POST
参数格式 JSON
HTTP请求方式 POST
...
...
@@ -20,35 +20,8 @@ HTTP请求方式 POST
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
2.渠道通过账户进行登录,有则返回用户信息,没有则创建用户
地址:[/web/auth/accessAuth/springBoard]
请求方式:POST
请求头中需要有token(token值从接口1中获取)
{
"actionType": "getNeedUserPinByChannelUserId",
"actionBody": {
"needNo":"N2020021413152wiWI2e",// Y 需求号
"channelUserId":"15010929366",// Y 渠道用户ID
"channelUserName":"",// N 渠道用户名
"mobile":"15010929366", // N 渠道用户手机号
"nickName":"", // N 用户昵称
"orgName":"" // N 公司名称
}
}
返回结果
{
"status": 0,//0成功,否则失败
"msg": "success",
"data": {
"userpin":"c54abe7249a2a1195d236b333f79",
"channelTypeCode":"",//阿里公司注册编码:普通公司注册:esp.companyreg、云上公司注册:esp.companyreg_cloud
"typeCode":"gszc"//gszc公司注册,ysgszc云上公司注册
},
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
3.渠道通过账户进行登录,有则返回用户信息,没有则创建用户
地址:[/web/auth/accessAuth/springBoard]
3.渠道通过账户进行登录,有则返回用户信息,没有则创建用户------>供后端调用
地址:[/api/opreceive/accessAuth/springBoard]
请求方式:POST
请求头中需要有token(token值从接口1中获取)
{
...
...
@@ -83,7 +56,6 @@ HTTP请求方式 POST
orgName//公司名称
token//token值
4.推送公司表单材料
地址:[/api/opreceive/ic/springBoard]
请求方式:POST
...
...
@@ -142,4 +114,33 @@ HTTP请求方式 POST
"msg": "success",
"data": null,
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
2.渠道通过账户进行登录,有则返回用户信息,没有则创建用户---->供前端调用
地址:[/web/auth/accessAuth/springBoard]
请求方式:POST
请求头中需要有token(token值从接口1中获取)
{
"actionType": "getNeedUserPinByChannelUserId",
"actionBody": {
"needNo":"N2020021413152wiWI2e",// Y 需求号
"channelUserId":"15010929366",// Y 渠道用户ID
"channelUserName":"",// N 渠道用户名
"mobile":"15010929366", // N 渠道用户手机号
"nickName":"", // N 用户昵称
"orgName":"" // N 公司名称
}
}
返回结果
{
"status": 0,//0成功,否则失败
"msg": "success",
"data": {
"userpin":"c54abe7249a2a1195d236b333f79",
"channelTypeCode":"",//阿里公司注册编码:普通公司注册:esp.companyreg、云上公司注册:esp.companyreg_cloud
"typeCode":"gszc"//gszc公司注册,ysgszc云上公司注册
},
"requestId": "2016c54abe7249a2a1195d236b333f79"
}
\ No newline at end of file
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