A2Service.go 3.4 KB
Newer Older
S
1.xxxx  
shi.zeyuan 已提交
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
package service

import (
	"math"
	"strings"
	"tesou.io/platform/foot-parent/foot-api/common/base"
	entity5 "tesou.io/platform/foot-parent/foot-api/module/analy/pojo"
	"tesou.io/platform/foot-parent/foot-api/module/match/pojo"
	entity3 "tesou.io/platform/foot-parent/foot-api/module/odds/pojo"
	"time"
)

/**
亚赔与欧赔up down 颠倒
 */
type A2Service struct {
	AnalyService
	//最大让球数据
	MaxLetBall float64
}

func (this *A2Service) ModelName() string {
	//alFlag := reflect.TypeOf(*this).Name()
	return "A2"
}

M
monomania 已提交
27 28 29 30
func (this *A2Service) AnalyTest() {
	this.AnalyService.AnalyTest(this)
}

S
1.xxxx  
shi.zeyuan 已提交
31 32 33 34 35 36
/**
分析比赛数据,, 结合亚赔 赔赔差异
( 1.欧赔降水,亚赔反之,以亚赔为准)
( 2.欧赔升水,亚赔反之,以亚赔为准)
*/
func (this *A2Service) Analy(analyAll bool) {
37
	this.AnalyService.Analy(analyAll,this)
S
1.xxxx  
shi.zeyuan 已提交
38 39 40 41

}

func (this *A2Service) Analy_Near() {
42
	this.AnalyService.Analy_Near(this)
S
1.xxxx  
shi.zeyuan 已提交
43 44 45 46 47 48 49 50 51 52
}

/**
  -1 参数错误
  -2 不符合让球数
  -3 计算分析错误
  0  新增的分析结果
  1  需要更新结果
 */
func (this *A2Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult) {
53
	temp_data := this.Find(v.Id, this.ModelName())
S
1.xxxx  
shi.zeyuan 已提交
54 55 56 57 58 59 60 61 62
	matchId := v.Id
	//声明使用变量
	var e81 *entity3.EuroHis
	var e616 *entity3.EuroHis
	//var e104data *entity3.EuroHis
	var a18Bet *entity3.AsiaHis
	//81 -- 伟德
	eList := this.EuroHisService.FindByMatchIdCompId(matchId, "81", "616", "281")
	if len(eList) < 3 {
63
		return -1, temp_data
S
1.xxxx  
shi.zeyuan 已提交
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
	}
	for _, ev := range eList {
		if strings.EqualFold(ev.CompId, "81") {
			e81 = ev
			continue
		}
		if strings.EqualFold(ev.CompId, "616") {
			e616 = ev
			continue
		}
		//if strings.EqualFold(ev.CompId, "104") {
		//	e104data = ev
		//	continue
		//}
	}

	if e81 == nil || e616 == nil {
81
		return -1, temp_data
S
1.xxxx  
shi.zeyuan 已提交
82 83 84 85 86 87 88 89
	}
	if matchId == "1835087" {
		base.Log.Info("-")
	}

	//亚赔
	aList := this.AsiaHisService.FindByMatchIdCompId(matchId, "18Bet")
	if len(aList) < 1 {
90
		return -1, temp_data
S
1.xxxx  
shi.zeyuan 已提交
91 92
	}
	a18Bet = aList[0]
93
	temp_data.LetBall = a18Bet.ELetBall
S
1.xxxx  
shi.zeyuan 已提交
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
	if math.Abs(a18Bet.ELetBall) > this.MaxLetBall {
		//temp_data.Result = ""
		return -2, temp_data
	}

	//判断分析logic
	//主降为3 客降为0
	euroDirection := this.EuroDirection(e81, e616)
	//2.亚赔是主降还是主升 主降为true
	asiaDirection := this.AsiaDirectionMulti(matchId)
	//asiaDirection := this.AsiaDirection(a18Bet)
	//得出结果
	var preResult int
	if euroDirection == 3 && asiaDirection == 0 {
		preResult = 0
	} else if euroDirection == 0 && asiaDirection == 3 {
		preResult = 3
	} else {
112
		return -3, temp_data
S
1.xxxx  
shi.zeyuan 已提交
113 114 115 116
	}

	////增加104 --Interwetten过滤
	//if preResult == 3 && (e616.Ep3 > e104data.Ep3 || e104data.Ep0 < e104data.Sp0) {
117
	//	return -3, temp_data
S
1.xxxx  
shi.zeyuan 已提交
118 119
	//}
	//if preResult == 0 && (e616.Ep0 > e104data.Ep0 || e104data.Ep3 < e104data.Sp3) {
120
	//	return -3, temp_data
S
1.xxxx  
shi.zeyuan 已提交
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
	//}

	var data *entity5.AnalyResult
	if len(temp_data.Id) > 0 {
		temp_data.PreResult = preResult
		temp_data.HitCount = temp_data.HitCount + 1
		temp_data.LetBall = a18Bet.ELetBall
		data = temp_data
		//比赛结果
		data.Result = this.IsRight(v, data)
		return 1, data
	} else {
		data = new(entity5.AnalyResult)
		data.MatchId = v.Id
		data.MatchDate = v.MatchDate
M
monomania 已提交
136
		data.SLetBall = a18Bet.SLetBall
S
1.xxxx  
shi.zeyuan 已提交
137 138 139 140 141 142 143 144 145 146 147 148
		data.LetBall = a18Bet.ELetBall
		data.AlFlag = this.ModelName()
		format := time.Now().Format("0102150405")
		data.AlSeq = format
		data.PreResult = preResult
		data.HitCount = 3
		//比赛结果
		data.Result = this.IsRight(v, data)
		return 0, data
	}

}