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
d8ca5d89
Commit
d8ca5d89
authored
Dec 25, 2019
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
a374b20e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
134 deletions
+81
-134
igirl-channel-web/app/base/controller/impl/trademark/tmqueryCtl.js
+39
-84
igirl-channel-web/app/config/routes/web.js
+42
-43
igirl-channel-web/app/front/entry/public/js/admin.js
+0
-6
igirl-channel-web/app/front/entry/public/js/index.js
+0
-1
igirl-channel-web/app/front/entry/public/js/vue/indextest.js
+0
-0
No files found.
igirl-channel-web/app/base/controller/impl/trademark/tmqueryCtl.js
View file @
d8ca5d89
...
...
@@ -118,6 +118,10 @@ class tmqueryCtl extends CtlBase {
var
opJdPayPageInfoResult
=
await
this
.
opJdPayPageInfo
(
pobj
,
result
,
req
);
return
opJdPayPageInfoResult
;
}
else
if
([
"gsb"
].
indexOf
(
pobj
.
actionProcess
)
>=
0
&&
pobj
.
actionType
==
"subTmOrder"
)
{
var
opGsbPayPageInfoResult
=
await
this
.
opGsbPayPageInfo
(
pobj
,
result
,
req
);
return
opGsbPayPageInfoResult
;
}
return
result
;
}
catch
(
e
)
{
console
.
log
(
e
.
stack
,
"操作error..................."
);
...
...
@@ -501,7 +505,7 @@ class tmqueryCtl extends CtlBase {
var
reqUrl
=
this
.
channelApiUrl
+
"/action/tmOrder/springBoard"
;
this
.
logClient
.
error
(
"jd"
,
"req---->pushJdPayOrder---->params:"
+
JSON
.
stringify
(
param
)
+
",reqUrl:"
+
reqUrl
);
var
resultUser
=
await
this
.
execClient
.
execPostTK
(
param
,
reqUrl
,
tokenInfo
.
data
.
token
);
if
(
!
resultUser
)
{
this
.
logClient
.
error
(
"jd"
,
"req---->pushJdPayOrder---->error:"
+
JSON
.
stringify
(
resultUser
));
...
...
@@ -522,95 +526,46 @@ class tmqueryCtl extends CtlBase {
if
(
!
pobj
.
actionBody
.
itemCode
)
{
return
system
.
getResult
(
null
,
"itemCode param is not empty"
);
}
return
system
.
getResultSuccess
();
}
async
getGsbPayPageAddr
(
itemCode
,
itemCodeList
,
req
)
{
//获取京东下单
try
{
const
{
Signer
,
Context
}
=
require
(
'../jd-gateway-sdk'
);
let
ctx
=
new
Context
(
'x3k0s704lfun.cn-north-1.jdcloud-api.net'
,
'/market/order/api/submit'
,
'POST'
,
null
,
'empty'
);
ctx
.
regionId
=
'cn-north-1'
ctx
.
headers
.
set
(
'content-type'
,
'application/json'
);
let
credentials
=
{
accessKeyId
:
'C6D680733C19362B5DF478207D6A90A4'
,
//替换自己的AK
secretAccessKey
:
'EB9AFEE49CE41700CADD5F2EE3B2122C'
//替换自己的SK--jd>>>>>>>
var
tokenInfo
=
await
this
.
getToken
(
pobj
.
actionProcess
);
if
(
tokenInfo
.
status
!=
0
)
{
return
tokenInfo
;
}
//测试报文:
//ctx.body = "pin=jcloud_pRiHQTd&serviceId=580010&itemCode=FW_GOODS-580010-1&platform=6"
//POST
var
qs
=
require
(
'querystring'
);
// var post_data = { pin: "syaify", serviceId: 580010, itemCode: "FW_GOODS-580010-1", platform: 6, orderNum: 1, articleType: 1 };//这是需要提交的数据
var
post_data
=
{
pin
:
req
.
session
.
userPinInfo
.
channelUserId
,
serviceId
:
itemCodeList
[
1
],
itemCode
:
itemCode
,
platform
:
6
,
orderNum
:
1
,
articleType
:
1
,
additions
:
'{
\
"246
\
": 0 }'
};
//这是需要提交的数据
// var tmpContent = '{"pin":"syaify","serviceId":"581976","itemCode":"FW_GOODS-581976","platform":6,"orderNum":1,"articleType":1,"additions":{"246":0}}';
var
tmpContent
=
JSON
.
stringify
(
post_data
);
var
tmpContentLength
=
Buffer
.
byteLength
(
tmpContent
);
ctx
.
body
=
tmpContent
;
ctx
.
method
=
'POST'
var
signer
=
new
Signer
(
ctx
,
credentials
);
ctx
.
headers
.
set
(
'Content-Length'
,
tmpContentLength
)
ctx
.
buildNonce
()
var
dd
=
new
Date
();
var
auth
=
signer
.
sign
(
dd
)
console
.
log
(
"POST签名为:"
,
auth
)
ctx
.
headers
.
set
(
'Authorization'
,
auth
)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
var
http
=
require
(
'https'
);
var
options
=
{
host
:
'x3k0s704lfun.cn-north-1.jdcloud-api.net'
,
port
:
443
,
path
:
'/market/order/api/submit'
,
method
:
'POST'
,
headers
:
{
}
var
param
=
{
actionProcess
:
pobj
.
actionProcess
,
actionType
:
"subGsbOrderInfo"
,
actionBody
:
{
channelUserId
:
req
.
session
.
userPinInfo
.
channelUserId
,
channelItemCode
:
pobj
.
actionBody
.
itemCode
,
order_param
:
{
mobile_phone
:
pobj
.
actionBody
.
apply
.
mobile
||
"18888888888"
,
//必填
goods_list
:
[{
//必填
goods_name
:
pobj
.
actionBody
.
itemCode
,
goods_quantity
:
1
,
}],
order_price
:
300
,
//必填
province_name
:
""
,
//省
city_name
:
""
,
//市
district_name
:
""
//区
}
},
isUser
:
"yes"
};
for
(
let
[
key
,
value
]
of
ctx
.
headers
)
{
options
.
headers
[
key
]
=
value
var
reqUrl
=
this
.
channelApiUrl
+
"/action/tmOrder/springBoard"
;
console
.
log
(
"req---->opGsbPayPageInfo---->params:"
+
JSON
.
stringify
(
param
)
+
",reqUrl:"
+
reqUrl
);
var
result
=
await
this
.
execClient
.
execPostTK
(
param
,
reqUrl
,
tokenInfo
.
data
.
token
);
if
(
!
result
)
{
console
.
log
(
"req---->opGsbPayPageInfo---->error:"
+
JSON
.
stringify
(
result
));
return
system
.
getResult
(
null
,
"req error"
);
}
return
result
;
this
.
logClient
.
info
(
"jd"
,
"req---->getJdPayPageAddr---->options:"
+
JSON
.
stringify
(
options
));
this
.
logClient
.
info
(
"jd"
,
"req---->getJdPayPageAddr---->tmpContent:"
+
tmpContent
);
var
reqResult
=
await
new
Promise
(
function
(
resolve
,
reject
)
{
let
req
=
http
.
request
(
options
,
function
(
res
)
{
// res.setEncoding(encoding);
console
.
log
(
"statusCode: "
,
res
.
statusCode
);
console
.
log
(
"headers: "
,
res
.
headers
);
var
_data
=
''
;
res
.
on
(
'data'
,
function
(
chunk
)
{
_data
+=
chunk
;
});
res
.
on
(
'end'
,
function
()
{
console
.
log
(
"
\
n--req---成功->>
\
nresult:"
,
_data
)
resolve
({
result
:
true
,
data
:
_data
});
});
});
req
.
on
(
'error'
,
(
e
)
=>
{
console
.
error
(
`请求遇到问题-------------:
${
e
.
message
}
`
);
resolve
({
result
:
false
,
errmsg
:
e
.
message
});
});
req
.
write
(
tmpContent
);
req
.
end
();
});
return
reqResult
;
}
catch
(
errorMsg
)
{
this
.
logClient
.
error
(
"jd"
,
"req---->getJdPayPageAddr---->error:"
+
error
.
stack
);
return
{
success
:
false
,
code
:
-
200
,
msg
:
error
.
stack
};
}
catch
(
error
)
{
console
.
log
(
"req---->opGsbPayPageInfo---->操作error:"
+
error
.
stack
);
return
system
.
getResultFail
(
-
200
,
"操作error"
);
}
return
system
.
getResultSuccess
();
}
async
pushGsbPayOrder
(
pushData
,
req
)
{
//处理京东推送的订单信息
try
{
...
...
igirl-channel-web/app/config/routes/web.js
View file @
d8ca5d89
...
...
@@ -7,6 +7,11 @@ var logClient = system.getObject("util.logClient");
const
jwt
=
require
(
'jsonwebtoken'
);
const
secret
=
'3rZ3aNfGAyQAB4sE'
;
//自定义
module
.
exports
=
function
(
app
)
{
app
.
get
(
"/admin"
,
async
function
(
req
,
res
)
{
res
.
redirect
(
"http://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=http://tm.plus.jdcloud.com/jdtm/getUser&state=OAjdlist&client_id=9841572588670903"
);
return
;
});
app
.
get
(
"/jdtm/getUser"
,
async
function
(
req
,
res
)
{
try
{
var
params
=
req
.
query
;
...
...
@@ -48,47 +53,6 @@ module.exports = function (app) {
});
}
});
// app.get("/login", async function (req, res) {
// try {
// var params = req.query;
// if (!params.state || !params.token_type || !params.access_token) {
// res.redirect("http://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=http://tm.plus.jdcloud.com/jdtm/getUser&state=jdindentlist&client_id=9841572588670903");
// return;
// }
// var getUserparams = {
// actionProcess: "jd",
// authUrl: "https://oauth2.jdcloud.com/userinfo",
// authToken: params.token_type + " " + params.access_token
// };
// var userItemResult = await tmqueryCtl.getJdUserInfo(getUserparams, req.query, req);
// logClient.info("jd", {
// optitle: "###获取京东用户结果...getJdUserInfo",
// op: "/jdtm/loginUser",
// content: "参数=" + JSON.stringify(getUserparams) + ",result=" + JSON.stringify(userItemResult),
// clientIp: ""
// });
// if (userItemResult.status != 0) {
// res.redirect("/#/jd/jdindentlist");
// return;
// }
// if (!userItemResult.data.encryptChannelUserId || userItemResult.data.encryptChannelUserId == "undefined") {
// userItemResult = await tmqueryCtl.getUserIdEncryptStr(getUserparams, req.query, req);
// if (userItemResult.status != 0) {
// res.redirect("/#/jd/jdindentlist");
// return;
// }
// }
// var skipUrl = "/#/jd/" + params.state + "?channelUserId=" + encodeURIComponent(userItemResult.data.encryptChannelUserId);
// res.redirect(skipUrl);
// } catch (error) {
// logClient.error("jd", {
// optitle: "###获取京东用户异常...getJdUserInfo",
// op: "/jdtm/loginUser",
// content: error.stack,
// clientIp: ""
// });
// }
// });
app
.
get
(
"/jd/orderNotify"
,
async
function
(
req
,
res
)
{
logClient
.
payLog
(
"jd"
,
{
optitle
:
"###操作订单结果参数...orderNotify"
,
...
...
@@ -202,8 +166,13 @@ module.exports = function (app) {
res
.
redirect
(
skipUrl
);
});
app
.
get
(
"/gsb
/selfRegister
"
,
async
function
(
req
,
res
)
{
app
.
get
(
"/gsb"
,
async
function
(
req
,
res
)
{
var
skipUrl
=
"/#/gsb/selftmreg?channelUserId="
;
var
params
=
req
.
query
;
if
(
!
params
.
state
)
{
res
.
redirect
(
skipUrl
);
return
;
}
var
token
=
req
.
cookies
.
ic_token
;
if
(
!
token
)
{
res
.
redirect
(
skipUrl
);
...
...
@@ -230,9 +199,39 @@ module.exports = function (app) {
res
.
redirect
(
skipUrl
);
return
;
}
skipUrl
=
skipUrl
+
encodeURIComponent
(
userItemResult
.
data
.
encryptChannelUserId
);
skipUrl
=
"/#/gsb/"
+
params
.
state
+
"?channelUserId="
+
encodeURIComponent
(
userItemResult
.
data
.
encryptChannelUserId
);
res
.
redirect
(
skipUrl
);
});
app
.
get
(
"/gsb/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
.
pushJdPayOrder
(
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
:
"https://tm.plus.jdcloud.com/jd/skipPage?channelUserId="
+
req
.
query
.
jdPin
,
adminUrl
:
"https://tm.plus.jdcloud.com"
}
};
res
.
end
(
JSON
.
stringify
(
params
));
return
;
});
app
.
get
(
"/"
,
async
function
(
req
,
res
)
{
try
{
var
appinfo
=
await
metaCtl
.
getAppInfo
(
req
);
...
...
igirl-channel-web/app/front/entry/public/js/admin.js
View file @
d8ca5d89
...
...
@@ -106,12 +106,6 @@ basecomp.forEach(function (comp) {
}
else
{
this
.
logins
.
push
({
"icon"
:
"el-icon-arrow-right"
,
"title"
:
"退出"
,
"type"
:
"text"
,
key
:
"exit"
,
"isOnGrid"
:
true
});
}
this
.
checkLogin
(()
=>
{
if
(
location
.
hash
==
"#/"
){
this
.
$router
.
push
(
"/index"
);
}
});
},
methods
:{
initWindowShow
(){
...
...
igirl-channel-web/app/front/entry/public/js/index.js
View file @
d8ca5d89
...
...
@@ -209,7 +209,6 @@ axios.get("/web/common/metaCtl/getRouteConfig").then(d => {
}
else
{
this
.
logins
.
push
({
"icon"
:
"el-icon-arrow-right"
,
"title"
:
"退出"
,
"type"
:
"text"
,
key
:
"exit"
,
"isOnGrid"
:
true
});
}
this
.
checkLogin
();
},
methods
:
{
// 返回当前接入渠道标识
...
...
igirl-channel-web/app/front/entry/public/js/vue/indextest.js
View file @
d8ca5d89
This diff is collapsed.
Click to expand it.
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