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
fda4caf3
Commit
fda4caf3
authored
Dec 13, 2019
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
de68e3de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
39 deletions
+84
-39
igirl-channel-jdweb/app/base/controller/impl/trademark/tmqueryCtl.js
+9
-4
igirl-channel-jdweb/app/base/utils/logClient.js
+12
-4
igirl-channel-jdweb/app/config/log4js.json
+21
-0
igirl-channel-jdweb/app/config/routes/web.js
+42
-31
No files found.
igirl-channel-jdweb/app/base/controller/impl/trademark/tmqueryCtl.js
View file @
fda4caf3
...
...
@@ -7,7 +7,8 @@ class tmqueryCtl extends CtlBase {
super
();
this
.
channelApiUrl
=
settings
.
channelApiUrl
();
this
.
appInfo
=
{
jd
:
{
appkey
:
"201911251551"
,
secret
:
"56006077354d48858026c80c0e10bef6"
}
jd
:
{
appkey
:
"201911251551"
,
secret
:
"56006077354d48858026c80c0e10bef6"
},
1688
:
{
appkey
:
"201911131657"
,
secret
:
"eeb18393aade40149287b024d8ba0850"
}
};
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
...
...
@@ -127,6 +128,9 @@ class tmqueryCtl extends CtlBase {
case
"jd"
:
reqParam
=
self
.
appInfo
[
"jd"
];
break
;
case
"1688"
:
reqParam
=
self
.
appInfo
[
"jd"
];
break
;
default
:
break
;
}
...
...
@@ -208,7 +212,7 @@ class tmqueryCtl extends CtlBase {
req
.
session
.
userPinInfo
.
encryptChannelUserId
=
resultUser
.
data
||
""
;
return
system
.
getResultSuccess
({
encryptChannelUserId
:
resultUser
.
data
||
""
});
}
catch
(
error
)
{
console
.
log
(
error
.
stack
,
"操作error..................."
);
console
.
log
(
error
.
stack
,
"操作error...................
getUserIdEncryptStr
"
);
return
system
.
getResultFail
(
-
200
,
"操作error"
);
}
}
...
...
@@ -233,12 +237,13 @@ class tmqueryCtl extends CtlBase {
req
.
session
.
userPinInfo
=
resultUser
.
data
;
return
resultUser
;
}
catch
(
error
)
{
console
.
log
(
error
.
stack
,
"操作error..................."
);
console
.
log
(
error
.
stack
,
"操作error...................
getUserInfoTest
"
);
return
system
.
getResultFail
(
-
200
,
"操作error"
);
}
}
async
getUserInfo
(
pobj
,
qobj
,
req
)
{
async
get
Jd
UserInfo
(
pobj
,
qobj
,
req
)
{
try
{
this
.
logClient
.
error
(
"jd"
,
"getUserInfo--error--->pobj:"
+
JSON
.
stringify
(
pobj
));
if
(
req
.
session
.
userPinInfo
)
{
return
system
.
getResultSuccess
({
encryptChannelUserId
:
req
.
session
.
userPinInfo
.
encryptChannelUserId
||
""
});
}
...
...
igirl-channel-jdweb/app/base/utils/logClient.js
View file @
fda4caf3
...
...
@@ -4,16 +4,24 @@ class LogClient {
constructor
()
{
log4js
.
configure
(
settings
.
basepath
+
"/app/config/log4js.json"
);
this
.
logerInfo
=
log4js
.
getLogger
(
"info_file"
);
// this.logerError = log4js.getLogger("error_file");
this
.
logerError
=
log4js
.
getLogger
(
"error_file"
);
this
.
logerPay
=
log4js
.
getLogger
(
"pay_file"
);
// this.logerHttp=log4js.getLogger("http");
}
async
info
(
channelCode
,
msg
)
{
var
tmpMsg
=
typeof
(
msg
)
==
"string"
?
msg
:
JSON
.
stringify
(
msg
);
this
.
logerInfo
.
info
(
"_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________"
);
this
.
logerInfo
.
info
(
"渠道:"
+
channelCode
+
"...
info..."
+
m
sg
);
this
.
logerInfo
.
info
(
"渠道:"
+
channelCode
+
"...
"
+
tmpM
sg
);
}
async
error
(
channelCode
,
msg
)
{
this
.
logerInfo
.
info
(
"_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________"
);
this
.
logerInfo
.
error
(
"渠道:"
+
channelCode
+
"...error..."
+
msg
);
var
tmpMsg
=
typeof
(
msg
)
==
"string"
?
msg
:
JSON
.
stringify
(
msg
);
this
.
logerError
.
error
(
"_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________"
);
this
.
logerError
.
error
(
"渠道:"
+
channelCode
+
"..."
+
tmpMsg
);
}
async
payLog
(
channelCode
,
msg
)
{
var
tmpMsg
=
typeof
(
msg
)
==
"string"
?
msg
:
JSON
.
stringify
(
msg
);
this
.
logerPay
.
info
(
"_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________"
);
this
.
logerPay
.
info
(
"接收渠道付款信息:"
+
channelCode
+
"..."
+
tmpMsg
);
}
}
module
.
exports
=
LogClient
;
igirl-channel-jdweb/app/config/log4js.json
View file @
fda4caf3
...
...
@@ -23,6 +23,15 @@
"backups"
:
5
,
"pattern"
:
"-yyyy-MM-dd-hh.log"
,
"category"
:
"error_file"
},
"pay_file"
:
{
"type"
:
"file"
,
"filename"
:
"logs/payFile/pay"
,
"encoding"
:
"utf-8"
,
"maxLogSize"
:
10000000000
,
"backups"
:
5
,
"pattern"
:
"-yyyy-MM-dd-hh.log"
,
"category"
:
"pay_file"
}
},
"categories"
:
{
...
...
@@ -32,6 +41,18 @@
],
"level"
:
"DEBUG"
},
"error_file"
:
{
"appenders"
:
[
"error_file"
],
"level"
:
"DEBUG"
},
"pay_file"
:
{
"appenders"
:
[
"pay_file"
],
"level"
:
"DEBUG"
},
"http"
:
{
"appenders"
:
[
"access"
...
...
igirl-channel-jdweb/app/config/routes/web.js
View file @
fda4caf3
...
...
@@ -16,7 +16,13 @@ module.exports = function (app) {
authUrl
:
"https://oauth2.jdcloud.com/userinfo"
,
authToken
:
params
.
token_type
+
" "
+
params
.
access_token
};
var
userItemResult
=
await
tmqueryCtl
.
getUserInfo
(
getUserparams
,
req
.
query
,
req
);
var
userItemResult
=
await
tmqueryCtl
.
getJdUserInfo
(
getUserparams
,
req
.
query
,
req
);
logClient
.
payLog
(
"jd"
,
{
optitle
:
"###获取京东用户结果...getJdUserInfo"
,
op
:
"/jdtm/getUser"
,
content
:
"参数="
+
JSON
.
stringify
(
getUserparams
)
+
",result="
+
JSON
.
stringify
(
userItemResult
),
clientIp
:
""
});
if
(
userItemResult
.
status
!=
0
)
{
res
.
redirect
(
"/#/jd/jdtrademark"
);
return
;
...
...
@@ -31,8 +37,42 @@ module.exports = function (app) {
var
skipUrl
=
"/#/jd/"
+
params
.
state
+
"?channelUserId="
+
encodeURIComponent
(
userItemResult
.
data
.
encryptChannelUserId
);
res
.
redirect
(
skipUrl
);
}
catch
(
error
)
{
logClient
.
error
(
"jd"
,
"req---->/jdtm/getUser---->error:"
+
error
.
stack
);
logClient
.
error
(
"jd"
,
{
optitle
:
"###获取京东用户异常...getJdUserInfo"
,
op
:
"/jdtm/getUser"
,
content
:
error
.
stack
,
clientIp
:
""
});
}
});
app
.
get
(
"/jd/orderNotify"
,
async
function
(
req
,
res
)
{
logClient
.
payLog
(
"jd"
,
{
optitle
:
"###操作订单结果参数...orderNotify"
,
op
:
"/jd/orderNotify"
,
content
:
"req.query="
+
JSON
.
stringify
(
req
.
query
)
+
",req.body="
+
JSON
.
stringify
(
req
.
body
),
clientIp
:
""
});
req
.
query
.
actionProcess
=
"jd"
;
var
result
=
await
tmqueryCtl
.
pushPayOrder
(
req
.
query
,
req
);
logClient
.
payLog
(
"jd"
,
{
optitle
:
"###操作订单结果...orderNotify"
,
op
:
"/jd/orderNotify"
,
content
:
"result="
+
JSON
.
stringify
(
result
),
clientIp
:
""
});
if
(
result
.
status
!=
0
)
{
res
.
end
(
JSON
.
stringify
(
result
));
return
;
}
var
params
=
{
instanceId
:
req
.
query
.
orderBizId
,
appInfo
:
{
authUrl
:
"http://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=http://tm.plus.jdcloud.com/jdtm/getUser&state=jdindentlist&client_id=9841572588670903"
}
};
res
.
end
(
JSON
.
stringify
(
params
));
return
;
});
app
.
get
(
"/jdtm/getUserTest"
,
async
function
(
req
,
res
)
{
console
.
log
(
req
.
query
,
"/jdtm/getUser...................."
);
...
...
@@ -55,35 +95,6 @@ module.exports = function (app) {
var
skipUrl
=
"/#/jd/"
+
params
.
state
+
"?channelUserId="
+
encodeURIComponent
(
userItemResult
.
data
.
encryptChannelUserId
);
res
.
redirect
(
skipUrl
);
});
app
.
get
(
"/jd/orderNotify"
,
async
function
(
req
,
res
)
{
// oplogCtl.info({
// optitle: "########################################################.................orderNotify",
// op: "/jd/orderNotify",
// content: "req.query=" + JSON.stringify(req.query) + ",req.body=" + JSON.stringify(req.body),
// clientIp: ""
// });
req
.
query
.
actionProcess
=
"jd"
;
var
result
=
await
tmqueryCtl
.
pushPayOrder
(
req
.
query
,
req
);
// oplogCtl.info({
// optitle: "############################################操作订单结果.................orderNotify",
// op: "/jd/orderNotify",
// content: "req.query=" + JSON.stringify(req.query) + ",req.body=" + JSON.stringify(req.body),
// clientIp: ""
// });
if
(
result
.
status
!=
0
)
{
res
.
end
(
JSON
.
stringify
(
result
));
return
;
}
var
params
=
{
instanceId
:
req
.
query
.
orderBizId
,
appInfo
:
{
authUrl
:
"http://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=http://tm.plus.jdcloud.com/jdtm/getUser&state=jdindentlist&client_id=9841572588670903"
}
};
res
.
end
(
JSON
.
stringify
(
params
));
return
;
});
app
.
get
(
"/"
,
async
function
(
req
,
res
)
{
try
{
var
appinfo
=
await
metaCtl
.
getAppInfo
(
req
);
...
...
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