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
921d8a3f
Commit
921d8a3f
authored
Sep 24, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
queryTradeProduceList add. reqbyLTget add
parent
bf9f1979
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
8 deletions
+137
-8
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
+4
-2
center-channel/app/base/service/impl/utilsSve/utilsTmOrderCallSve.js
+80
-6
center-channel/app/base/utils/aliyunClient.js
+53
-0
No files found.
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
921d8a3f
...
...
@@ -643,7 +643,8 @@ class UtilsNeedService extends AppServiceBase {
Token
:
"gsb"
,
}
// 4.1 提交阿里需求
var
aliResult
=
await
this
.
aliclient
.
reqbyget
({
action
:
"SubmitIcpIntention"
,
reqbody
:
obj
,
apiVersion
:
"2019-05-08"
});
// 2020 0924 lin 修改 reqbyget 为 reqbyLTget
var
aliResult
=
await
this
.
aliclient
.
reqbyLTget
({
action
:
"SubmitIcpIntention"
,
reqbody
:
obj
,
apiVersion
:
"2019-05-08"
});
console
.
log
(
"needBatchUpload-aliResult"
,
aliResult
)
// 整合前端需要的数据1
BizIds
+=
aliResult
.
data
.
BizId
+
","
;
...
...
@@ -710,7 +711,8 @@ class UtilsNeedService extends AppServiceBase {
// 第五步 用户需求确认
// 首先切割掉BizId最后一位 是,
BizIds
=
BizIds
.
substr
(
0
,
BizIds
.
length
-
1
);
var
aliConfirmResult
=
await
this
.
aliclient
.
reqbyget
({
action
:
"ConfirmIcpIntention"
,
reqbody
:
{
BizIds
:
BizIds
},
apiVersion
:
"2019-05-08"
});
// 2020 0924 lin 修改 reqbyget 为 reqbyLTget
var
aliConfirmResult
=
await
this
.
aliclient
.
reqbyLTget
({
action
:
"ConfirmIcpIntention"
,
reqbody
:
{
BizIds
:
BizIds
},
apiVersion
:
"2019-05-08"
});
console
.
log
(
"needBatchUpload-aliConfirmResult"
,
aliConfirmResult
)
// 获取链接失败
if
(
aliConfirmResult
.
status
!=
0
)
{
...
...
center-channel/app/base/service/impl/utilsSve/utilsTmOrderCallSve.js
View file @
921d8a3f
...
...
@@ -16,7 +16,7 @@ class UtilsTmOrderCallService extends AppServiceBase {
// 1查询渠道/商品为icp/edi的订单已经支付部分款的订单。
// 这里写死 itemCode 和 订单状态
pobj
.
actionBody
.
itemCode
=
"tmjy"
pobj
.
actionBody
.
orderStatus
=
64
//
pobj.actionBody.orderStatus = 64
pobj
.
actionType
=
"queryVOrderByOrderStatusAndItemCode"
;
pobj
.
appInfo
=
{
uapp_id
:
this
.
aliUappId
...
...
@@ -27,6 +27,14 @@ class UtilsTmOrderCallService extends AppServiceBase {
}
var
url
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
orderInfoRes
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
orderInfoRes
.
status
!=
0
)
{
return
{
status
:
-
1
,
msg
:
"fail request qifu api filed"
,
data
:
null
}
}
var
orderInfoList
=
orderInfoRes
.
data
// 2查询渠道/商品为icp/edi的订单已经支付尾款的订单。
// 3
var
obj
=
{
...
...
@@ -42,13 +50,79 @@ class UtilsTmOrderCallService extends AppServiceBase {
type
:
'TM'
}
let
aliOrderList
=
await
this
.
aliclient
.
reqbyget
(
object
);
if
(
orderInfoRes
)
{
for
(
var
i
=
0
;
i
<
orderInfoRes
.
length
;
i
++
)
{
var
orderInfo
=
orderInfo
[
i
];
if
(
aliOrderList
.
status
!=
0
)
{
return
{
status
:
-
1
,
msg
:
"fail request ali api filed"
,
data
:
null
}
}
console
.
log
(
"aliOrderList"
,
aliOrderList
)
return
aliOrderList
;
var
aliOrderInfo
=
aliOrderList
.
data
.
Data
.
TradeProduces
// 返回值data
var
failList
=
[];
var
successList
=
[]
if
(
orderInfoList
&&
aliOrderInfo
)
{
for
(
var
i
=
0
;
i
<
orderInfoList
.
length
;
i
++
)
{
pobj
.
actionBody
.
orderId
=
orderInfoList
[
i
].
id
;
pobj
.
actionType
=
"updateOrderStatusById"
;
var
orderInfo
=
orderInfoList
[
i
];
var
aliOrderIndex
=
aliOrderInfo
.
findIndex
(
f
=>
f
.
BizId
==
orderInfo
.
channelServiceNo
)
console
.
log
(
"------------------------------------"
)
console
.
log
(
aliOrderIndex
)
console
.
log
(
"------------------------------------"
)
if
(
aliOrderIndex
>
-
1
&&
aliOrderInfo
[
aliOrderIndex
].
BuyerStatus
==
10
)
{
// 合作方已提交转让文件 为企服orderStatus 4 服务中
pobj
.
actionBody
.
orderStatus
=
4
;
var
url
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
orderInfoRes
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
orderInfoRes
.
status
!=
0
)
{
failList
.
push
(
orderInfo
.
channelServiceNo
);
}
successList
.
push
({
channelServiceNo
:
orderInfo
.
channelServiceNo
,
updateStatus
:
4
})
}
if
(
aliOrderIndex
>
-
1
&&
aliOrderInfo
[
aliOrderIndex
].
BuyerStatus
==
11
)
{
// 已经支付尾款 为企服orderStatus 2 已付款
pobj
.
actionBody
.
orderStatus
=
2
;
var
url
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
orderInfoRes
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
orderInfoRes
.
status
!=
0
)
{
failList
.
push
({
channelServiceNo
:
orderInfo
.
channelServiceNo
,
updateStatus
:
2
});
}
successList
.
push
({
channelServiceNo
:
orderInfo
.
channelServiceNo
,
updateStatus
:
2
})
}
if
(
aliOrderIndex
>
-
1
&&
(
aliOrderInfo
[
aliOrderIndex
].
BuyerStatus
==
40
||
aliOrderInfo
[
aliOrderIndex
].
BuyerStatus
==
41
))
{
// 交易成功/交易失败 为企服orderStatus 8 已完成
pobj
.
actionBody
.
orderStatus
=
8
;
var
url
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
orderInfoRes
=
await
this
.
restPostUrl
(
pobj
,
url
);
if
(
orderInfoRes
.
status
!=
0
)
{
failList
.
push
({
channelServiceNo
:
orderInfo
.
channelServiceNo
,
updateStatus
:
8
});
}
successList
.
push
({
channelServiceNo
:
orderInfo
.
channelServiceNo
,
updateStatus
:
8
})
}
}
}
return
{
status
:
0
,
msg
:
"success"
,
data
:
{
failList
,
successList
}
}
}
async
createjsonfile
()
{
...
...
center-channel/app/base/utils/aliyunClient.js
View file @
921d8a3f
...
...
@@ -23,6 +23,17 @@ class aliyunClient {
}
);
}
// 2020 0924 lin 新增 调用阿里网关账号
getAliLTClient
()
{
return
new
RPCClient
({
accessKeyId
:
"LTAI4GFpXoAvKbJSCmJXFfR9"
,
//对应的aliuid 是 30039057
accessKeySecret
:
"TBYUHMEkvDtwxSttf60GcVuh6ieADQ"
,
endpoint
:
"https://companyreg.aliyuncs.com"
,
apiVersion
:
"2020-03-06"
});
}
async
post
(
aliReqUrl
,
key
,
secret
,
actionBody
)
{
const
client
=
new
Client
(
key
,
secret
);
var
param
=
{
...
...
@@ -82,8 +93,50 @@ class aliyunClient {
});
return
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
e
.
stack
);
}
}
// 2020 0924 lin 新增
async
reqbyLTget
(
obj
,
cbk
)
{
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
var
self
=
this
;
try
{
var
reqAliclient
=
self
.
getAliLTClient
();
if
(
obj
.
apiVersion
)
{
reqAliclient
.
apiVersion
=
obj
.
apiVersion
;
}
var
res
=
await
reqAliclient
.
request
(
action
,
reqbody
,
{
timeout
:
10000
,
// default 3000 ms 2020 0916 lin修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction
:
true
,
// default true, format the action to Action
formatParams
:
true
,
// default true, format the parameter name to first letter upper case
method
:
'GET'
,
// set the http method, default is GET
headers
:
{},
// set the http request headers
});
this
.
pushlogSve
.
createDb
({
op
:
"old-reqbyget"
,
content
:
JSON
.
stringify
(
obj
),
//推送的参数信息
resultInfo
:
JSON
.
stringify
(
res
),
returnType
:
'1'
,
logLevel
:
'1'
,
opTitle
:
"old-reqbyget推送阿里信息返回成功"
});
return
system
.
getResultSuccess
(
res
);
}
catch
(
e
)
{
this
.
pushlogSve
.
createFailLogDb
({
appid
:
obj
.
appInfo
?
obj
.
appInfo
.
uapp_id
||
""
:
""
,
appkey
:
obj
.
appInfo
?
obj
.
appInfo
.
uapp_key
||
""
:
""
,
requestId
:
obj
.
requestId
||
""
,
content
:
JSON
.
stringify
(
obj
),
//推送的参数信息
resultInfo
:
"error:"
+
JSON
.
stringify
(
e
),
clientIp
:
obj
.
clientIp
||
""
,
failType
:
1
,
opTitle
:
"old-reqbyget推送阿里信息返回异常"
,
pushNumber
:
obj
.
pushNumber
||
1
});
return
system
.
getResultFail
(
-
200
,
"出现异常,error:"
+
e
.
stack
);
}
}
async
reqCustomByGet
(
obj
,
cbk
)
{
var
action
=
obj
.
action
;
var
reqbody
=
obj
.
reqbody
;
...
...
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