odds100.ts
1021 字节
import _ = require('lodash');
import api_hemera = require('../../../api_hemera');
import moment = require('moment');
import { cache,redis as client, redis, task_lock } from '../../../cache'
async function getOdds100LogByCompany(root:any,args:any,context:any){
//功能:获取单场的欧盘指数单公司赔率变化历史
//接口地址:http://{API_Url}/soccer/?type=gethdaoddslog
try{
let newargs={
gameid:args.sportsdtMatchId,
pid:args.companyId,
}
let result = await api_hemera.query('sport', 'gethdaoddslog', {}, newargs,30,"v1")
result = JSON.stringify(_.map(result.Logs,(log)=>{
return [round(log.Data[0]),
round(log.Data[1]),round(log.Data[2]),moment(parseInt(log.Date)).format("MM-DD HH:mm")]
}))
return result
} catch (e) {
console.info(e);
return []
}
}
function round(value:any) {
return (Math.round(value * 100) / 100).toFixed(2)
}
export {getOdds100LogByCompany}