team.ts
4.2 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
export async function getHostTeam(
{ sportdtLogo, match }: any) {
if (match.Sportsdt) {
sportdtLogo = `https://data.7m.com.cn/team_data/${match.Sportsdt.SportsdtHostTeamId}/logo_img/club_logo.jpg`
if (match.LotteryId == 73) {
sportdtLogo = `https://bdata.7m.com.cn/basketball_team_data/${match.Sportsdt.SportsdtHostTeamId}/logo_img/club_logo.jpg`
}
if (match.Sportsdt.SportsdtHostTeamId == null) {
sportdtLogo = null
}
}
let result:any={}
result['SportsDtLogo'] = sportdtLogo
result[`LogoFullPath`]= sportdtLogo
result[`Logo`]= sportdtLogo
return result
}
export async function getGuestTeam(
{ sportdtLogo, match }: any) {
if (match.Sportsdt) {
sportdtLogo = `https://data.7m.com.cn/team_data/${match.Sportsdt.SportsdtGuestTeamId}/logo_img/club_logo.jpg`
if (match.LotteryId == 73) {
sportdtLogo = `https://bdata.7m.com.cn/basketball_team_data/${match.Sportsdt.SportsdtGuestTeamId}/logo_img/club_logo.jpg`
}
if (match.Sportsdt.SportsdtGuestTeamId == null) {
sportdtLogo = null
}
}
let result:any={}
result['SportsDtLogo'] = sportdtLogo
result[`LogoFullPath`]= sportdtLogo
result[`Logo`]= sportdtLogo
return result
}
export async function getTeam(
{ lotteryId, id, InfoId, isUpdateCache, sportdtLogo, match, }: any) {
if (match.Sportsdt&&id==match.GuestId) {
sportdtLogo = `https://data.7m.com.cn/team_data/${match.Sportsdt.SportsdtGuestTeamId}/logo_img/club_logo.jpg`
if (match.LotteryId == 73) {
sportdtLogo = `https://bdata.7m.com.cn/basketball_team_data/${match.Sportsdt.SportsdtGuestTeamId}/logo_img/club_logo.jpg`
}
if (match.Sportsdt.SportsdtGuestTeamId == null) {
sportdtLogo = null
}
}else if (match.Sportsdt&&id==match.HostId) {
sportdtLogo = `https://data.7m.com.cn/team_data/${match.Sportsdt.SportsdtHostTeamId}/logo_img/club_logo.jpg`
if (match.LotteryId == 73) {
sportdtLogo = `https://bdata.7m.com.cn/basketball_team_data/${match.Sportsdt.SportsdtHostTeamId}/logo_img/club_logo.jpg`
}
if (match.Sportsdt.SportsdtHostTeamId == null) {
sportdtLogo = null
}
}
let result:any={}
result['SportsDtLogo'] = sportdtLogo
result[`LogoFullPath`]= sportdtLogo
result[`Logo`]= sportdtLogo
return result
// let key = `${config.CachePrefix}match:match_getTeam:v2_${lotteryId}_${id}_${InfoId}`
// let reply:any = await client.getAsync(key);
// if (reply && !isUpdateCache) {
// reply = JSON.parse(reply)
// if (reply != null) {
// reply['SportsDtLogo'] = sportdtLogo
// // if(reply[`LogoFullPath`]==null){
// // reply[`LogoFullPath`]= sportdtLogo
// // }
// reply[`LogoFullPath`]= sportdtLogo
// return reply
// }
// }
// let result: any = {}
// if (id && lotteryId == 73) {
// let t = await Info.db.query(`SELECT
// c.*,b.\`ShortName\` as \`MatchTypeShortName\`, a.\`Id\` as \`Rank\`, a.\`Type\` as \`RankType\`
// FROM \`T_NBAMatch\` t
// join \`T_NBALeagueRank\` a on a.\`MatchSeason\`=t.\`MatchSeason\` and a.\`MatchTypeId\`=t.\`MatchTypeId\`
// JOIN \`T_NBAMatchType\` b ON a.\`MatchTypeId\`=b.\`Id\` AND b.\`ParentId\`=0 AND a.\`MatchSeason\`=t.\`MatchSeason\` and a.\`MatchTypeId\`=t.\`MatchTypeId\`
// JOIN \`T_NBATeam\` c ON a.\`TeamId\`=c.\`Id\` and c.\`Id\`=${id}
// where t.\`Id\`=${InfoId} and c.\`Id\`=${id}
// ORDER BY a.\`Type\`, a.\`Id\`
// `)
// if (t == null || t.length <= 0 || t[0].length <= 0)
// result = {}
// else {
// result = t[0][0];
// }
// } else if (id && lotteryId != 73) {
// let t = await Info.db.query(`select t.*,m.\`ShortName\` as \`MatchTypeShortName\` from \`T_Team\` t left join \`T_MatchType\` m on t.\`MatchTypeId\`=m.\`Id\` where t.\`Id\`=${id}`)
// if (t == null || t.length <= 0 || t[0].length <= 0)
// result = {}
// else {
// result = t[0][0];
// }
// }
// if (result != null) {
// result['SportsDtLogo'] = sportdtLogo
// result[`LogoFullPath`]= sportdtLogo
// // if(result[`LogoFullPath`]==null){
// // result[`LogoFullPath`]= sportdtLogo
// // }
// await client.setAsync(key, JSON.stringify(result))
// client.expire(key, 60 * 60 * 24)
// return result
// }
};