Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
taxh5
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
taxh5
Commits
cec2e8f7
Commit
cec2e8f7
authored
Apr 10, 2019
by
何娜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉个税管家
parent
dd29786e
Pipeline
#5818
passed with stage
in 2 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
182 deletions
+33
-182
task.js
app/controller/task.js
+1
-1
scripts.js
app/service/scripts.js
+21
-142
task.js
app/service/task.js
+11
-37
config.local.js
config/config.local.js
+0
-1
config.prod.js
config/config.prod.js
+0
-1
No files found.
app/controller/task.js
View file @
cec2e8f7
...
@@ -182,7 +182,7 @@ class TaskController extends Controller {
...
@@ -182,7 +182,7 @@ class TaskController extends Controller {
async
cityConfigs
()
{
async
cityConfigs
()
{
const
{
ctx
,
service
}
=
this
;
const
{
ctx
,
service
}
=
this
;
ctx
.
validate
(
this
.
cityConfigRule
);
ctx
.
validate
(
this
.
cityConfigRule
);
//
await service.signature.signatureCheck(ctx.request.body);
await
service
.
signature
.
signatureCheck
(
ctx
.
request
.
body
);
const
result
=
await
service
.
task
.
getCityList
();
const
result
=
await
service
.
task
.
getCityList
();
ctx
.
success
({
ctx
.
success
({
code
:
0
,
code
:
0
,
...
...
app/service/scripts.js
View file @
cec2e8f7
...
@@ -5,8 +5,8 @@ const Service = require('egg').Service;
...
@@ -5,8 +5,8 @@ const Service = require('egg').Service;
class
ScriptsService
extends
Service
{
class
ScriptsService
extends
Service
{
constructor
(
ctx
)
{
constructor
(
ctx
)
{
super
(
ctx
);
super
(
ctx
);
const
{
config
}
=
this
;
const
{
config
}
=
this
;
const
{
scriptsAPI
,
taskAPI
}
=
config
;
const
{
scriptsAPI
}
=
config
;
this
.
scriptsAPI
=
scriptsAPI
;
this
.
scriptsAPI
=
scriptsAPI
;
this
.
baseURL
=
scriptsAPI
.
host
;
this
.
baseURL
=
scriptsAPI
.
host
;
this
.
fetchScriptsUrl
=
scriptsAPI
.
fetchScriptsUrl
;
this
.
fetchScriptsUrl
=
scriptsAPI
.
fetchScriptsUrl
;
...
@@ -15,13 +15,10 @@ class ScriptsService extends Service {
...
@@ -15,13 +15,10 @@ class ScriptsService extends Service {
this
.
fetchHelpUrl
=
scriptsAPI
.
fetchHelpUrl
;
this
.
fetchHelpUrl
=
scriptsAPI
.
fetchHelpUrl
;
this
.
redisScriptsKey
=
scriptsAPI
.
redisScriptsKey
;
this
.
redisScriptsKey
=
scriptsAPI
.
redisScriptsKey
;
this
.
redisParamsKey
=
scriptsAPI
.
redisParamsKey
;
this
.
redisParamsKey
=
scriptsAPI
.
redisParamsKey
;
this
.
redisScriptListKey
=
scriptsAPI
.
redisScriptListKey
;
this
.
newhost
=
taskAPI
.
newhost
;
this
.
cityConfigUrl
=
taskAPI
.
cityConfigUrl
;
}
}
async
fetchScripts
()
{
async
fetchScripts
()
{
const
{
baseURL
,
fetchScriptsUrl
,
redisScriptsKey
,
newhost
,
cityConfigUrl
,
ctx
}
=
this
;
const
{
baseURL
,
fetchScriptsUrl
,
redisScriptsKey
,
ctx
}
=
this
;
const
data
=
await
this
.
app
.
redis
.
get
(
redisScriptsKey
);
const
data
=
await
this
.
app
.
redis
.
get
(
redisScriptsKey
);
if
(
data
)
{
if
(
data
)
{
try
{
try
{
...
@@ -31,139 +28,32 @@ class ScriptsService extends Service {
...
@@ -31,139 +28,32 @@ class ScriptsService extends Service {
await
this
.
app
.
redis
.
del
(
redisScriptsKey
);
await
this
.
app
.
redis
.
del
(
redisScriptsKey
);
}
}
}
}
let
cityLists
=
[];
let
newCityMap
=
new
Map
();
//个税管家
const
gsgjRet
=
await
ctx
.
curl
(
newhost
+
cityConfigUrl
,
{
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
contentType
:
'json'
,
});
ctx
.
logger
.
info
(
`【Scripts】fetchScripts,gsgjRet,
${
baseURL
+
fetchScriptsUrl
}
`
,
'result:'
,
gsgjRet
.
data
[
1
]);
if
(
gsgjRet
.
data
&&
gsgjRet
.
data
.
code
===
0
)
{
gsgjRet
.
data
.
data
.
map
(
Prov
=>
{
Prov
.
citys
.
map
(
city
=>
{
let
state
=
city
.
state
===
1
?
'online'
:
'offline'
;
let
obj
=
{
id
:
city
.
id
,
state
:
state
,
hub_name
:
city
.
name
,
hub_id
:
city
.
id
,
province_name
:
Prov
.
provinceName
,
province_id
:
city
.
province
,
};
newCityMap
.
set
(
String
(
city
.
id
),
obj
)
})
});
}
//爬虫
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchScriptsUrl
,
{
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchScriptsUrl
,
{
charset
:
'utf-8'
,
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
dataType
:
'json'
,
contentType
:
'json'
,
contentType
:
'json'
,
});
});
ctx
.
logger
.
info
(
`【Scripts】fetchScripts,result,
${
baseURL
+
fetchScriptsUrl
}
`
,
'result:'
,
result
.
data
[
1
]
);
ctx
.
logger
.
info
(
`【Scripts】fetchScripts,
${
baseURL
+
fetchScriptsUrl
}
`
,
'result:'
,
result
.
data
);
if
(
result
.
data
&&
result
.
data
.
length
>
0
)
{
if
(
result
.
data
&&
result
.
data
.
length
>
0
)
{
result
.
data
.
map
(
city
=>
{
await
this
.
app
.
redis
.
set
(
redisScriptsKey
,
JSON
.
stringify
(
result
.
data
),
'EX'
,
300
);
if
(
city
.
state
===
'offline'
&&
newCityMap
.
get
(
String
(
city
.
id
))
&&
newCityMap
.
get
(
String
(
city
.
id
)).
state
===
'online'
)
{
city
=
newCityMap
.
get
(
String
(
city
.
id
));
city
.
channelType
=
"gsgj"
;
ctx
.
logger
.
info
(
city
.
id
,
city
.
hub_name
)
}
else
{
city
.
channelType
=
"51gs"
;
}
cityLists
.
push
(
city
)
});
await
this
.
app
.
redis
.
set
(
redisScriptsKey
,
JSON
.
stringify
(
cityLists
),
'EX'
,
300
);
}
return
cityLists
;
}
}
async
fetchOneScripts
(
scriptId
)
{
return
result
.
data
;
const
{
baseURL
,
fetchOneScriptUrl
,
redisScriptListKey
,
newhost
,
cityConfigUrl
,
ctx
}
=
this
;
const
data
=
await
this
.
app
.
redis
.
get
(
redisScriptListKey
+
scriptId
);
if
(
data
)
{
try
{
return
JSON
.
parse
(
data
);
}
catch
(
err
)
{
ctx
.
logger
.
error
(
'【Scripts】fetchOneScriptsFromRedis'
,
'result:'
,
data
,
err
);
await
this
.
app
.
redis
.
del
(
redisScriptListKey
+
scriptId
);
}
}
}
let
scriptData
;
async
fetchOneScripts
(
scriptId
)
{
const
{
baseURL
,
fetchOneScriptUrl
,
ctx
}
=
this
;
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchOneScriptUrl
+
'/'
+
scriptId
,
{
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchOneScriptUrl
+
'/'
+
scriptId
,
{
charset
:
'utf-8'
,
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
dataType
:
'json'
,
contentType
:
'json'
,
contentType
:
'json'
,
});
});
if
(
result
.
data
)
{
return
result
.
data
;
if
(
result
.
data
.
state
!=
'online'
)
{
//个税管家
// let newCityMap = new Map();
const
gsgjRet
=
await
ctx
.
curl
(
newhost
+
cityConfigUrl
,
{
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
contentType
:
'json'
,
});
if
(
gsgjRet
.
data
&&
gsgjRet
.
data
.
code
===
0
)
{
gsgjRet
.
data
.
data
.
map
(
Prov
=>
{
Prov
.
citys
.
map
(
city
=>
{
if
(
city
.
state
===
1
)
{
result
.
data
.
params
=
[];
for
(
let
item
of
queryParam
)
{
let
objs
=
{
login_type_id
:
''
,
name
:
''
,
login_step_detail
:
[{
current_step
:
''
,
login_param
:
[],
next_step
:
''
,
step_name
:
''
,
pre_step
:
''
}],
};
for
(
let
gjParams
of
item
.
loginParam
)
{
let
gjObj
=
{};
if
(
gjParams
.
type
===
'radio'
)
{
gjObj
=
{
name
:
gjParams
.
name
,
note
:
''
,
placeholder
:
gjParams
.
note
,
type
:
'radio'
,
}
}
else
{
gjObj
=
{
name
:
gjParams
.
name
,
note
:
gjParams
.
note
,
placeholder
:
''
,
type
:
gjParams
.
type
,
}
}
objs
.
login_step_detail
.
login_param
.
push
(
gjObj
)
}
result
.
data
.
params
.
push
(
objs
)
}
}
})
});
}
}
else
{
scriptData
=
result
.
data
;
}
await
this
.
app
.
redis
.
set
(
redisScriptListKey
+
scriptId
,
JSON
.
stringify
(
scriptData
),
'EX'
,
60
);
}
return
scriptData
;
}
}
async
fetchParams
(
refresh
=
false
)
{
async
fetchParams
(
refresh
=
false
)
{
const
{
baseURL
,
fetchParamsInfoUrl
,
redisParamsKey
,
ctx
}
=
this
;
const
{
baseURL
,
fetchParamsInfoUrl
,
redisParamsKey
,
ctx
}
=
this
;
if
(
!
refresh
)
{
if
(
!
refresh
)
{
const
data
=
await
this
.
app
.
redis
.
get
(
redisParamsKey
);
const
data
=
await
this
.
app
.
redis
.
get
(
redisParamsKey
);
if
(
data
)
{
if
(
data
)
{
...
@@ -184,13 +74,13 @@ class ScriptsService extends Service {
...
@@ -184,13 +74,13 @@ class ScriptsService extends Service {
});
});
ctx
.
logger
.
info
(
`【Scripts】fetchParams,
${
baseURL
+
fetchParamsInfoUrl
}
`
,
'result:'
,
result
.
data
);
ctx
.
logger
.
info
(
`【Scripts】fetchParams,
${
baseURL
+
fetchParamsInfoUrl
}
`
,
'result:'
,
result
.
data
);
if
(
result
.
data
&&
result
.
data
.
length
>
0
)
{
if
(
result
.
data
&&
result
.
data
.
length
>
0
)
{
await
this
.
app
.
redis
.
set
(
redisParamsKey
,
JSON
.
stringify
(
result
.
data
),
'EX'
,
3
00
);
await
this
.
app
.
redis
.
set
(
redisParamsKey
,
JSON
.
stringify
(
result
.
data
),
'EX'
,
30
00
);
}
}
return
result
.
data
;
return
result
.
data
;
}
}
async
fetchHelp
(
scriptId
)
{
async
fetchHelp
(
scriptId
)
{
const
{
baseURL
,
scriptsAPI
:
{
fetchHelpUrl
},
ctx
}
=
this
;
const
{
baseURL
,
scriptsAPI
:
{
fetchHelpUrl
},
ctx
}
=
this
;
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchHelpUrl
+
'/'
+
scriptId
,
{
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchHelpUrl
+
'/'
+
scriptId
,
{
charset
:
'utf-8'
,
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
timeout
:
[
'30s'
,
'30s'
],
...
@@ -201,7 +91,7 @@ class ScriptsService extends Service {
...
@@ -201,7 +91,7 @@ class ScriptsService extends Service {
}
}
async
fetchQueryButton
(
scriptId
)
{
async
fetchQueryButton
(
scriptId
)
{
const
{
baseURL
,
scriptsAPI
:
{
fetchQueryButtonUrl
},
ctx
}
=
this
;
const
{
baseURL
,
scriptsAPI
:
{
fetchQueryButtonUrl
},
ctx
}
=
this
;
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchQueryButtonUrl
+
'/'
+
scriptId
,
{
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchQueryButtonUrl
+
'/'
+
scriptId
,
{
charset
:
'utf-8'
,
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
timeout
:
[
'30s'
,
'30s'
],
...
@@ -212,7 +102,7 @@ class ScriptsService extends Service {
...
@@ -212,7 +102,7 @@ class ScriptsService extends Service {
}
}
async
fetchNotice
(
scriptId
)
{
async
fetchNotice
(
scriptId
)
{
const
{
baseURL
,
scriptsAPI
:
{
fetchNoticeUrl
},
ctx
}
=
this
;
const
{
baseURL
,
scriptsAPI
:
{
fetchNoticeUrl
},
ctx
}
=
this
;
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchNoticeUrl
+
'/'
+
scriptId
,
{
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchNoticeUrl
+
'/'
+
scriptId
,
{
charset
:
'utf-8'
,
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
timeout
:
[
'30s'
,
'30s'
],
...
@@ -223,7 +113,7 @@ class ScriptsService extends Service {
...
@@ -223,7 +113,7 @@ class ScriptsService extends Service {
}
}
async
fetchHubSeripts
(
hubId
)
{
async
fetchHubSeripts
(
hubId
)
{
const
{
baseURL
,
scriptsAPI
:
{
fetchHubSeriptsUrl
},
ctx
}
=
this
;
const
{
baseURL
,
scriptsAPI
:
{
fetchHubSeriptsUrl
},
ctx
}
=
this
;
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchHubSeriptsUrl
+
'/'
+
hubId
+
'/scripts'
,
{
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchHubSeriptsUrl
+
'/'
+
hubId
+
'/scripts'
,
{
charset
:
'utf-8'
,
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
timeout
:
[
'30s'
,
'30s'
],
...
@@ -232,10 +122,9 @@ class ScriptsService extends Service {
...
@@ -232,10 +122,9 @@ class ScriptsService extends Service {
});
});
return
result
.
data
;
return
result
.
data
;
}
}
async
fetchCityFormIp
()
{
async
fetchCityFormIp
()
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
{
ip
}
=
ctx
.
request
;
const
{
ip
}
=
ctx
.
request
;
ctx
.
logger
.
info
(
ctx
.
request
);
ctx
.
logger
.
info
(
ctx
.
request
);
const
url
=
`https://api.map.baidu.com/location/ip?ak=3TBenWOhPygtFFazaR5kSibU&ip=
${
ip
}
`
;
const
url
=
`https://api.map.baidu.com/location/ip?ak=3TBenWOhPygtFFazaR5kSibU&ip=
${
ip
}
`
;
const
result
=
await
ctx
.
curl
(
url
,
{
const
result
=
await
ctx
.
curl
(
url
,
{
...
@@ -247,19 +136,19 @@ class ScriptsService extends Service {
...
@@ -247,19 +136,19 @@ class ScriptsService extends Service {
if
(
result
.
data
.
status
===
0
)
{
if
(
result
.
data
.
status
===
0
)
{
return
result
.
data
.
content
.
address_detail
.
city
;
return
result
.
data
.
content
.
address_detail
.
city
;
}
}
ctx
.
logger
.
error
(
'fetchCityFormIp'
,
url
,
JSON
.
stringify
(
result
.
data
)
);
ctx
.
logger
.
error
(
'fetchCityFormIp'
,
url
,
ip
,
result
.
data
);
return
'北京市'
;
return
'北京市'
;
}
}
async
fetchScriptByCityName
(
name
)
{
async
fetchScriptByCityName
(
name
)
{
const
{
baseURL
,
scriptsAPI
:
{
fetchScriptByCityNameUrl
},
ctx
}
=
this
;
const
{
baseURL
,
scriptsAPI
:
{
fetchScriptByCityNameUrl
},
ctx
}
=
this
;
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchScriptByCityNameUrl
+
'?name='
+
encodeURIComponent
(
name
)
+
'&type=query'
,
{
const
result
=
await
ctx
.
curl
(
baseURL
+
fetchScriptByCityNameUrl
+
'?name='
+
encodeURIComponent
(
name
)
,
{
charset
:
'utf-8'
,
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
dataType
:
'json'
,
contentType
:
'json'
,
contentType
:
'json'
,
});
});
ctx
.
logger
.
info
(
`fetchScriptByCityName,
${
baseURL
+
fetchScriptByCityNameUrl
+
'?name='
+
name
}
`
,
'result:'
,
JSON
.
stringify
(
result
.
data
)
);
ctx
.
logger
.
info
(
`fetchScriptByCityName,
${
baseURL
+
fetchScriptByCityNameUrl
+
'?name='
+
name
}
`
,
'result:'
,
result
.
data
);
return
result
.
data
;
return
result
.
data
;
}
}
...
@@ -269,15 +158,6 @@ class ScriptsService extends Service {
...
@@ -269,15 +158,6 @@ class ScriptsService extends Service {
const
scriptList
=
await
this
.
fetchScriptByCityName
(
city
);
const
scriptList
=
await
this
.
fetchScriptByCityName
(
city
);
return
scriptList
;
return
scriptList
;
}
}
async
fetchScriptName
(
scriptId
)
{
try
{
const
city
=
await
this
.
fetchOneScripts
(
scriptId
);
return
city
.
name
||
'未知'
;
}
catch
(
err
)
{
return
'未知'
;
}
}
}
}
module
.
exports
=
ScriptsService
;
module
.
exports
=
ScriptsService
;
\ No newline at end of file
app/service/task.js
View file @
cec2e8f7
...
@@ -8,7 +8,6 @@ class TaskService extends Service {
...
@@ -8,7 +8,6 @@ class TaskService extends Service {
const
{
config
}
=
this
;
const
{
config
}
=
this
;
const
{
taskAPI
,
LOCK_KEY
}
=
config
;
const
{
taskAPI
,
LOCK_KEY
}
=
config
;
this
.
baseURL
=
taskAPI
.
host
;
this
.
baseURL
=
taskAPI
.
host
;
this
.
newbaseURL
=
taskAPI
.
newhost
;
this
.
createTaskUrl
=
taskAPI
.
createTaskUrl
;
this
.
createTaskUrl
=
taskAPI
.
createTaskUrl
;
this
.
submitTaskUrl
=
taskAPI
.
submitTaskUrl
;
this
.
submitTaskUrl
=
taskAPI
.
submitTaskUrl
;
this
.
fetchCodeUrl
=
taskAPI
.
fetchCodeUrl
;
this
.
fetchCodeUrl
=
taskAPI
.
fetchCodeUrl
;
...
@@ -18,9 +17,8 @@ class TaskService extends Service {
...
@@ -18,9 +17,8 @@ class TaskService extends Service {
}
}
_request
(
url
,
type
,
opts
)
{
_request
(
url
,
opts
)
{
const
{
ctx
,
baseURL
,
newbaseURL
}
=
this
;
const
{
ctx
,
baseURL
}
=
this
;
url
=
(
type
===
'gsgj'
)
?
`
${
newbaseURL
}${
url
}
`
:
`
${
baseURL
}${
url
}
`
;
opts
=
{
opts
=
{
charset
:
'utf-8'
,
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
timeout
:
[
'30s'
,
'30s'
],
...
@@ -28,8 +26,8 @@ class TaskService extends Service {
...
@@ -28,8 +26,8 @@ class TaskService extends Service {
contentType
:
'json'
,
contentType
:
'json'
,
...
opts
,
...
opts
,
};
};
ctx
.
logger
.
info
(
'_request'
,
url
,
type
);
ctx
.
logger
.
info
(
'_request'
,
`
${
baseURL
}${
url
}
`
);
return
ctx
.
curl
(
url
,
opts
);
return
ctx
.
curl
(
`
${
baseURL
}${
url
}
`
,
opts
);
}
}
_checkSuccess
(
result
)
{
_checkSuccess
(
result
)
{
...
@@ -42,21 +40,20 @@ class TaskService extends Service {
...
@@ -42,21 +40,20 @@ class TaskService extends Service {
}
}
}
}
async
create
({
scriptId
,
channelType
})
{
async
create
({
scriptId
})
{
const
{
createTaskUrl
,
ctx
}
=
this
;
const
{
createTaskUrl
,
ctx
}
=
this
;
const
result
=
await
this
.
_request
(
createTaskUrl
,
channelType
,
{
const
result
=
await
this
.
_request
(
createTaskUrl
,
{
method
:
'post'
,
method
:
'post'
,
data
:
{
cityId
:
scriptId
},
data
:
{
cityId
:
scriptId
},
});
});
ctx
.
logger
.
info
(
`【Task】create
${
createTaskUrl
}
cityId:
${
scriptId
}
channelType:
${
channelType
}
result:`
,
JSON
.
stringify
(
result
.
data
));
ctx
.
logger
.
info
(
`【Task】create
${
createTaskUrl
}
cityId:
${
scriptId
}
result:`
,
JSON
.
stringify
(
result
.
data
));
this
.
_checkSuccess
(
result
);
this
.
_checkSuccess
(
result
);
return
result
.
data
.
data
.
taskId
;
return
result
.
data
.
data
.
taskId
;
}
}
async
fetchCapture
({
taskId
,
type
})
{
async
fetchCapture
({
taskId
,
type
})
{
const
{
fetchCodeUrl
,
ctx
}
=
this
;
const
{
fetchCodeUrl
,
ctx
}
=
this
;
let
channelType
=
taskId
.
length
>
20
?
'gsgj'
:
'51gs'
;
const
result
=
await
this
.
_request
(
fetchCodeUrl
,
{
const
result
=
await
this
.
_request
(
fetchCodeUrl
,
channelType
,
{
method
:
'post'
,
method
:
'post'
,
data
:
{
data
:
{
taskId
,
taskId
,
...
@@ -73,8 +70,7 @@ class TaskService extends Service {
...
@@ -73,8 +70,7 @@ class TaskService extends Service {
async
submit
(
data
)
{
async
submit
(
data
)
{
const
{
submitTaskUrl
,
ctx
}
=
this
;
const
{
submitTaskUrl
,
ctx
}
=
this
;
let
channelType
=
data
.
taskId
.
length
>
20
?
'gsgj'
:
'51gs'
;
const
result
=
await
this
.
_request
(
submitTaskUrl
,
{
const
result
=
await
this
.
_request
(
submitTaskUrl
,
channelType
,
{
method
:
'post'
,
method
:
'post'
,
data
,
data
,
});
});
...
@@ -85,8 +81,7 @@ class TaskService extends Service {
...
@@ -85,8 +81,7 @@ class TaskService extends Service {
async
fetchTask
(
data
)
{
async
fetchTask
(
data
)
{
const
{
fetchTaskUrl
,
ctx
}
=
this
;
const
{
fetchTaskUrl
,
ctx
}
=
this
;
let
channelType
=
data
.
taskId
.
length
>
20
?
'gsgj'
:
'51gs'
;
const
result
=
await
this
.
_request
(
fetchTaskUrl
,
{
const
result
=
await
this
.
_request
(
fetchTaskUrl
,
channelType
,
{
method
:
'post'
,
method
:
'post'
,
data
,
data
,
});
});
...
@@ -97,33 +92,13 @@ class TaskService extends Service {
...
@@ -97,33 +92,13 @@ class TaskService extends Service {
async
getCityList
()
{
async
getCityList
()
{
const
{
cityConfigUrl
,
ctx
}
=
this
;
const
{
cityConfigUrl
,
ctx
}
=
this
;
let
cityLists
=
[];
//对外城市列表
let
cityLists
=
[];
//对外城市列表
let
cityTypeLists
=
[];
//不对外城市列表,含渠道(51/管家)
let
newCityMap
=
new
Map
();
const
newret
=
await
this
.
_request
(
cityConfigUrl
,
'gsgj'
,
{
method
:
'get'
});
const
ret
=
await
this
.
_request
(
cityConfigUrl
,
{
method
:
'get'
});
ctx
.
logger
.
info
(
`【Task】getCityList params gsgj`
,
newret
.
status
,
newret
.
data
.
data
.
length
);
this
.
_checkSuccess
(
newret
);
newret
.
data
.
data
.
map
(
Prov
=>
{
Prov
.
citys
.
map
(
city
=>
{
newCityMap
.
set
(
String
(
city
.
id
),
city
)
})
});
const
ret
=
await
this
.
_request
(
cityConfigUrl
,
'51gs'
,
{
method
:
'get'
});
ctx
.
logger
.
info
(
`【Task】getCityList params 51gs`
,
ret
.
status
,
ret
.
data
.
data
.
length
);
ctx
.
logger
.
info
(
`【Task】getCityList params 51gs`
,
ret
.
status
,
ret
.
data
.
data
.
length
);
this
.
_checkSuccess
(
ret
);
this
.
_checkSuccess
(
ret
);
ret
.
data
.
data
.
map
(
Prov
=>
{
ret
.
data
.
data
.
map
(
Prov
=>
{
let
newProv
=
{
provinceName
:
Prov
.
provinceName
,
citys
:
[]};
let
newProv
=
{
provinceName
:
Prov
.
provinceName
,
citys
:
[]};
Prov
.
citys
.
map
(
city
=>
{
Prov
.
citys
.
map
(
city
=>
{
city
.
type
=
"51gs"
;
if
(
city
.
state
===
-
1
&&
newCityMap
.
get
(
String
(
city
.
id
))
&&
newCityMap
.
get
(
String
(
city
.
id
)).
state
===
1
)
{
city
=
newCityMap
.
get
(
String
(
city
.
id
));
city
.
type
=
"gsgj"
;
ctx
.
logger
.
info
(
'city'
,
city
)
}
if
(
city
.
state
!=
1
)
{
city
.
state
=
-
1
;
}
newProv
.
citys
.
push
({
newProv
.
citys
.
push
({
province
:
city
.
province
,
province
:
city
.
province
,
name
:
city
.
name
,
name
:
city
.
name
,
...
@@ -131,7 +106,6 @@ class TaskService extends Service {
...
@@ -131,7 +106,6 @@ class TaskService extends Service {
state
:
city
.
state
,
state
:
city
.
state
,
queryParam
:
city
.
queryParam
queryParam
:
city
.
queryParam
});
});
ctx
.
app
.
redis
.
set
(
city
.
id
,
city
.
type
,
"EX"
,
3600
)
});
});
cityLists
.
push
(
newProv
);
cityLists
.
push
(
newProv
);
});
});
...
...
config/config.local.js
View file @
cec2e8f7
...
@@ -16,7 +16,6 @@ module.exports = () => {
...
@@ -16,7 +16,6 @@ module.exports = () => {
};
};
config
.
taskAPI
=
{
config
.
taskAPI
=
{
host
:
'http://tm.51gjj.com:6824'
,
host
:
'http://tm.51gjj.com:6824'
,
newhost
:
'http://tt.51gjj.com:7001'
,
fetchHubsUrl
:
''
,
fetchHubsUrl
:
''
,
createTaskUrl
:
'/IncomeTax/createItTask'
,
createTaskUrl
:
'/IncomeTax/createItTask'
,
fetchCodeUrl
:
'/IncomeTax/getItCode'
,
fetchCodeUrl
:
'/IncomeTax/getItCode'
,
...
...
config/config.prod.js
View file @
cec2e8f7
...
@@ -19,7 +19,6 @@ module.exports = () => {
...
@@ -19,7 +19,6 @@ module.exports = () => {
};
};
config
.
taskAPI
=
{
config
.
taskAPI
=
{
host
:
process
.
env
.
TASKAPI_HOST
,
host
:
process
.
env
.
TASKAPI_HOST
,
newhost
:
'http://tt.51gjj.com:7001'
,
fetchHubsUrl
:
''
,
fetchHubsUrl
:
''
,
createTaskUrl
:
'/IncomeTax/createItTask'
,
createTaskUrl
:
'/IncomeTax/createItTask'
,
fetchCodeUrl
:
'/IncomeTax/getItCode'
,
fetchCodeUrl
:
'/IncomeTax/getItCode'
,
...
...
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