import { _pushSuccess } from "../app" ; import { parserChinaRank , parseWorldRank } from "../utils/task" ; import { getTime } from 'date-fns' ; import { axios } from "../utils/axios" ; desc export const getChinaRank = async ( socket , data , channel , eventName ) => { axios . get ( 'https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5&callback=' ) . then ( async ( res ) => { if ( res . ret === 0 ) { const allData = JSON . parse ( res . data || { } ) ; const chinaRank = parserChinaRank ( allData . areaTree [ 0 ] ) ; await _pushSuccess ( channel , eventName , chinaRank ) ; res = null ; } } ) . catch ( ( err ) => { console . info ( 'getChinaRank' , err ) ; } ) ; } ; desc export const getWorldRank = async ( socket , data , channel , eventName ) => { axios . get ( 'https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5&callback=' ) . then ( async ( res ) => { if ( res . ret === 0 ) { const allData = JSON . parse ( res . data || { } ) ; const worldRank = parseWorldRank ( allData . areaTree ) ; await _pushSuccess ( channel , eventName , worldRank ) ; res = null ; } } ) . catch ( ( err ) => { console . info ( 'getWorldRank' , err ) ; } ) ; } ; desc export const getChinaDay = async ( socket , data , channel , eventName ) => { axios . get ( 'https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5&callback=' ) . then ( async ( res ) => { if ( res . ret === 0 ) { const allData = JSON . parse ( res . data || { } ) ; const chinaDayList = allData . chinaDayList ; await _pushSuccess ( channel , eventName , chinaDayList , getTime ( new Date ( ) ) ) ; res = null ; } } ) . catch ( ( err ) => { console . info ( 'getChinaDay' , err ) ; } ) ; } ;