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
7541072e
Commit
7541072e
authored
Oct 22, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
baiduIcp
parent
287e5c4f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
346 additions
and
0 deletions
+346
-0
igirl-channel-gateway/app/base/api/impl/action/intentionapi.js
+11
-0
igirl-channel-gateway/app/base/service/impl/utilsSve/utilsNeedSve.js
+335
-0
No files found.
igirl-channel-gateway/app/base/api/impl/action/intentionapi.js
View file @
7541072e
...
...
@@ -33,6 +33,17 @@ class TradetransferAPI extends APIBase {
case
"submitNeed"
:
//提交需求
opResult
=
await
this
.
utilsNeedSve
.
reqcenterchannel
(
pobj
);
break
;
// -------------提交Icp需求--------庄冰2020.10.21-------百度Icp接入使用--------start------------------
case
"submitIcpNeed"
:
//提交Icp需求
opResult
=
await
this
.
utilsNeedSve
.
reqcenterchannel2
(
pobj
);
break
;
case
"icpFeedbackSubmitNew"
:
//接收方案反馈信息
opResult
=
await
this
.
utilsNeedSve
.
reqcenterchannel2
(
pobj
);
break
;
case
"icpOrderStatus"
:
//接收方案反馈信息
opResult
=
await
this
.
utilsNeedSve
.
icpOrderStatus
(
pobj
);
break
;
// -------------提交Icp需求--------庄冰2020.10.21-------百度Icp接入使用--------end------------------
case
"needClose"
:
//关闭需求
opResult
=
await
this
.
utilsNeedSve
.
reqcenterchannel
(
pobj
);
break
;
...
...
igirl-channel-gateway/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
7541072e
...
...
@@ -138,7 +138,342 @@ class UtilsNeedSve extends AppServiceBase {
}
}
// -------------提交Icp需求--------庄冰2020.10.21-------百度Icp接入使用--------start------------------
async
getCenterTokenByApp
(
appinfo
)
{
var
self
=
this
;
var
reqTokenUrl
=
this
.
centerChannelUrl
+
"/api/opreceive/accessAuth/getAppTokenByAppKey"
;
var
reqParam
=
appinfo
;
if
(
!
reqParam
||
!
reqParam
.
uapp_key
||
!
reqParam
.
uapp_secret
)
{
return
system
.
getResult
(
null
,
"reqType类型有误,请求失败"
);
}
var
param
=
{
"actionType"
:
"getAppTokenByAppKey"
,
"actionBody"
:
{
"appkey"
:
reqParam
.
uapp_key
,
"secret"
:
reqParam
.
uapp_secret
}
};
var
rtn
=
await
this
.
execlient
.
execPost
(
param
,
reqTokenUrl
);
if
(
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"获取token失败"
);
}
var
tokenResult
=
JSON
.
parse
(
rtn
.
stdout
);
return
tokenResult
;
}
async
reqcenterchannel2
(
pobj
)
{
var
sobj
=
{
"actionType"
:
pobj
.
action_type
,
"actionBody"
:
pobj
}
if
(
!
pobj
.
appInfo
||
!
pobj
.
appInfo
.
uapp_key
||
!
pobj
.
appInfo
.
uapp_secret
){
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"无效应用"
,
"errorCode"
:
"ok"
};
}
var
self
=
this
;
var
tokenInfo
=
await
this
.
getCenterTokenByApp
(
pobj
.
appInfo
);
if
(
tokenInfo
.
status
!=
0
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"getTokenInfo fail"
,
"errorCode"
:
"ok"
};
}
var
userpin
=
""
;
if
(
pobj
.
phone
&&!
pobj
.
mobile
){
pobj
.
mobile
=
pobj
.
phone
;
}
if
(
pobj
.
mobile
)
{
//获取用户userpin
var
userparam
=
{
actionType
:
"getLoginByUserName"
,
actionBody
:
{
"channelUserId"
:
pobj
.
mobile
,
"mobile"
:
pobj
.
mobile
,
"userName"
:
pobj
.
mobile
}
};
// pobj.actionBody.channelUserId = pobj.mobile;//渠道用户id,没有则用手机号
// pobj.actionBody.mobile = pobj.mobile;//用户手机号
var
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/accessAuth/springBoard"
;
var
userpinResultTmp
=
await
this
.
execlient
.
execPostTK
(
userparam
,
url
,
tokenInfo
.
data
.
token
);
if
(
userpinResultTmp
.
status
!=
0
&&
userpinResultTmp
.
status
!=
2060
)
{
return
system
.
getResultFail
(
-
99
,
"获取userpin失败"
);
}
userpin
=
userpinResultTmp
.
data
.
userpin
;
if
(
!
userpin
)
{
return
system
.
getResultFail
(
-
88
,
"获取userpin失败!!"
);
}
}
//带userpin请求
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/need/springBoard"
;
var
token
=
tokenInfo
.
data
.
token
;
var
rtn
=
null
;
var
self
=
this
;
if
(
userpin
)
{
rtn
=
await
self
.
execlient
.
execDataPostByTokenUserPin
(
sobj
,
url
,
token
,
userpin
);
}
else
{
rtn
=
await
self
.
execlient
.
execPostTK
(
sobj
,
url
,
token
);
if
(
rtn
.
status
==
0
)
{
return
{
"requestId"
:
rtn
.
requestId
,
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
else
{
return
{
"requestId"
:
rtn
.
requestId
,
"success"
:
false
,
"errorMsg"
:
rtn
.
msg
,
"errorCode"
:
"ok"
};
}
}
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
.
status
==
0
)
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
else
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
false
,
"errorMsg"
:
result
.
msg
,
"errorCode"
:
"ok"
};
}
}
//百度icp 2.3 请求
async
icpOrderStatus
(
pobj
)
{
var
self
=
this
;
if
(
!
pobj
.
appInfo
||
!
pobj
.
appInfo
.
uapp_key
||
!
pobj
.
appInfo
.
uapp_secret
){
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"无效应用"
,
"errorCode"
:
"ok"
};
}
// 获取app token
// var tokenInfo = await this.getCenterToken();
var
tokenInfo
=
await
this
.
getCenterTokenByApp
(
pobj
.
appInfo
);
if
(
tokenInfo
.
status
!=
0
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
// 引用属性,channel依赖bizId order依赖intentionBizId
pobj
.
intentionBizId
=
pobj
.
bizId
// 获取userpin
var
userparam
=
{
actionType
:
"getLoginByUserName"
,
actionBody
:
{}
};
if
(
pobj
.
isDirectBuy
==
1
){
//直购
userparam
.
actionBody
.
channelUserId
=
pobj
.
phone
userparam
.
actionBody
.
mobile
=
pobj
.
phone
userparam
.
actionBody
.
userName
=
pobj
.
phone
pobj
.
publishMobile
=
pobj
.
phone
pobj
.
channelTypeCode
=
pobj
.
consultType
;
if
(
pobj
.
area
)
{
switch
(
pobj
.
area
)
{
case
"1"
:
pobj
.
area
=
"北京"
;
break
;
case
"2"
:
pobj
.
area
=
"上海"
;
break
;
case
"3"
:
pobj
.
area
=
"福建"
;
break
;
case
"4"
:
pobj
.
area
=
"广西"
;
break
;
case
"5"
:
pobj
.
area
=
"广东"
;
break
;
case
"6"
:
pobj
.
area
=
"安徽"
;
break
;
case
"7"
:
pobj
.
area
=
"河南"
;
break
;
case
"8"
:
pobj
.
area
=
"湖北"
;
break
;
case
"9"
:
pobj
.
area
=
"浙江"
;
break
;
case
"10"
:
pobj
.
area
=
"江苏"
;
break
;
case
"11"
:
pobj
.
area
=
"山东"
;
break
;
case
"12"
:
pobj
.
area
=
"陕西"
;
break
;
case
"13"
:
pobj
.
area
=
"宁夏"
;
break
;
case
"14"
:
pobj
.
area
=
"甘肃"
;
break
;
case
"15"
:
pobj
.
area
=
"新疆"
;
break
;
case
"16"
:
pobj
.
area
=
"青海"
;
break
;
case
"17"
:
pobj
.
area
=
"天津"
;
break
;
case
"18"
:
pobj
.
area
=
"重庆"
;
break
;
case
"19"
:
pobj
.
area
=
"河北"
;
break
;
case
"20"
:
pobj
.
area
=
"山西"
;
break
;
case
"21"
:
pobj
.
area
=
"辽宁"
;
break
;
case
"22"
:
pobj
.
area
=
"吉林"
;
break
;
case
"23"
:
pobj
.
area
=
"黑龙江"
;
break
;
case
"24"
:
pobj
.
area
=
"江西"
;
break
;
case
"25"
:
pobj
.
area
=
"湖南"
;
break
;
case
"26"
:
pobj
.
area
=
"四川"
;
break
;
case
"27"
:
pobj
.
area
=
"贵州"
;
break
;
case
"28"
:
pobj
.
area
=
"云南"
;
break
;
case
"29"
:
pobj
.
area
=
"内蒙古"
;
break
;
case
"30"
:
pobj
.
area
=
"西藏"
;
break
;
case
"31"
:
pobj
.
area
=
"含外资"
;
break
;
case
"32"
:
pobj
.
area
=
"全外资"
;
break
;
case
"33"
:
pobj
.
area
=
"香港"
;
break
;
case
"34"
:
pobj
.
area
=
"海南"
;
break
;
default
:
pobj
.
area
=
""
;
break
;
}
}
pobj
.
province
=
pobj
.
area
+
`(
${
pobj
.
actionType
}
)`
}
else
{
var
sobj
=
{
"actionType"
:
"getItemByChannelSolutionNo"
,
"actionBody"
:
pobj
}
// getItemByChannelSolutionNo
var
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/need/springBoard"
;
var
token
=
tokenInfo
.
data
.
token
;
var
result
=
await
this
.
execlient
.
execPostTK
(
sobj
,
url
,
token
);
if
(
result
.
status
!=
0
)
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
false
,
"errorMsg"
:
result
.
msg
,
"errorCode"
:
"ok"
};
}
userparam
.
actionBody
.
channelUserId
=
result
.
data
.
channelUserId
userparam
.
actionBody
.
mobile
=
result
.
data
.
publishMobile
userparam
.
actionBody
.
userName
=
result
.
data
.
publishMobile
pobj
.
publishMobile
=
result
.
data
.
publishMobile
;
pobj
.
channelNeedNo
=
result
.
data
.
channelNeedNo
;
pobj
.
needNo
=
result
.
data
.
needNo
;
pobj
.
channelTypeCode
=
result
.
data
.
channelTypeCode
;
pobj
.
province
=
result
.
data
.
solutionProvince
;
//北京(新购)?
}
var
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/accessAuth/springBoard"
;
var
userpinResultTmp
=
await
this
.
execlient
.
execPostTK
(
userparam
,
url
,
tokenInfo
.
data
.
token
);
if
(
userpinResultTmp
.
status
!=
0
)
{
return
{
"requestId"
:
userpinResultTmp
.
requestId
,
"success"
:
false
,
"errorMsg"
:
userpinResultTmp
.
msg
,
"errorCode"
:
"ok"
};
}
// icpNotify
var
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/need/springBoard"
;
var
sobj
=
{
"actionType"
:
"icpNotifyNew"
,
"actionBody"
:
pobj
}
var
rtn
=
await
this
.
execlient
.
execDataPostByTokenUserPin
(
sobj
,
url
,
token
,
userpinResultTmp
.
data
.
userpin
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
.
status
!=
0
)
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
false
,
"errorMsg"
:
result
.
msg
,
"errorCode"
:
"ok"
};
}
return
{
"requestId"
:
result
.
requestId
,
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
// -------------提交Icp需求--------庄冰2020.10.21-------百度Icp接入使用--------end------------------
async
paySuccess
(
pobj
)
{
var
sobj
=
{
"actionType"
:
pobj
.
action_type
,
...
...
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