Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sb_h5
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data_server
sb_h5
Commits
2b0bc7a1
Commit
2b0bc7a1
authored
Aug 27, 2019
by
姜登
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sb
parent
a682ce4b
Pipeline
#12964
passed with stage
in 16 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
19 deletions
+22
-19
partner.js
app/service/partner.js
+22
-19
No files found.
app/service/partner.js
View file @
2b0bc7a1
...
...
@@ -98,27 +98,30 @@ class PartnerService extends Service {
// orderId/userId/status
async
notify
(
order
)
{
const
{
ctx
,
service
}
=
this
;
const
{
orderId
,
notifyUrl
,
userId
,
notice
}
=
order
;
const
dbRes
=
await
service
.
order
.
getOneByOrderId
({
orderId
,
notice
:
1
});
if
(
!
dbRes
&&
notifyUrl
&&
notice
!==
'1'
)
{
const
ret
=
await
ctx
.
curl
(
notifyUrl
,
{
charset
:
'utf-8'
,
timeout
:
[
30000
,
30000
],
contentType
:
'json'
,
method
:
'POST'
,
data
:
{
order_id
:
orderId
,
user_id
:
userId
,
status
:
'success'
,
},
}
);
ctx
.
logger
.
info
(
`【Partner】 notice
${
notifyUrl
}
`
,
'orderId:'
,
orderId
,
'result:'
,
ret
.
status
,
JSON
.
stringify
(
ret
.
data
));
if
(
ret
.
status
===
200
)
{
await
order
.
update
({
notice
:
'1'
});
try
{
const
{
orderId
,
notifyUrl
,
userId
,
notice
}
=
order
;
const
dbRes
=
await
service
.
order
.
getOneByOrderId
({
orderId
,
notice
:
1
});
if
(
!
dbRes
&&
notifyUrl
&&
notice
!==
'1'
)
{
const
ret
=
await
ctx
.
curl
(
notifyUrl
,
{
charset
:
'utf-8'
,
timeout
:
[
30000
,
30000
],
contentType
:
'json'
,
method
:
'POST'
,
data
:
{
order_id
:
orderId
,
user_id
:
userId
,
status
:
'success'
,
},
}
);
ctx
.
logger
.
info
(
`【Partner】 notice
${
notifyUrl
}
`
,
'orderId:'
,
orderId
,
'result:'
,
ret
.
status
,
JSON
.
stringify
(
ret
.
data
));
if
(
ret
.
status
===
200
)
{
await
order
.
update
({
notice
:
'1'
});
}
}
}
catch
(
err
)
{
ctx
.
logger
.
warn
(
'【Partner】 notice error'
,
JSON
.
stringify
(
order
),
JSON
.
stringify
(
err
));
}
return
;
}
}
...
...
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