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
c373f0fa
Commit
c373f0fa
authored
Mar 14, 2019
by
何娜
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
3a3f3fef
b0ae472b
Pipeline
#4464
passed with stage
in 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
95 deletions
+0
-95
cityList.js
app/schedule/cityList.js
+0
-95
No files found.
app/schedule/cityList.js
deleted
100644 → 0
View file @
3a3f3fef
'use strict'
;
module
.
exports
=
{
schedule
:
{
interval
:
'24*60m'
,
// 5分钟间隔
type
:
'all'
,
// 所有woker
immediate
:
true
,
},
async
task
(
ctx
)
{
try
{
const
{
host
,
newhost
,
cityConfigUrl
}
=
ctx
.
app
.
config
.
taskAPI
;
let
cityLists
=
[];
//对外城市列表
let
cityTypeLists
=
[];
//不对外城市列表,含渠道(51/管家)
let
newCityMap
=
new
Map
();
let
cityMap
=
new
Map
();
const
newret
=
await
ctx
.
curl
(
newhost
+
cityConfigUrl
,
{
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
contentType
:
'json'
,
gzip
:
true
});
ctx
.
logger
.
info
(
'cityList--newhost'
,
newhost
,
JSON
.
stringify
(
newret
.
data
.
code
));
if
(
newret
.
data
.
code
===
0
)
{
ctx
.
logger
.
info
(
'newret-start'
)
newret
.
data
.
data
.
map
(
Prov
=>
{
Prov
.
citys
.
map
(
city
=>
{
newCityMap
.
set
(
String
(
city
.
id
),
city
)
})
})
ctx
.
logger
.
info
(
'newCityMap'
)
}
else
{
ctx
.
logger
.
info
(
'newCityMap- fail'
)
}
const
ret
=
await
ctx
.
curl
(
host
+
cityConfigUrl
,
{
charset
:
'utf-8'
,
timeout
:
[
'30s'
,
'30s'
],
dataType
:
'json'
,
contentType
:
'json'
,
gzip
:
true
});
ctx
.
logger
.
info
(
'cityList--host'
,
host
,
JSON
.
stringify
(
ret
.
data
.
code
));
if
(
ret
.
data
.
code
===
0
)
{
cityLists
=
[];
cityTypeLists
=
[];
ctx
.
logger
.
info
(
'start'
)
ret
.
data
.
data
.
map
(
Prov
=>
{
ctx
.
logger
.
info
(
'newProv'
)
let
newProv
=
{
provinceName
:
Prov
.
provinceName
,
citys
:
[]};
Prov
.
citys
.
map
(
city
=>
{
ctx
.
logger
.
info
(
'51gs'
)
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
)
}
cityMap
.
set
(
String
(
city
.
id
),
city
);
if
(
city
.
state
!=
1
)
{
city
.
state
=
-
1
;
ctx
.
logger
.
info
(
'state'
)
}
newProv
.
citys
.
push
({
province
:
city
.
province
,
name
:
city
.
name
,
id
:
city
.
id
,
state
:
city
.
state
,
queryParam
:
city
.
queryParam
});
ctx
.
logger
.
info
(
'newProv-push'
)
cityTypeLists
.
push
({
province
:
city
.
province
,
name
:
city
.
name
,
id
:
city
.
id
,
state
:
city
.
state
,
type
:
city
.
type
,
});
ctx
.
logger
.
info
(
'cityTypeLists-push'
)
});
ctx
.
logger
.
info
(
'newProv-end'
)
cityLists
.
push
(
newProv
);
});
ctx
.
logger
.
info
(
'cityLists'
,
cityLists
.
length
,
'cityTypeLists'
,
cityTypeLists
[
0
])
ctx
.
app
.
cityLists
=
cityLists
;
ctx
.
app
.
cityTypeLists
=
cityTypeLists
;
}
else
{
ctx
.
logger
.
info
(
'拉配置出错'
)
}
}
catch
(
e
)
{
ctx
.
logger
.
error
(
'【schedule/cityList】catch error:'
,
JSON
.
stringify
(
e
));
}
}
};
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