AnalyService.go 14.5 KB
Newer Older
M
monomania 已提交
1 2 3 4 5 6
package service

import (
	"fmt"
	"math"
	"strconv"
M
monomania 已提交
7
	"strings"
8
	"tesou.io/platform/foot-parent/foot-api/common/base"
9
	"tesou.io/platform/foot-parent/foot-api/common/base/pojo"
10
	entity5 "tesou.io/platform/foot-parent/foot-api/module/analy/pojo"
11
	"tesou.io/platform/foot-parent/foot-api/module/analy/vo"
12 13
	entity2 "tesou.io/platform/foot-parent/foot-api/module/match/pojo"
	entity3 "tesou.io/platform/foot-parent/foot-api/module/odds/pojo"
M
monomania 已提交
14
	"tesou.io/platform/foot-parent/foot-core/common/base/service/mysql"
M
monomania 已提交
15
	"tesou.io/platform/foot-parent/foot-core/common/utils"
S
shi.zeyuan 已提交
16
	"tesou.io/platform/foot-parent/foot-core/module/analy/constants"
S
shi.zeyuan 已提交
17 18 19
	service3 "tesou.io/platform/foot-parent/foot-core/module/elem/service"
	service2 "tesou.io/platform/foot-parent/foot-core/module/match/service"
	"tesou.io/platform/foot-parent/foot-core/module/odds/service"
M
monomania 已提交
20 21 22
	"time"
)

23 24 25 26 27 28 29 30 31 32
type AnalyInterface interface {
	ModelName() string

	Analy_Near()

	Analy(analyAll bool)

	analyStub(v *entity2.MatchLast) (int, *entity5.AnalyResult)
}

M
monomania 已提交
33
type AnalyService struct {
S
shi.zeyuan 已提交
34 35
	mysql.BaseService
	service.EuroHisService
M
monomania 已提交
36
	service.EuroTrackService
M
monomania 已提交
37
	service.AsiaHisService
S
shi.zeyuan 已提交
38
	service2.MatchLastService
M
monomania 已提交
39
	service2.MatchHisService
S
shi.zeyuan 已提交
40
	service3.LeagueService
41
	//是否打印赔率数据
M
monomania 已提交
42 43
	PrintOddData bool
}
S
shi.zeyuan 已提交
44

S
shi.zeyuan 已提交
45 46
func (this *AnalyService) Find(matchId string, alFlag string) *entity5.AnalyResult {
	data := entity5.AnalyResult{MatchId: matchId, AlFlag: alFlag}
47
	mysql.GetEngine().Get(&data)
M
monomania 已提交
48 49 50
	return &data
}

51 52
func (this *AnalyService) FindAll() []*entity5.AnalyResult {
	dataList := make([]*entity5.AnalyResult, 0)
S
shi.zeyuan 已提交
53 54 55 56
	mysql.GetEngine().OrderBy("CreateTime Desc").Find(&dataList)
	return dataList
}

57
func (this *AnalyService) Analy(analyAll bool, thiz AnalyInterface) {
58 59
	var matchList []*entity2.MatchLast
	if analyAll {
60
		var currentPage,pageSize int64 = 1,1000
61 62 63 64 65 66 67 68 69 70
		var page *pojo.Page
		page = new(pojo.Page)
		page.PageSize = pageSize
		page.CurPage = currentPage
		matchList = make([]*entity2.MatchLast, 0)
		err := this.MatchHisService.PageSql("select mh.* from foot.t_match_his mh ", page, &matchList)
		if nil != err {
			base.Log.Error(err)
			return
		}
71
		go this.Analy_Process(matchList, thiz)
72 73 74 75 76 77 78 79 80 81 82
		for currentPage <= page.TotalPage {
			currentPage++
			page = new(pojo.Page)
			page.PageSize = pageSize
			page.CurPage = currentPage
			matchList = make([]*entity2.MatchLast, 0)
			err := this.MatchHisService.PageSql("select mh.* from foot.t_match_his mh", page, &matchList)
			if nil != err {
				base.Log.Error(err)
				continue
			}
83
			go this.Analy_Process(matchList, thiz)
84 85 86
		}
	} else {
		matchList = this.MatchLastService.FindNotFinished()
87
		this.Analy_Process(matchList, thiz)
88
	}
89

90 91 92 93
}

func (this *AnalyService) Analy_Near(thiz AnalyInterface) {
	matchList := this.MatchLastService.FindNear()
94
	this.Analy_Process(matchList, thiz)
95 96 97 98 99 100 101 102 103 104 105 106 107 108
}

/**
汇总结果并输出,且持久化
 */
func (this *AnalyService) Analy_Process(matchList []*entity2.MatchLast, thiz AnalyInterface) {
	hit_count_str := utils.GetVal(constants.SECTION_NAME, "hit_count")
	hit_count, _ := strconv.Atoi(hit_count_str)
	data_list_slice := make([]interface{}, 0)
	data_modify_list_slice := make([]interface{}, 0)
	var rightCount = 0
	var errorCount = 0

	for _, v := range matchList {
109
		stub, temp_data := thiz.analyStub(v)
110

111 112
		if nil != temp_data {
			if strings.EqualFold(temp_data.Result, "命中") {
113 114
				rightCount++
			}
115
			if strings.EqualFold(temp_data.Result, "错误") {
116 117 118 119 120
				errorCount++
			}
		}

		if stub == 0 || stub == 1 {
121
			temp_data.TOVoid = false
122 123
			hours := v.MatchDate.Sub(time.Now()).Hours()
			if hours > 0 {
124
				temp_data.THitCount = hit_count
125
			} else {
126
				temp_data.THitCount = 1
127 128
			}
			if stub == 0 {
129
				data_list_slice = append(data_list_slice, temp_data)
130
			} else if stub == 1 {
131
				data_modify_list_slice = append(data_modify_list_slice, temp_data)
132
			}
133 134 135 136 137
		} else if nil != temp_data {
			temp_data.TOVoid = true
			if len(temp_data.Id) > 0 {
				if temp_data.HitCount >= hit_count {
					temp_data.HitCount = (hit_count / 2) - 1
138
				} else {
139
					temp_data.HitCount = 0
140
				}
141
				data_modify_list_slice = append(data_modify_list_slice, temp_data)
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
			}
		}
	}

	base.Log.Info("------------------")
	base.Log.Info("------------------")
	base.Log.Info("------------------")
	base.Log.Info("GOOOO场次:", rightCount)
	base.Log.Info("X0000场次:", errorCount)
	base.Log.Info("------------------")

	this.SaveList(data_list_slice)
	this.ModifyList(data_modify_list_slice)
}

M
monomania 已提交
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
/**
C1使用的检查是否存在其他模型存在互斥选项
 */
func (this *AnalyService) FindOtherAlFlag(matchId string, alFlag string, preResult int) bool {
	sql_build := `
SELECT 
  ar.* 
FROM
  foot.t_analy_result ar 
WHERE ar.MatchId = ? 
  AND ar.AlFlag != ? 
  AND ar.PreResult != ?
     `
	//结果值
	entitys := make([]*vo.AnalyResultVO, 0)
	//执行查询
	mysql.GetEngine().SQL(sql_build, matchId, alFlag, preResult).Find(&entitys)
	if len(entitys) > 0 {
		return true
	}
	return false
}
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208

/**
更新结果
 */
func (this *AnalyService) ModifyAllResult() {
	sql_build := `
SELECT 
  ar.* 
FROM
  foot.t_analy_result ar 
     `
	//结果值
	entitys := make([]*entity5.AnalyResult, 0)
	//执行查询
	this.FindBySQL(sql_build, &entitys)

	if len(entitys) <= 0 {
		return
	}
	for _, e := range entitys {
		aList := this.AsiaHisService.FindByMatchIdCompId(e.MatchId, constants.DEFAULT_REFER_ASIA)
		if nil == aList || len(aList) < 1 {
			aList = make([]*entity3.AsiaHis, 1)
			aList[0] = new(entity3.AsiaHis)
		}
		his := this.MatchHisService.FindById(e.MatchId)
		if nil == his {
			continue
		}
		last := new(entity2.MatchLast)
M
monomania 已提交
209
		last.Id = his.Id
210 211 212 213 214 215 216
		last.MatchDate = his.MatchDate
		last.DataDate = his.DataDate
		last.LeagueId = his.LeagueId
		last.MainTeamId = his.MainTeamId
		last.MainTeamGoals = his.MainTeamGoals
		last.GuestTeamId = his.GuestTeamId
		last.GuestTeamGoals = his.GuestTeamGoals
217
		if strings.EqualFold(e.AlFlag, "E2") || strings.EqualFold(e.AlFlag, "C1") || strings.EqualFold(e.AlFlag, "C2") {
218
			//E2使用特别自身的验证结果方法
M
monomania 已提交
219
			e.Result = this.IsRight2Option(last, e)
220 221 222 223 224 225 226
		} else {
			e.Result = this.IsRight(last, e)
		}
		this.Modify(e)
	}
}

S
shi.zeyuan 已提交
227 228 229
/**
更新结果
 */
M
monomania 已提交
230 231 232 233 234 235
func (this *AnalyService) ModifyResult() {
	sql_build := `
SELECT 
  ar.* 
FROM
  foot.t_analy_result ar 
M
monomania 已提交
236
WHERE DATE_ADD(ar.MatchDate, INTERVAL 6 HOUR) > NOW()
M
monomania 已提交
237 238 239 240 241 242 243 244 245 246
     `
	//结果值
	entitys := make([]*entity5.AnalyResult, 0)
	//执行查询
	this.FindBySQL(sql_build, &entitys)

	if len(entitys) <= 0 {
		return
	}
	for _, e := range entitys {
S
shi.zeyuan 已提交
247
		aList := this.AsiaHisService.FindByMatchIdCompId(e.MatchId, constants.DEFAULT_REFER_ASIA)
248
		if nil == aList || len(aList) < 1 {
249 250
			aList = make([]*entity3.AsiaHis, 1)
			aList[0] = new(entity3.AsiaHis)
M
monomania 已提交
251 252 253 254 255 256
		}
		his := this.MatchHisService.FindById(e.MatchId)
		if nil == his {
			continue
		}
		last := new(entity2.MatchLast)
M
monomania 已提交
257
		last.Id = his.Id
M
monomania 已提交
258 259 260 261 262 263 264
		last.MatchDate = his.MatchDate
		last.DataDate = his.DataDate
		last.LeagueId = his.LeagueId
		last.MainTeamId = his.MainTeamId
		last.MainTeamGoals = his.MainTeamGoals
		last.GuestTeamId = his.GuestTeamId
		last.GuestTeamGoals = his.GuestTeamGoals
S
1.xxxxx  
shi.zeyuan 已提交
265
		if strings.EqualFold(e.AlFlag, "E2") || strings.EqualFold(e.AlFlag, "C1") || strings.EqualFold(e.AlFlag, "C2") {
S
shi.zeyuan 已提交
266
			//E2使用特别自身的验证结果方法
M
monomania 已提交
267
			e.Result = this.IsRight2Option(last, e)
M
monomania 已提交
268 269
		} else {
			e.Result = this.IsRight(last, e)
S
1.xx  
shi.zeyuan 已提交
270
		}
M
monomania 已提交
271 272 273 274
		this.Modify(e)
	}
}

275 276 277 278 279
/**
获取可发布的数据项
1.预算结果是主队
2.比赛未开始
3.比赛未结束
280 281
4.alName 算法名称,默认为Euro81_616Service ;
5.option 3(只筛选主队),1(只筛选平局),0(只筛选客队)选项
282
*/
S
shi.zeyuan 已提交
283
func (this *AnalyService) List(alName string, hitCount int, option int) []*vo.AnalyResultVO {
S
shi.zeyuan 已提交
284 285 286 287 288 289 290 291 292 293 294 295
	sql_build := `
SELECT 
  l.Name as LeagueName,
  ml.MainTeamId,
  ml.GuestTeamId,
  ar.* 
FROM
  foot.t_match_last ml,
  foot.t_league l,
  foot.t_analy_result ar 
WHERE ml.LeagueId = l.Id 
  AND ml.Id = ar.MatchId 
M
monomania 已提交
296
  AND ar.HitCount >= THitCount
M
1xxx  
monomania 已提交
297
  AND ar.MatchDate > NOW()4e43
S
shi.zeyuan 已提交
298
     `
299 300

	if len(alName) > 0 {
S
shi.zeyuan 已提交
301
		sql_build += " AND ar.AlFlag = '" + alName + "' "
302 303
	}
	if hitCount > 0 {
S
shi.zeyuan 已提交
304
		sql_build += " AND ar.HitCount >= " + strconv.Itoa(hitCount)
M
monomania 已提交
305
	} else {
S
shi.zeyuan 已提交
306
		sql_build += " AND ar.HitCount > 0 "
307
	}
M
monomania 已提交
308
	if option >= 0 {
S
shi.zeyuan 已提交
309
		sql_build += " AND ar.PreResult = " + strconv.Itoa(option) + " "
310
	}
S
shi.zeyuan 已提交
311
	sql_build += " ORDER BY ar.MatchDate ASC ,ar.PreResult DESC  "
M
monomania 已提交
312
	//结果值
313
	entitys := make([]*vo.AnalyResultVO, 0)
M
monomania 已提交
314
	//执行查询
S
shi.zeyuan 已提交
315
	this.FindBySQL(sql_build, &entitys)
M
monomania 已提交
316 317
	return entitys
}
S
shi.zeyuan 已提交
318

319
//测试加载数据
S
shi.zeyuan 已提交
320
func (this *AnalyService) LoadByMatchId(matchId string) []*entity5.AnalyResult {
S
shi.zeyuan 已提交
321 322 323 324 325 326 327 328 329 330 331 332 333 334
	sql_build := `
SELECT 
  ml.*,
  bc.id,
  bc.name AS compName,
  el.* 
FROM
  t_match_last ml,
  t_euro_last el,
  t_comp bc 
WHERE ml.id = el.matchid 
  AND el.compid = bc.id 
	`
	sql_build += "  AND ml.id = '" + matchId + "' "
335 336 337
	//结果值
	entitys := make([]*entity5.AnalyResult, 0)
	//执行查询
S
shi.zeyuan 已提交
338
	this.FindBySQL(sql_build, &entitys)
339
	return entitys
M
monomania 已提交
340 341
}

S
1.xxx  
shi.zeyuan 已提交
342 343 344 345
//测试加载数据
func (this *AnalyService) DelTovoidData() {
	//E2 C1 不可删除
	sql_build := `
M
1.xxxx  
monomania 已提交
346
DELETE FROM foot.t_analy_result  WHERE AlFlag IN ("E1","Q1") AND TOVoid IS TRUE
S
1.xxx  
shi.zeyuan 已提交
347 348 349 350 351 352 353
	`
	_, err := mysql.GetEngine().Exec(sql_build)
	if nil != err {
		base.Log.Error("DelTovoidData" + err.Error())
	}
}

M
1.xxx  
monomania 已提交
354
func (this *AnalyService) IsRight2Option(last *entity2.MatchLast, analy *entity5.AnalyResult) string {
M
monomania 已提交
355 356 357
	if strings.EqualFold(analy.MatchId, "1826976") {
		fmt.Println("--")
	}
M
monomania 已提交
358 359
	//比赛结果
	var globalResult int
M
1.xxx  
monomania 已提交
360
	if utils.GetHourDiffer(time.Now(), last.MatchDate) < 2 {
M
monomania 已提交
361 362 363
		//比赛未结束
		globalResult = -1
	} else {
M
1.xxx  
monomania 已提交
364
		if last.MainTeamGoals > last.GuestTeamGoals {
M
monomania 已提交
365
			globalResult = 3
M
1.xxx  
monomania 已提交
366
		} else if last.MainTeamGoals < last.GuestTeamGoals {
M
monomania 已提交
367 368 369 370 371 372 373 374 375 376 377 378 379
			globalResult = 0
		} else {
			globalResult = 1
		}
	}
	var resultFlag string
	if globalResult == -1 {
		resultFlag = constants.UNCERTAIN
	} else if globalResult == analy.PreResult || globalResult == 1 {
		resultFlag = constants.HIT
	} else {
		resultFlag = constants.UNHIT
	}
M
1.xxx  
monomania 已提交
380 381
	analy.Result = resultFlag
	league := this.LeagueService.FindById(last.LeagueId)
382
	if this.IsCupMatch(league.Name) {
M
1.xxx  
monomania 已提交
383
		analy.TOVoid = true
S
1.xxx  
shi.zeyuan 已提交
384
		analy.TOVoidDesc = "杯赛"
385
	} else {
M
monomania 已提交
386
		analy.TOVoidDesc = ""
M
1.xxx  
monomania 已提交
387
	}
M
monomania 已提交
388 389

	//打印数据
M
1.xxx  
monomania 已提交
390 391
	matchDateStr := last.MatchDate.Format("2006-01-02 15:04:05")
	base.Log.Info("比赛Id:" + last.Id + ",比赛时间:" + matchDateStr + ",联赛:" + league.Name + ",对阵:" + last.MainTeamId + "(" + strconv.FormatFloat(analy.LetBall, 'f', -1, 64) + ")" + last.GuestTeamId + ",预算结果:" + strconv.Itoa(analy.PreResult) + ",已得结果:" + strconv.Itoa(last.MainTeamGoals) + "-" + strconv.Itoa(last.GuestTeamGoals) + " (" + resultFlag + ")")
M
monomania 已提交
392 393 394
	return resultFlag
}

M
monomania 已提交
395
func (this *AnalyService) IsCupMatch(leagueName string) bool {
396
	if strings.Contains(leagueName, "杯") || strings.Contains(leagueName, "锦") {
M
monomania 已提交
397 398 399 400 401
		return true;
	}
	return false;
}

S
shi.zeyuan 已提交
402
func (this *AnalyService) IsRight(last *entity2.MatchLast, analy *entity5.AnalyResult) string {
403
	//比赛结果
S
shi.zeyuan 已提交
404
	globalResult := this.ActualResult(last, analy)
405 406
	var resultFlag string
	if globalResult == -1 {
S
shi.zeyuan 已提交
407
		resultFlag = constants.UNCERTAIN
S
shi.zeyuan 已提交
408
	} else if globalResult == analy.PreResult {
S
shi.zeyuan 已提交
409
		resultFlag = constants.HIT
410
	} else if globalResult == 1 {
S
shi.zeyuan 已提交
411
		resultFlag = constants.WALKING_PLATE
412
	} else {
S
shi.zeyuan 已提交
413
		resultFlag = constants.UNHIT
414
	}
M
1.xxx  
monomania 已提交
415
	analy.Result = resultFlag
416

S
shi.zeyuan 已提交
417
	league := this.LeagueService.FindById(last.LeagueId)
418
	if this.IsCupMatch(league.Name) {
M
1.xxx  
monomania 已提交
419
		analy.TOVoid = true
420
		analy.TOVoidDesc = "杯赛"
421
	} else {
M
monomania 已提交
422
		analy.TOVoidDesc = ""
M
1.xxx  
monomania 已提交
423 424 425
	}

	//打印数据
S
shi.zeyuan 已提交
426 427
	matchDate := last.MatchDate.Format("2006-01-02 15:04:05")
	base.Log.Info("比赛Id:" + last.Id + ",比赛时间:" + matchDate + ",联赛:" + league.Name + ",对阵:" + last.MainTeamId + "(" + strconv.FormatFloat(analy.LetBall, 'f', -1, 64) + ")" + last.GuestTeamId + ",预算结果:" + strconv.Itoa(analy.PreResult) + ",已得结果:" + strconv.Itoa(last.MainTeamGoals) + "-" + strconv.Itoa(last.GuestTeamGoals) + " (" + resultFlag + ")")
428 429 430
	return resultFlag
}

M
monomania 已提交
431
/**
432
比赛的实际结果计算
433
*/
S
shi.zeyuan 已提交
434
func (this *AnalyService) ActualResult(last *entity2.MatchLast, analy *entity5.AnalyResult) int {
435
	var result int
M
monomania 已提交
436
	if utils.GetHourDiffer(time.Now(), last.MatchDate) < 2 {
M
monomania 已提交
437
		//比赛未结束
438
		return -1
M
monomania 已提交
439 440 441
	}

	var mainTeamGoals float64
M
monomania 已提交
442
	elb_sum := analy.LetBall
M
monomania 已提交
443
	if elb_sum > 0 {
S
shi.zeyuan 已提交
444
		mainTeamGoals = float64(last.MainTeamGoals) - math.Abs(elb_sum)
M
monomania 已提交
445
	} else {
S
shi.zeyuan 已提交
446
		mainTeamGoals = float64(last.MainTeamGoals) + math.Abs(elb_sum)
M
monomania 已提交
447
	}
S
shi.zeyuan 已提交
448
	//diff_goals := float64(last.MainTeamGoals-last.GuestTeamGoals) - elb_sum
M
monomania 已提交
449 450 451
	//if diff_goals <= 0.25 && diff_goals >= -0.25 {
	//	result = 1
	//}
S
shi.zeyuan 已提交
452
	if mainTeamGoals > float64(last.GuestTeamGoals) {
S
shi.zeyuan 已提交
453
		result = constants.WIN
S
shi.zeyuan 已提交
454
	} else if mainTeamGoals < float64(last.GuestTeamGoals) {
S
shi.zeyuan 已提交
455
		result = constants.LOST
M
monomania 已提交
456
	} else {
S
shi.zeyuan 已提交
457
		result = constants.DRAW
M
monomania 已提交
458 459 460 461 462 463 464
	}
	return result
}

/**
1.欧赔是主降还是主升 主降为true
*/
M
2.xxx  
monomania 已提交
465 466 467 468 469 470 471 472 473 474 475
func (this *AnalyService) EuroDirection(e81 *entity3.EuroHis, e616 *entity3.EuroHis) int {
	//val_diff := 0.3
	//e81_3_diff := math.Abs(e81.Ep3 - e81.Sp3)
	//e81_0_diff := math.Abs(e81.Ep0 - e81.Sp0)
	e81_ep3_small := e81.Ep3 <= e81.Sp3
	e81_ep0_small := e81.Ep0 <= e81.Sp0
	//e616_3_diff := math.Abs(e616.Ep3 - e616.Sp3)
	//e616_0_diff := math.Abs(e616.Ep0 - e616.Sp0)
	e616_ep3_small := e616.Ep3 <= e616.Sp3
	e616_ep0_small := e616.Ep0 <= e616.Sp0

M
1.xxx  
monomania 已提交
476
	if e616_ep3_small && e81_ep3_small && e616.Ep3 <= e81.Ep3 {
M
monomania 已提交
477
		return 3
M
2.xxx  
monomania 已提交
478
	}
M
1.xxx  
monomania 已提交
479
	if e616_ep0_small && e81_ep0_small && e616.Ep0 <= e81.Ep0 {
M
monomania 已提交
480 481
		return 0
	}
M
2.xxx  
monomania 已提交
482
	return -1
M
monomania 已提交
483 484 485 486 487
}

/**
2.亚赔是主降还是主升 主降为true
*/
M
2.xxx  
monomania 已提交
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
func (this *AnalyService) AsiaDirectionMulti(matchId string) int {
	aList := this.AsiaHisService.FindByMatchIdCompId(matchId, "Crown", "明陞", "金宝博", "12bet", "盈禾", "18Bet")
	if len(aList) < 3 {
		return -1
	}

	var mainCount, guestCount int
	for _, e := range aList {
		direction := this.AsiaDirection(e)
		if direction == 3 {
			mainCount++
		} else if direction == 0 {
			guestCount++
		}
	}

	if mainCount-guestCount > 1 {
		return 3
	}
	if mainCount-guestCount < -1 {
		return 0
	}
	return -1
}

/**
2.亚赔是主降还是主升 主降为true
*/
func (this *AnalyService) AsiaDirection(ahis *entity3.AsiaHis) int {
	mark := -1
M
monomania 已提交
518 519
	slb := ahis.SLetBall
	elb := ahis.ELetBall
M
2.xxx  
monomania 已提交
520 521
	ep3_small := ahis.Ep3 < ahis.Sp3
	ep0_small := ahis.Ep0 < ahis.Sp0
M
monomania 已提交
522 523
	if elb > 0 {
		if elb > slb {
M
2.xxx  
monomania 已提交
524
			mark = 3
M
monomania 已提交
525
		} else if elb < slb {
M
2.xxx  
monomania 已提交
526
			mark = 0
M
monomania 已提交
527 528
		} else {
			//初始让球和即时让球一致
M
2.xxx  
monomania 已提交
529 530 531 532
			if ep3_small && !ep0_small {
				mark = 3
			} else if !ep3_small && ep0_small {
				mark = 0
M
monomania 已提交
533 534
			}
		}
S
shi.zeyuan 已提交
535
	} else {
M
monomania 已提交
536
		if elb < slb {
M
2.xxx  
monomania 已提交
537
			mark = 0
M
monomania 已提交
538
		} else if elb > slb {
M
2.xxx  
monomania 已提交
539
			mark = 3
M
monomania 已提交
540 541
		} else {
			//初始让球和即时让球一致
M
2.xxx  
monomania 已提交
542 543 544 545
			if ep3_small && !ep0_small {
				mark = 3
			} else if !ep3_small && ep0_small {
				mark = 0
M
monomania 已提交
546
			}
M
monomania 已提交
547 548
		}
	}
M
2.xxx  
monomania 已提交
549
	return mark
M
monomania 已提交
550 551
}

S
shi.zeyuan 已提交
552 553 554
/**
float64保留两位小数
 */
M
monomania 已提交
555 556 557 558
func Decimal(value float64) float64 {
	value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64)
	return value
}