request-api.js
3.3 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import http from "@/utils/http.js";
import utils from "@/utils/utils.js";
const request_api = {
// 获取关注数据
async getFollowList() {
let query_data = `query{
info_get_attentions(type_name:"比赛",type_id:1,order:[["created_at","DESC"]]){
error success error_type rows
}
getlivedata
liveScore(lotId:73,matchState:"进行中",limit:50){
count
matchs {
Sportsdt {
SportsdtMatchId
}
YiqiuMatchId
QcBf
MatchState
HostName
GuestName
HostTeam{LogoFullPath}
GuestTeam{LogoFullPath}
}
}
}`
let result = await http.gql({
query: query_data
})
console.info("-->" + JSON.stringify(result.data));
var rows = result.data.info_get_attentions.rows;
var liveData = result.data.getlivedata.LiveData;
console.info(rows);
if (rows) {
for (let attention of rows) {
console.log(attention)
if (attention.target_base_data) {
console.log(attention.target_base_data)
// if(attention.target_base_data.validGame == 1) {
if (utils.dateFormat(attention.target_base_data.Date).indexOf(utils.dateFormatYear(Date
.now())) !== -1) {
if (liveData[attention.target_code]) {
if (attention.target_type_name == "足球") {
attention.target_base_data.Half = liveData[attention.target_code].Half
attention.target_base_data.RedCard = liveData[attention.target_code].RedCard
attention.target_base_data.YellowCard = liveData[attention.target_code]
.YellowCard
attention.target_base_data.Status = liveData[attention.target_code].Status
attention.target_base_data.ScoreAll = liveData[attention.target_code].ScoreAll
var currStateTime = result.data.getlivedata.current_time - liveData[attention
.target_code].TStartTime
attention.target_base_data.MatchState = utils.getCurrentState(liveData[attention
.target_code].Status, currStateTime)
}
}
}
// }
}
}
var followList = [];
for (let attention of rows) {
var data = {}
data.YiqiuMatchId = attention.target_base_data.yiqiu_id
data.Sportsdt.SportsdtMatchId = attention.target_code
data.HostName = attention.target_base_data.HomeTeam.Name
data.GuestName = attention.target_base_data.AwayTeam.Name
data.HostTeam.LogoFullPath = attention.target_base_data.HomeTeam.Photo
data.GuestTeam.LogoFullPath = attention.target_base_data.AwayTeam.Photo
data.MatchState = attention.target_base_data.Status
data.MatchTime = attention.target_base_data.Date
data.BcBf = attention.target_base_data.Half
data.QcBf = attention.target_base_data.Score[0] + "-" + attention.target_base_data.Score[1]
data.isFollow = true
console.log(data)
followList.push(data)
}
}
return followList;
},
async getMatchList() {
let query_data = `query{
liveScore(lotId:72,matchState: "未") {
count
matchs {
MatchTime
MatchState
IssueName
GameName
HostName
GuestName
YiqiuMatchId
}
}
}`
let result = await http.gql({
query: query_data
})
console.info(result);
return result.data.liveScore.matchs;
}
}
export default request_api;