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
f677b718
Commit
f677b718
authored
Mar 21, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
23f848bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
18 deletions
+39
-18
igirl-channel-gateway/app/base/service/impl/common/oplogSve.js
+22
-0
igirl-channel-gateway/app/config/routes/api.js
+17
-18
No files found.
igirl-channel-gateway/app/base/service/impl/common/oplogSve.js
View file @
f677b718
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
getRawBody
=
require
(
'raw-body'
);
class
OplogService
extends
ServiceBase
{
constructor
()
{
super
(
"common"
,
ServiceBase
.
getDaoName
(
OplogService
));
...
...
@@ -76,5 +77,26 @@ class OplogService extends ServiceBase {
this
.
dao
.
create
(
qobj
);
}
}
async
applicationOctetStream2Json
(
req
)
{
var
promiseT
=
await
new
Promise
((
resv
,
rej
)
=>
{
getRawBody
(
req
,
{
length
:
req
.
headers
[
'content-length'
],
encoding
:
req
.
charset
},
function
(
err
,
string
)
{
if
(
err
)
{
rej
(
err
);
}
else
{
resv
(
string
);
}
});
});
if
(
promiseT
.
length
>
0
)
{
var
step1
=
JSON
.
stringify
(
promiseT
);
var
step2
=
JSON
.
parse
(
step1
);
var
step3
=
new
Buffer
(
step2
);
var
step4
=
step3
.
toString
();
req
.
body
=
JSON
.
parse
(
step4
);
}
}
}
module
.
exports
=
OplogService
;
igirl-channel-gateway/app/config/routes/api.js
View file @
f677b718
...
...
@@ -5,24 +5,14 @@ const logCtl = system.getObject("service.common.oplogSve");
const
utilsNeedSve
=
system
.
getObject
(
"service.utilsSve.utilsNeedSve"
);
module
.
exports
=
function
(
app
)
{
// app.get("/auth", async function (req, res) {
// if (!req.query.opencode) {
// return system.getResult(null, "opencode参数不能为空");
// }
// return await userSve.authByCode(opencode);
// });
// case "submitSolution"://提交需求
// opResult = await this.needinfoSve.createicneedinfo(pobj);
// break;
// case "paySuccess"://支付成功回调
// opResult = await this.orderinfoSve.createsolutionOrder(pobj);
// break;
// case "solutionClose"://需求关闭
// opResult = await this.needinfoSve.solutionClose(pobj);
app
.
use
(
'/api/ali/esp/intention/submit'
,
async
function
(
req
,
res
)
{
try
{
if
(
req
.
headers
[
'content-type'
]
===
'application/octet-stream'
)
{
await
logCtl
.
applicationOctetStream2Json
(
req
);
}
var
client_ip
=
system
.
get_client_ip
(
req
);
req
.
body
.
action_type
=
"submitNeed"
;
req
.
body
.
action_type
=
"submitNeed"
;
var
result
=
await
utilsNeedSve
.
reqcenterchannel
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单结果:,method="
+
req
.
body
.
trxcode
,
...
...
@@ -44,8 +34,11 @@ module.exports = function (app) {
});
app
.
use
(
'/api/ali/esp/intention/solution/feedback'
,
async
function
(
req
,
res
)
{
try
{
if
(
req
.
headers
[
'content-type'
]
===
'application/octet-stream'
)
{
await
logCtl
.
applicationOctetStream2Json
(
req
);
}
var
client_ip
=
system
.
get_client_ip
(
req
);
req
.
body
.
action_type
=
"receiveFeedback"
;
req
.
body
.
action_type
=
"receiveFeedback"
;
var
result
=
await
utilsNeedSve
.
reqcenterchannel
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单结果:,method="
+
req
.
body
.
trxcode
,
...
...
@@ -66,8 +59,11 @@ module.exports = function (app) {
});
app
.
use
(
'/api/ali/ic/paySuccess'
,
async
function
(
req
,
res
)
{
try
{
if
(
req
.
headers
[
'content-type'
]
===
'application/octet-stream'
)
{
await
logCtl
.
applicationOctetStream2Json
(
req
);
}
var
client_ip
=
system
.
get_client_ip
(
req
);
req
.
body
.
action_type
=
"paySuccess"
;
req
.
body
.
action_type
=
"paySuccess"
;
var
result
=
await
utilsNeedSve
.
paySuccess
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单结果:,method="
+
req
.
body
.
trxcode
,
...
...
@@ -88,8 +84,11 @@ module.exports = function (app) {
});
app
.
use
(
'/api/ali/esp/intention/close'
,
async
function
(
req
,
res
)
{
try
{
if
(
req
.
headers
[
'content-type'
]
===
'application/octet-stream'
)
{
await
logCtl
.
applicationOctetStream2Json
(
req
);
}
var
client_ip
=
system
.
get_client_ip
(
req
);
req
.
body
.
action_type
=
"needClose"
;
req
.
body
.
action_type
=
"needClose"
;
var
result
=
await
utilsNeedSve
.
reqcenterchannel
(
req
.
body
,
client_ip
);
logCtl
.
info
({
optitle
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
+
"回调处理订单结果:,method="
+
req
.
body
.
trxcode
,
...
...
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