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
2b8fa150
Commit
2b8fa150
authored
Mar 18, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
91e33a4e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
7 deletions
+81
-7
igirl-channel-gateway/app/base/service/impl/utilsSve/utilsNeedSve.js
+65
-5
igirl-channel-gateway/app/base/utils/execClient.js
+14
-0
igirl-channel-gateway/app/config/settings.js
+2
-2
No files found.
igirl-channel-gateway/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
2b8fa150
...
@@ -9,6 +9,7 @@ class UtilsNeedSve extends AppServiceBase {
...
@@ -9,6 +9,7 @@ class UtilsNeedSve extends AppServiceBase {
super
();
super
();
this
.
execlient
=
system
.
getObject
(
"util.execClient"
);
this
.
execlient
=
system
.
getObject
(
"util.execClient"
);
this
.
channelApiUrl
=
settings
.
channelApiUrl
();
this
.
channelApiUrl
=
settings
.
channelApiUrl
();
this
.
centerChannelUrl
=
settings
.
centerChannelUrl
();
this
.
appInfo
=
{
this
.
appInfo
=
{
aliyuntmtransfer
:
{
appkey
:
settings
.
appKey
,
secret
:
settings
.
secret
}
aliyuntmtransfer
:
{
appkey
:
settings
.
appKey
,
secret
:
settings
.
secret
}
};
};
...
@@ -33,6 +34,28 @@ class UtilsNeedSve extends AppServiceBase {
...
@@ -33,6 +34,28 @@ class UtilsNeedSve extends AppServiceBase {
return
tokenResult
;
return
tokenResult
;
}
}
async
getCenterToken
()
{
var
self
=
this
;
var
reqTokenUrl
=
this
.
centerChannelUrl
+
"/web/auth/accessAuth/getAppTokenByAppKey"
;
var
reqParam
=
self
.
appInfo
[
"aliyuntmtransfer"
];
if
(
!
reqParam
.
appkey
||
!
reqParam
.
secret
)
{
return
system
.
getResult
(
null
,
"reqType类型有误,请求失败"
);
}
var
param
=
{
"actionType"
:
"getAppTokenByAppKey"
,
"actionBody"
:
{
"appkey"
:
reqParam
.
appkey
,
"secret"
:
reqParam
.
secret
}
};
var
rtn
=
await
this
.
execlient
.
execPost
(
param
,
reqTokenUrl
);
if
(
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"获取token失败"
);
}
var
tokenResult
=
JSON
.
parse
(
rtn
.
stdout
);
return
tokenResult
;
}
getUUID
()
{
getUUID
()
{
var
uuid
=
uuidv4
();
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
...
@@ -41,15 +64,52 @@ class UtilsNeedSve extends AppServiceBase {
...
@@ -41,15 +64,52 @@ class UtilsNeedSve extends AppServiceBase {
async
reqcenterchannel
(
pobj
)
{
async
reqcenterchannel
(
pobj
)
{
var
sobj
=
{
var
sobj
=
{
"actionProcess"
:
"ali"
,
"actionType"
:
pobj
.
action_type
,
"actionType"
:
pobj
.
action_type
,
"isUser"
:
"yes"
,
"actionBody"
:
pobj
"actionBody"
:
pobj
}
}
var
tokenInfo
=
await
this
.
getToken
();
var
tokenInfo
=
await
this
.
getCenterToken
();
var
url
=
settings
.
centerChannelUrl
()
+
"web/opreceive/need/springBoard"
;
if
(
tokenInfo
.
status
!=
0
)
{
return
{
"requestId"
:
self
.
getUUID
(),
"success"
:
true
,
"errorMsg"
:
""
,
"errorCode"
:
"ok"
};
}
// //获取用户userpin
// var userpin = "";
// pobj.actionType = "getLoginByUserName";
// pobj.actionBody.channelUserId = actionBody.channelUserId;//渠道用户id,没有则用手机号
// pobj.actionBody.mobile = userMoblie;//用户手机号
// var url = settings.centerChannelUrl() + "/web/auth/accessAuth/springBoard";
// var userpinResult = await this.execlient.execPostTK(pobj, url, token);
// if (!userpinResult || !userpinResult.stdout) {
// return system.getResult(null, userpinResult.msg);
// }
// var userpinResultTmp = JSON.parse(userpinResult.stdout);
// if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
// return system.getResultFail(-99, "获取userpin失败");
// }
// userpin = userpinResultTmp.data.userpin;
// if (!userpin) {
// return system.getResultFail(-88, "获取userpin失败!!");
// }
//带userpin请求
// url = settings.centerChannelUrl() + "web/opaction/order/springBoard";
// pobj.actionType = "getOrderDeliveryFlowInfo";
// var rtn = await this.execlient.execDataPostByTokenUserPin(pobj, url, token, userpin);
// if (!rtn || !rtn.stdout) {
// return system.getResult(null, "execPost is empty");
// }
// var result = JSON.parse(rtn.stdout);
var
url
=
settings
.
centerChannelUrl
()
+
"/web/opreceive/need/springBoard"
;
var
rtn
=
await
this
.
execlient
.
execPostTK
(
sobj
,
url
,
tokenInfo
.
data
.
token
);
var
rtn
=
await
this
.
execlient
.
execPostTK
(
sobj
,
url
,
tokenInfo
.
data
.
token
);
var
self
=
this
;
var
self
=
this
;
return
{
return
{
"requestId"
:
self
.
getUUID
(),
"requestId"
:
self
.
getUUID
(),
"success"
:
true
,
"success"
:
true
,
...
...
igirl-channel-gateway/app/base/utils/execClient.js
View file @
2b8fa150
...
@@ -7,6 +7,7 @@ class ExecClient {
...
@@ -7,6 +7,7 @@ class ExecClient {
this
.
cmdPostPattern
=
"curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}"
;
this
.
cmdPostPattern
=
"curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}"
;
this
.
cmdGetPattern
=
"curl -G -X GET '{url}'"
;
this
.
cmdGetPattern
=
"curl -G -X GET '{url}'"
;
this
.
cmdPostTK
=
"curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}"
;
this
.
cmdPostTK
=
"curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}"
;
this
.
cmdDataPostByTokenUserPinPattern
=
"curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'userpin:{UPIN}' -d '{data}' {url}"
;
}
}
async
exec
(
cmd
)
{
async
exec
(
cmd
)
{
...
@@ -44,6 +45,19 @@ class ExecClient {
...
@@ -44,6 +45,19 @@ class ExecClient {
return
cmd
;
return
cmd
;
}
}
async
execDataPostByTokenUserPin
(
subData
,
url
,
token
,
userPin
)
{
let
cmd
=
this
.
execDataPostByTokenUserPinCmd
(
subData
,
url
,
token
,
userPin
);
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
}
execDataPostByTokenUserPinCmd
(
subData
,
url
,
token
,
userPin
)
{
var
data
=
JSON
.
stringify
(
subData
);
var
cmd
=
this
.
cmdDataPostByTokenUserPinPattern
.
replace
(
/
\{
data
\}
/g
,
data
).
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
tk
\}
/g
,
token
).
replace
(
/
\{
UPIN
\}
/g
,
userPin
);
console
.
log
(
cmd
);
return
cmd
;
}
async
exec2
(
cmd
)
{
async
exec2
(
cmd
)
{
return
exec
(
cmd
,
{
encoding
:
"base64"
});
return
exec
(
cmd
,
{
encoding
:
"base64"
});
}
}
...
...
igirl-channel-gateway/app/config/settings.js
View file @
2b8fa150
...
@@ -40,9 +40,9 @@ var settings = {
...
@@ -40,9 +40,9 @@ var settings = {
},
},
centerChannelUrl
:
function
()
{
centerChannelUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
return
"http://gsb.qifu.gongsibao.com:4012
/
"
;
//localsettings.reqEsDevUrl;
return
"http://gsb.qifu.gongsibao.com:4012"
;
//localsettings.reqEsDevUrl;
}
else
{
}
else
{
return
"http://gsb.qifu.gongsibao.com:4012
/
"
;
return
"http://gsb.qifu.gongsibao.com:4012"
;
}
}
},
},
...
...
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