Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tax_api
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data_server
tax_api
Commits
2c5e3cdc
Commit
2c5e3cdc
authored
May 06, 2019
by
何娜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
taxAPI 修改接口返回结构+帮助信息fix
parent
b07faeb2
Pipeline
#6958
passed with stage
in 3 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
21 deletions
+57
-21
order.js
app/controller/order.js
+25
-19
token.js
app/controller/token.js
+1
-2
partner.js
app/service/partner.js
+31
-0
No files found.
app/controller/order.js
View file @
2c5e3cdc
...
...
@@ -100,8 +100,7 @@ class OrderController extends Controller {
code
:
0
,
data
:
{
orderSn
:
orderId
},
msg
:
''
}
}
}
catch
(
err
)
{
ctx
.
logger
.
error
(
'fetchOrderId'
,
err
);
...
...
@@ -119,24 +118,31 @@ class OrderController extends Controller {
const
{
cityId
}
=
ctx
.
params
;
const
cityName
=
await
await
service
.
scripts
.
fetchScriptName
(
cityId
);
const
helpData
=
await
service
.
scripts
.
fetchHelp
(
cityId
);
let
helpInfo
=
[];
for
(
let
item
of
helpData
[
0
].
help_list
){
helpInfo
.
push
({
desc
:
item
.
content
,
link
:
{
label
:
item
.
button_name
,
url
:
item
.
button_url
,
},
})
}
ctx
.
success
({
code
:
"0"
,
data
:
{
cityId
,
city
:
cityName
,
help
:
helpInfo
if
(
helpData
&&
helpData
.
length
>
0
){
let
helpInfo
=
[];
for
(
let
item
of
helpData
[
0
].
help_list
){
helpInfo
.
push
({
desc
:
item
.
content
,
link
:
{
label
:
item
.
button_name
,
url
:
item
.
button_url
,
},
})
}
ctx
.
success
({
code
:
"0"
,
data
:
{
cityId
,
city
:
cityName
,
help
:
helpInfo
}
});
}
else
{
return
ctx
.
body
=
{
code
:
"-1"
,
msg
:
"未查询到此地区帮助信息"
}
}
);
}
}
}
...
...
app/controller/token.js
View file @
2c5e3cdc
...
...
@@ -25,8 +25,7 @@ class TokenController extends Controller {
const
token
=
await
service
.
signature
.
createToken
(
ctx
.
request
.
body
);
return
ctx
.
body
=
{
code
:
0
,
data
:
{
token
},
msg
:
''
data
:
{
token
}
}
}
catch
(
err
)
{
ctx
.
logger
.
error
(
'partnerCreate'
,
err
);
...
...
app/service/partner.js
View file @
2c5e3cdc
...
...
@@ -9,6 +9,37 @@ class PartnerService extends Service {
this
.
partnerAPI
=
partnerAPI
;
}
async
fetchInfo
(
appKey
){
const
{
ctx
,
partnerAPI
:
{
fetchInfo
,
host
,
redisInfoPrefix
}
}
=
this
;
if
(
appKey
)
{
const
data
=
await
this
.
app
.
redis
.
get
(
redisInfoPrefix
+
appKey
);
ctx
.
logger
.
info
(
'【Scripts】fetchInfo redis data'
,
redisInfoPrefix
+
appKey
,
'result:'
,
data
);
if
(
data
)
{
try
{
return
JSON
.
parse
(
data
);
}
catch
(
err
)
{
ctx
.
logger
.
info
(
'【Scripts】fetchInfo redis err'
,
redisInfoPrefix
+
appKey
,
'result:'
,
data
,
err
);
await
this
.
app
.
redis
.
del
(
redisInfoPrefix
+
appKey
);
}
}
}
const
ret
=
await
ctx
.
curl
(
`
${
host
+
fetchInfo
}
`
,
{
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
method
:
'GET'
,
data
:
{
appKey
}
});
ctx
.
logger
.
info
(
`【Partner】 fetchTheme
${
host
+
fetchInfo
}
?appKey=
${
appKey
}
`
,
ret
.
data
);
if
(
ret
.
status
===
200
&&
ret
.
data
&&
ret
.
data
.
length
>
0
&&
ret
.
data
[
0
].
appKey
===
appKey
)
{
await
this
.
app
.
redis
.
set
(
redisInfoPrefix
+
appKey
,
JSON
.
stringify
(
ret
.
data
[
0
]),
'EX'
,
300
);
}
return
ret
.
data
[
0
];
}
async
notice
(
order
)
{
const
{
ctx
}
=
this
;
const
{
orderId
,
notifyUrl
,
notice
}
=
order
;
...
...
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