优化worker处理及航线修改为简称
This commit is contained in:
@@ -1,11 +1,42 @@
|
||||
export default function (dynamicData) {
|
||||
let raw_data = dynamicData.raw_data,
|
||||
col_lists = dynamicData.col_lists,
|
||||
airports = dynamicData.airports,
|
||||
citys = dynamicData.citys,
|
||||
airlines = dynamicData.airlines,
|
||||
flightStatus = dynamicData.flightStatus,
|
||||
flightTypes = dynamicData.flightTypes
|
||||
if (typeof Object.assign != 'function') {
|
||||
// Must be writable: true, enumerable: false, configurable: true
|
||||
Object.defineProperty(Object, "assign", {
|
||||
value: function assign(target, varArgs) { // .length of function is 2
|
||||
'use strict';
|
||||
if (target == null) { // TypeError if undefined or null
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
|
||||
var to = Object(target);
|
||||
|
||||
for (var index = 1; index < arguments.length; index++) {
|
||||
var nextSource = arguments[index];
|
||||
|
||||
if (nextSource != null) { // Skip over if undefined or null
|
||||
for (var nextKey in nextSource) {
|
||||
// Avoid bugs when hasOwnProperty is shadowed
|
||||
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
||||
to[nextKey] = nextSource[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return to;
|
||||
},
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
let raw_data = dynamicData.raw_data,
|
||||
col_lists = dynamicData.col_lists,
|
||||
airports = dynamicData.airports,
|
||||
citys = dynamicData.citys,
|
||||
airlines = dynamicData.airlines,
|
||||
flightStatus = dynamicData.flightStatus,
|
||||
flightTypes = dynamicData.flightTypes
|
||||
/**
|
||||
* 时间转换
|
||||
* @param dataString
|
||||
@@ -847,7 +878,11 @@ export default function (dynamicData) {
|
||||
}
|
||||
} else if (preHasValue && reaHasValue) {
|
||||
if (preHasValue === reaHasValue) {
|
||||
render_flight[key] = preHasValue;
|
||||
if (key === 'FLNO') {
|
||||
render_flight[key] = preHasValue + ' / ' + reaHasValue;
|
||||
} else {
|
||||
render_flight[key] = preHasValue;
|
||||
}
|
||||
} else {
|
||||
if (key === 'ERUT') {
|
||||
render_flight[key] = preHasValue.split(' - ').slice(0, -1).join(' - ') + ' - ' + reaHasValue;
|
||||
@@ -886,8 +921,15 @@ export default function (dynamicData) {
|
||||
for (let i = 0; i < erutCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutChnArray.push(citys[cityIndex].cityNameChn);
|
||||
if(airportIndex>-1){
|
||||
if(airports[airportIndex].briefNameChn){
|
||||
erutChnArray.push(airports[airportIndex].briefNameChn);
|
||||
}else{
|
||||
erutChnArray.push(airports[airportIndex].airportNameChn);
|
||||
}
|
||||
}else{
|
||||
erutChnArray.push(erutCodeArray[i]);
|
||||
}
|
||||
} catch (error) {
|
||||
erutChnArray.push(erutCodeArray[i]);
|
||||
}
|
||||
@@ -907,8 +949,15 @@ export default function (dynamicData) {
|
||||
for (let i = 0; i < erutLinkCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutLinkCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutLinkChnArray.push(citys[cityIndex].cityNameChn);
|
||||
if(airportIndex>-1){
|
||||
if(airports[airportIndex].briefNameChn){
|
||||
erutLinkChnArray.push(airports[airportIndex].briefNameChn);
|
||||
}else{
|
||||
erutLinkChnArray.push(airports[airportIndex].airportNameChn);
|
||||
}
|
||||
}else{
|
||||
erutLinkChnArray.push(erutLinkCodeArray[i]);
|
||||
}
|
||||
} catch (error) {
|
||||
erutLinkChnArray.push(erutLinkCodeArray[i]);
|
||||
}
|
||||
@@ -939,8 +988,15 @@ export default function (dynamicData) {
|
||||
for (let i = 0; i < erutPreCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutPreCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutPreChnArray.push(citys[cityIndex].cityNameChn);
|
||||
if(airportIndex>-1){
|
||||
if(airports[airportIndex].briefNameChn){
|
||||
erutPreChnArray.push(airports[airportIndex].briefNameChn);
|
||||
}else{
|
||||
erutPreChnArray.push(airports[airportIndex].airportNameChn);
|
||||
}
|
||||
}else{
|
||||
erutPreChnArray.push(erutPreCodeArray[i]);
|
||||
}
|
||||
} catch (error) {
|
||||
erutPreChnArray.push(erutPreCodeArray[i]);
|
||||
}
|
||||
@@ -961,8 +1017,15 @@ export default function (dynamicData) {
|
||||
for (let i = 0; i < erutReaCodeArray.length; i++) {
|
||||
try {
|
||||
let airportIndex = airports.findIndex(val => val.airportCodeIata === erutReaCodeArray[i]);
|
||||
let cityIndex = citys.findIndex(val => airports[airportIndex].cityId === val.cityId);
|
||||
erutReaChnArray.push(citys[cityIndex].cityNameChn);
|
||||
if(airportIndex>-1){
|
||||
if(airports[airportIndex].briefNameChn){
|
||||
erutReaChnArray.push(airports[airportIndex].briefNameChn);
|
||||
}else{
|
||||
erutReaChnArray.push(airports[airportIndex].airportNameChn);
|
||||
}
|
||||
}else{
|
||||
erutReaChnArray.push(erutReaCodeArray[i]);
|
||||
}
|
||||
} catch (error) {
|
||||
erutReaChnArray.push(erutReaCodeArray[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user