Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
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
方斌
51business
Commits
309287ad
Commit
309287ad
authored
Jun 05, 2020
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add notify log
parent
7a4e2434
Pipeline
#24554
passed with stage
in 1 minute 38 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
wechat.js
app/controller/course/v5/wechat.js
+4
-1
config.prod.js
config/config.prod.js
+1
-1
No files found.
app/controller/course/v5/wechat.js
View file @
309287ad
...
@@ -88,7 +88,6 @@ class WechatController extends Controller {
...
@@ -88,7 +88,6 @@ class WechatController extends Controller {
// 支付回调
// 支付回调
async
payNotify
()
{
async
payNotify
()
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
ctx
.
set
(
'Content-Type'
,
'text/xml'
);
// 组装xml数据
// 组装xml数据
let
xmlData
=
'<xml>'
;
let
xmlData
=
'<xml>'
;
xmlData
+=
'<return_code><![CDATA[SUCCESS]]></return_code>'
;
xmlData
+=
'<return_code><![CDATA[SUCCESS]]></return_code>'
;
...
@@ -96,11 +95,14 @@ class WechatController extends Controller {
...
@@ -96,11 +95,14 @@ class WechatController extends Controller {
xmlData
+=
'</xml>'
;
xmlData
+=
'</xml>'
;
ctx
.
body
=
xmlData
;
ctx
.
body
=
xmlData
;
ctx
.
logger
.
info
(
'notify_headers: '
+
JSON
.
stringify
(
ctx
.
request
.
header
));
let
data
=
''
;
let
data
=
''
;
ctx
.
req
.
setEncoding
(
'utf8'
);
ctx
.
req
.
setEncoding
(
'utf8'
);
ctx
.
req
.
on
(
'data'
,
function
(
chunk
)
{
ctx
.
req
.
on
(
'data'
,
function
(
chunk
)
{
data
+=
chunk
;
data
+=
chunk
;
});
});
const
getxml
=
await
new
Promise
(
function
(
resolve
)
{
const
getxml
=
await
new
Promise
(
function
(
resolve
)
{
ctx
.
req
.
on
(
'end'
,
function
()
{
ctx
.
req
.
on
(
'end'
,
function
()
{
resolve
(
data
);
resolve
(
data
);
...
@@ -124,6 +126,7 @@ class WechatController extends Controller {
...
@@ -124,6 +126,7 @@ class WechatController extends Controller {
}
}
}
}
ctx
.
set
(
'Content-Type'
,
'text/xml'
);
return
ctx
.
body
;
return
ctx
.
body
;
}
}
}
}
...
...
config/config.prod.js
View file @
309287ad
...
@@ -145,7 +145,7 @@ module.exports = appInfo => {
...
@@ -145,7 +145,7 @@ module.exports = appInfo => {
},
},
enableTypes
:
[
'json'
,
'form'
,
'text'
],
enableTypes
:
[
'json'
,
'form'
,
'text'
],
extendTypes
:
{
extendTypes
:
{
text
:
[
'text/xml'
,
'application/xml'
,
'
application/x-www-form-urlencoded
'
],
text
:
[
'text/xml'
,
'application/xml'
,
'
text/html
'
],
},
},
};
};
...
...
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