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
ca5784f2
Commit
ca5784f2
authored
Dec 06, 2019
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
e82034fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
31 deletions
+43
-31
igirl-channel-jdweb/app/base/controller/impl/trademark/tmqueryCtl.js
+35
-27
igirl-channel-jdweb/app/config/routes/web.js
+8
-4
No files found.
igirl-channel-jdweb/app/base/controller/impl/trademark/tmqueryCtl.js
View file @
ca5784f2
...
...
@@ -10,7 +10,6 @@ class tmqueryCtl extends CtlBase {
jd
:
{
appkey
:
"201911251551"
,
secret
:
"56006077354d48858026c80c0e10bef6"
}
};
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
jdOauthUrl
=
"https://oauth2.jdcloud.com/userinfo"
;
}
async
doPost
(
pobj
,
obj
,
req
)
{
var
rc
=
system
.
getObject
(
"util.execClient"
);
...
...
@@ -92,8 +91,9 @@ class tmqueryCtl extends CtlBase {
if
(
!
result
)
{
return
system
.
getResult
(
null
,
"处理请求失败"
);
}
if
(
result
.
status
&&
result
.
status
!=
0
)
{
return
result
;
if
([
"jd"
].
indexOf
(
pobj
.
actionProcess
).
length
>=
0
&&
pobj
.
actionType
==
"subTmOrder"
)
{
var
opPayPageInfoResult
=
await
opPayPageInfo
(
pobj
);
return
opPayPageInfoResult
;
}
return
result
;
}
catch
(
e
)
{
...
...
@@ -101,7 +101,6 @@ class tmqueryCtl extends CtlBase {
return
system
.
getResult
(
null
,
"操作失败"
);
}
}
async
getToken
(
reqType
)
{
var
self
=
this
;
var
token
=
""
;
...
...
@@ -160,19 +159,45 @@ class tmqueryCtl extends CtlBase {
async
getUserInfo
(
pobj
,
qobj
,
req
)
{
try
{
console
.
log
(
qobj
,
"getUserInfo..######################.qobj...."
);
var
result
=
await
this
.
execClient
.
execPostJDTK
(
""
,
this
.
jdOauthUrl
,
qobj
.
token_type
+
" "
+
qobj
.
access_token
);
console
.
log
(
result
,
"getUserInfo.....result......."
);
var
authUrl
=
pobj
.
authUrl
;
var
authToken
=
pobj
.
authToken
;
if
(
!
authUrl
)
{
return
system
.
getResult
(
null
,
"authUrl不能为空"
);
}
if
(
!
authToken
)
{
return
system
.
getResult
(
null
,
"authToken不能为空"
);
}
var
result
=
await
this
.
execClient
.
execPostJDTK
(
""
,
authUrl
,
authToken
);
if
(
!
result
||
!
result
.
account
)
{
return
system
.
getResult
(
null
,
"处理用户请求失败,msg:"
+
result
.
error_description
);
}
return
system
.
getResultSuccess
(
result
);
var
tokenInfo
=
await
this
.
getToken
(
pobj
.
actionProcess
);
if
(
tokenInfo
.
status
!=
0
)
{
return
tokenInfo
;
}
//有返回用户信息进行用户ID加密
var
param
=
{
channelUserId
:
result
.
data
.
account
,
isUser
:
"yes"
};
var
reqUrl
=
this
.
channelApiUrl
+
"/action/tmTools/springBoard"
;
var
resultUser
=
await
this
.
execClient
.
execPostTK
(
param
,
reqUrl
,
tokenInfo
.
data
.
token
);
if
(
!
resultUser
)
{
return
system
.
getResult
(
null
,
"处理请求失败"
);
}
return
resultUser
;
}
catch
(
error
)
{
console
.
log
(
e
.
stack
,
"操作error..................."
);
return
system
.
getResult
(
null
,
"操作失败"
);
return
system
.
getResultFail
(
-
200
,
"操作error"
);
}
}
async
opPayPageInfo
(
pobj
)
{
if
(
pobj
.
actionProcess
==
"jd"
)
{
}
return
system
.
getResultSuccess
()
}
async
getJdSign
(
pobj
,
qobj
,
req
)
{
async
opJdOrder
(
pobj
,
qobj
,
req
)
{
try
{
const
{
Signer
,
Context
}
=
require
(
'../jd-gateway-sdk'
);
let
ctx
=
new
Context
(
'x3k0s704lfun-test.cn-north-1.jdcloud-api.net'
,
'/market/order/api/submit'
,
'POST'
,
null
,
'empty'
);
...
...
@@ -248,20 +273,3 @@ class tmqueryCtl extends CtlBase {
}
module
.
exports
=
tmqueryCtl
;
// var task = new tmqueryCtl();
// var obj={
// "currentpage": 1,
// "keyword": "萌",
// "max": "",
// "min": "",
// "order": "",
// "pagesize": 36,
// "sort": "",
// "tm_nclcode": [],
// "tm_structure": "",
// "tm_word": ""
// };
// task.test(obj).then(d=>{
// console.log("dddddddddddddddddddddddddddddd");
// console.log(d);
// })
igirl-channel-jdweb/app/config/routes/web.js
View file @
ca5784f2
...
...
@@ -4,18 +4,22 @@ var metaCtl = System.getObject("web.common.metaCtl");
var
tmqueryCtl
=
System
.
getObject
(
"web.trademark.tmqueryCtl"
);
module
.
exports
=
function
(
app
)
{
app
.
get
(
"/jdtm/getUser"
,
async
function
(
req
,
res
)
{
console
.
log
(
req
.
query
,
"/jdtm/getUser...................."
);
console
.
log
(
req
.
query
,
"/jdtm/getUser...................."
);
var
params
=
req
.
query
;
if
(
!
params
.
state
)
{
res
.
redirect
(
"/#/jd/jdtrademark"
);
return
;
}
var
userItemResult
=
await
tmqueryCtl
.
getUserInfo
(
req
.
body
,
req
.
query
,
req
);
var
getUserparams
=
{
authUrl
:
"https://oauth2.jdcloud.com/userinfo"
,
authToken
:
params
.
token_type
+
" "
+
params
.
access_token
};
var
userItemResult
=
await
tmqueryCtl
.
getUserInfo
(
getUserparams
,
req
.
query
,
req
);
if
(
userItemResult
.
status
!=
0
)
{
res
.
redirect
(
"/#/jd/jdtrademark"
);
return
;
}
var
skipUrl
=
"/#/jd/"
+
params
.
state
+
"?channelUserId="
+
encodeURIComponent
(
userItemResult
.
data
.
account
);
var
skipUrl
=
"/#/jd/"
+
params
.
state
+
"?channelUserId="
+
encodeURIComponent
(
userItemResult
.
data
.
encryptChannelUserId
);
res
.
redirect
(
skipUrl
);
});
app
.
get
(
"/jdtm/orderNotify"
,
async
function
(
req
,
res
)
{
...
...
@@ -64,7 +68,7 @@ module.exports = function (app) {
}
catch
(
error
)
{
console
.
log
(
error
.
stack
,
"get/web/:gname/:qname/:method,error............."
);
}
});
});
app
.
get
(
'/web/:gname/:qname/:method'
,
function
(
req
,
res
)
{
try
{
var
classPath
=
req
.
params
[
"qname"
];
...
...
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