nm_match_api.ts
2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { default as axios } from 'axios';
const api_url = process.env.VUE_APP_BASE_API;
const common_option = { headers: { 'Content-Type': 'application/json' } };
axios.defaults.timeout = 1000 * 20;
//获取赛事实时详情接口
export async function nm_match_live_detail ({ yiqiu_id = 0 }) {
if(!yiqiu_id||yiqiu_id==0){
return {}
}
const query = `
query{
nm_match_live_detail(yiqiu_match_id:${yiqiu_id})
}
`;
let result = await axios.post(api_url+"/nm_match_live_detail", `{"query":${JSON.stringify(query)},"variables":null}`, common_option);
let match = result?.data?.data?.nm_match_live_detail;
if (match == null || match.error != null) {
return {};
}
return match;
}
//获取赛事详情接口
export async function nm_match_detail ({ yiqiu_id = 0 }) {
if(!yiqiu_id||yiqiu_id==0){
return {}
}
const query = `
query{
nm_match_detail(yiqiu_match_id:${yiqiu_id})
}
`;
let result = await axios.post(api_url+"/nm_match_detail", `{"query":${JSON.stringify(query)},"variables":null}`, common_option);
let match = result?.data?.data?.nm_match_detail;
if (match == null || match.error != null) {
return {};
}
return match;
}
//获取赛事实时动态图标接口
export async function nm_match_trend ({ yiqiu_id = 0 }) {
const query = `
query{
nm_match_trend(yiqiu_match_id:${yiqiu_id})
}
`;
let result = await axios.post(api_url+"/nm_match_trend", `{"query":${JSON.stringify(query)},"variables":null}`, common_option);
let match = result?.data?.data?.nm_match_trend;
if (match == null || match.error != null) {
return {};
}
return match;
}
//获取赛事实时动态对阵接口
export async function nm_match_lineup ({ yiqiu_id = 0 }) {
const query = `
query{
nm_match_lineup(yiqiu_match_id:${yiqiu_id})
}
`;
let result = await axios.post(api_url+"/nm_match_lineup", `{"query":${JSON.stringify(query)},"variables":null}`, common_option);
let match = result?.data?.data?.nm_match_lineup;
if (match == null || match.error != null) {
return {};
}
return match;
}