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
749506cc
Commit
749506cc
authored
Sep 26, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lin add /ali/esp/intention/close /ali/esp/intention/submit
parent
58c645f6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
271 additions
and
0 deletions
+271
-0
igirl-channel-gateway/app/base/api/impl/action/intentionapi.js
+6
-0
igirl-channel-gateway/app/base/service/impl/common/gatewaypushlogSve.js
+52
-0
igirl-channel-gateway/app/base/service/impl/utilsSve/utilsNeedSve.js
+155
-0
igirl-channel-gateway/app/config/routes/api.js
+58
-0
No files found.
igirl-channel-gateway/app/base/api/impl/action/intentionapi.js
View file @
749506cc
...
...
@@ -48,6 +48,12 @@ class TradetransferAPI extends APIBase {
case
"queryOrderState"
:
// 通知状态变更
opResult
=
await
this
.
utilsNeedSve
.
queryOrderState
(
pobj
);
break
;
case
"submitNeedAliEsp"
:
// 2020 0925 lin 新增 阿里文网文 服务商侧提供接口2.1 提交用户需求给服务商
opResult
=
await
this
.
utilsNeedSve
.
submitNeedAliEsp
(
pobj
);
break
;
case
"needCloseAliEsp"
:
// 2020 0926 lin 新增 阿里文网文 服务商侧提供接口2.2 关闭需求通知服务商
opResult
=
await
this
.
utilsNeedSve
.
needCloseAliEsp
(
pobj
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
igirl-channel-gateway/app/base/service/impl/common/gatewaypushlogSve.js
View file @
749506cc
...
...
@@ -349,6 +349,57 @@ class GatewaypushlogService extends ServiceBase {
return
self
.
getResultSuccess
(
param
.
requestId
);
}
// 2020 0925 lin 新增 阿里文网文 服务商侧提供接口2.1 提交用户需求给服务商
async
submitNeedAliEsp
(
pobj
)
{
var
self
=
this
;
if
(
!
pobj
.
intentionBizId
)
{
return
self
.
getResultFail
(
"intentionBizId is empty"
);
}
if
(
!
pobj
.
mobile
)
{
return
self
.
getResultFail
(
"mobile is empty"
);
}
if
(
!
pobj
.
userId
)
{
return
self
.
getResultFail
(
"userId is empty"
);
}
if
(
!
pobj
.
type
)
{
return
self
.
getResultFail
(
"type is empty"
);
}
pobj
.
action_type
=
"submitNeedAliEsp"
;
var
param
=
{
requestId
:
self
.
getUUID
(),
requestUrl
:
"/ali/esp/intention/submit"
,
requestjson
:
JSON
.
stringify
(
pobj
),
//请求地址
pushUrl
:
"/action/intentionapi/springBoard"
,
//调用地址
pushActionType
:
"submitNeedAliEsp"
,
//调用参数
pushtimes
:
0
,
//推送次数
pushStatus
:
"wts"
,
//推送状态
}
await
self
.
create
(
param
);
return
self
.
getResultSuccess
(
param
.
requestId
);
}
// 2020 0926 lin 新增 阿里文网文 服务商侧提供接口2.2 关闭需求通知服务商
async
needCloseAliEsp
(
pobj
)
{
var
self
=
this
;
if
(
!
pobj
.
intentionBizId
)
{
return
self
.
getResultFail
(
"intentionBizId is empty"
);
}
if
(
!
pobj
.
note
)
{
return
self
.
getResultFail
(
"mobile is empty"
);
}
pobj
.
action_type
=
"needCloseAliEsp"
;
var
param
=
{
requestId
:
self
.
getUUID
(),
requestUrl
:
"/ali/esp/intention/submit"
,
requestjson
:
JSON
.
stringify
(
pobj
),
//请求地址
pushUrl
:
"/action/intentionapi/springBoard"
,
//调用地址
pushActionType
:
"needCloseAliEsp"
,
//调用参数
pushtimes
:
0
,
//推送次数
pushStatus
:
"wts"
,
//推送状态
}
await
self
.
create
(
param
);
return
self
.
getResultSuccess
(
param
.
requestId
);
}
}
module
.
exports
=
GatewaypushlogService
;
\ No newline at end of file
igirl-channel-gateway/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
749506cc
...
...
@@ -345,5 +345,160 @@ class UtilsNeedSve extends AppServiceBase {
};
}
// 2020 0925 lin 新增 阿里文网文 服务商侧提供接口2.1 提交用户需求给服务商
async
submitNeedAliEsp
(
pobj
)
{
var
tokenInfo
=
await
this
.
getCenterToken
();
if
(
tokenInfo
.
status
!=
0
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
var
token
=
tokenInfo
.
data
.
token
;
var
userpin
=
""
;
if
(
pobj
.
mobile
)
{
//获取用户userpin
var
userparam
=
{
actionType
:
"getLoginByUserName"
,
actionBody
:
{
"channelUserId"
:
pobj
.
userId
,
"mobile"
:
pobj
.
mobile
,
"userName"
:
pobj
.
userName
?
pobj
.
userName
:
pobj
.
mobile
}
};
var
self
=
this
;
var
url
=
settings
.
centerChannelUrl
()
+
"/api/auth/accessAuth/springBoard"
;
var
userpinResultTmp
=
await
this
.
execlient
.
execPostTK
(
userparam
,
url
,
tokenInfo
.
data
.
token
);
if
(
userpinResultTmp
.
status
!=
0
&&
userpinResultTmp
.
status
!=
2060
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
userpin
=
userpinResultTmp
.
data
.
userpin
;
if
(
!
userpin
)
{
// return { "message": "网络错误", "data": {}, "code": -102 }
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
}
//带userpin请求
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/edi/springBoard"
;
var
sobj
=
{
"actionType"
:
pobj
.
action_type
,
"actionBody"
:
pobj
}
var
rtn
=
rtn
=
await
this
.
execlient
.
execDataPostByTokenUserPin
(
sobj
,
url
,
token
,
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"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
else
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
false
,
"errorMsg"
:
result
.
msg
,
"errorCode"
:
"ok"
};
}
}
// 2020 0926 lin 新增 阿里文网文 服务商侧提供接口2.2 关闭需求通知服务商
async
needCloseAliEsp
(
pobj
)
{
var
tokenInfo
=
await
this
.
getCenterToken
();
if
(
tokenInfo
.
status
!=
0
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
var
token
=
tokenInfo
.
data
.
token
;
var
userpin
=
""
;
if
(
pobj
.
mobile
)
{
//获取用户userpin
var
userparam
=
{
actionType
:
"getLoginByUserName"
,
actionBody
:
{
"channelUserId"
:
pobj
.
userId
,
"mobile"
:
pobj
.
mobile
,
"userName"
:
pobj
.
userName
?
pobj
.
userName
:
pobj
.
mobile
}
};
var
self
=
this
;
var
url
=
settings
.
centerChannelUrl
()
+
"/api/auth/accessAuth/springBoard"
;
var
userpinResultTmp
=
await
this
.
execlient
.
execPostTK
(
userparam
,
url
,
tokenInfo
.
data
.
token
);
if
(
userpinResultTmp
.
status
!=
0
&&
userpinResultTmp
.
status
!=
2060
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
userpin
=
userpinResultTmp
.
data
.
userpin
;
if
(
!
userpin
)
{
// return { "message": "网络错误", "data": {}, "code": -102 }
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
false
,
"errorMsg"
:
"网络错误"
,
"errorCode"
:
"ok"
};
}
}
//带userpin请求
url
=
settings
.
centerChannelUrl
()
+
"/api/opreceive/edi/springBoard"
;
var
sobj
=
{
"actionType"
:
pobj
.
action_type
,
"actionBody"
:
pobj
}
var
rtn
=
rtn
=
await
this
.
execlient
.
execDataPostByTokenUserPin
(
sobj
,
url
,
token
,
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"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
else
{
return
{
"requestId"
:
result
.
requestId
,
"success"
:
false
,
"errorMsg"
:
result
.
msg
,
"errorCode"
:
"ok"
};
}
}
}
module
.
exports
=
UtilsNeedSve
;
igirl-channel-gateway/app/config/routes/api.js
View file @
749506cc
...
...
@@ -220,6 +220,64 @@ module.exports = function (app) {
}
});
// 2020 0925 lin 新增 阿里文网文 服务商侧提供接口2.1 提交用户需求给服务商
app
.
use
(
'/ali/esp/intention/submit'
,
async
function
(
req
,
res
)
{
try
{
console
.
log
(
req
.
headers
[
'content-type'
])
if
(
req
.
headers
[
'content-type'
].
indexOf
(
'application/octet-stream'
)
>
-
1
)
{
await
logCtl
.
applicationOctetStream2Json
(
req
);
}
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
gatewaypushlogSve
.
submitNeedAliEsp
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单结果:,method="
+
req
.
body
.
trxcode
,
op
:
"/ali/esp/intention/submit"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调处理订单结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
});
res
.
end
(
JSON
.
stringify
(
result
));
return
JSON
.
stringify
(
result
);
}
catch
(
error
)
{
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果异常:,method="
+
req
.
body
.
trxcode
,
op
:
"/ali/esp/intention/submit"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
});
return
JSON
.
stringify
(
result
);
}
});
// 2020 0926 lin 新增 阿里文网文 服务商侧提供接口2.2 关闭需求通知服务商
app
.
use
(
'/ali/esp/intention/close'
,
async
function
(
req
,
res
)
{
try
{
console
.
log
(
req
.
headers
[
'content-type'
])
if
(
req
.
headers
[
'content-type'
].
indexOf
(
'application/octet-stream'
)
>
-
1
)
{
await
logCtl
.
applicationOctetStream2Json
(
req
);
}
var
client_ip
=
system
.
get_client_ip
(
req
);
var
result
=
await
gatewaypushlogSve
.
needCloseAliEsp
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单结果:,method="
+
req
.
body
.
trxcode
,
op
:
"/ali/esp/intention/close"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"回调处理订单结果:"
+
JSON
.
stringify
(
result
),
clientIp
:
client_ip
||
""
});
res
.
end
(
JSON
.
stringify
(
result
));
return
JSON
.
stringify
(
result
);
}
catch
(
error
)
{
logCtl
.
error
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"记录回调处理结果异常:,method="
+
req
.
body
.
trxcode
,
op
:
"/ali/esp/intention/close"
,
content
:
"回调参数:"
+
JSON
.
stringify
(
req
.
body
)
+
"error:"
+
error
.
stack
,
clientIp
:
client_ip
||
""
});
return
JSON
.
stringify
(
result
);
}
});
app
.
get
(
'/api/:gname/:qname/:method'
,
function
(
req
,
res
)
{
var
classPath
=
req
.
params
[
"qname"
];
var
methodName
=
req
.
params
[
"method"
];
...
...
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