提交 edae7fa8 编写于 作者: S shi.zeyuan

Merge branch 'master' of github.com:monomania/foot-parent into m0106

......@@ -13,8 +13,8 @@ func main() {
base.Log.Info("---------------------------------------------------------------")
base.Log.Info("---------------C1模型--------------")
base.Log.Info("---------------------------------------------------------------")
c1 := new(service.C3Service)
c1.MaxLetBall = 1
c1 := new(service.C4Service)
c1.MaxLetBall = 2
c1.AnalyTest()
base.Log.Info("---------------------------------------------------------------")
base.Log.Info("---------------E1模型--------------")
......
......@@ -23,13 +23,13 @@
<span style="color: red; ">红:{{.RedCount}},</span>
<span style="color: gray; ">黑:{{.BlackCount}},</span>
胜率:{{.RedCount}}/({{.RedCount}}+{{.BlackCount}})={{.Val}}
</strong>
</strong>
</li>
<li><strong>{{.MainAlflag}}单方向统计,
<span style="color: red; ">红:{{.MainRedCount}},</span>
<span style="color: gray; ">黑:{{.MainBlackCount}},</span>
胜率:{{.MainRedCount}}/({{.MainRedCount}}+{{.MainBlackCount}})={{.MainVal}}
</strong>
</strong>
</li>
</ul>
<hr/>
......@@ -47,36 +47,41 @@
<td>主队(让球)客队</td>
<td>比分</td>
<td>推荐</td>
<td>指数</td>
<td>指数/Desc</td>
</tr>
{{if .DataList}}
{{with .DataList}}
{{range .}}
<tr style="font-weight: bold;font-size: 10px">
<td><span style="color: {{color .AlFlag}}">{{.AlFlag}}</span></td>
<td>{{.MatchDateStr}}</td>
<td>{{.LeagueName}}</td>
<td>
{{if .TOVoid}}<del><span style="color: red;">{{end}}
{{.MainTeam}}({{.LetBall}}){{.GuestTeam}}
{{if .TOVoid}}{{if .TOVoidDesc}}({{.TOVoidDesc}}){{end}}</span></del>{{end}}
</td>
<td>
{{.MainTeamGoal}}:{{.GuestTeamGoal}}
</td>
<td style="background-color: {{resultColor .Result}}">
{{preResultStr .PreResult .AlFlag}}
</td>
<td style="color: red">
<strong>{{.HitCount}}</strong>
</td>
</tr>
{{end}}
{{if .DataList}}
{{with .DataList}}
{{range .}}
<tr style="font-weight: bold;font-size: 10px">
<td><span style="color: {{color .AlFlag}}">{{.AlFlag}}</span></td>
<td>{{.MatchDateStr}}</td>
<td>{{.LeagueName}}</td>
<td>
{{if .TOVoid}}
<del><span style="color: red;">{{end}}
{{.MainTeam}}({{.LetBall}}){{.GuestTeam}}
{{if .TOVoid}}{{if .TOVoidDesc}}({{.TOVoidDesc}}){{end}}</span></del>{{end}}
</td>
<td>
{{.MainTeamGoal}}:{{.GuestTeamGoal}}
</td>
<td style="background-color: {{resultColor .Result}}">
{{preResultStr .PreResult .AlFlag}}
</td>
<td style="color: red">
{{if eq .AlFlag "C4"}}
<strong>{{.Desc}}</strong>
{{else}}
<strong>{{.HitCount}}</strong>
{{end}}
{{else}}
<tr>
<td colspan="7" style="color: red;font-weight: bold;font-size: 12px">暂时没有符合模型的比赛推荐,感谢关注~~~</td>
</tr>
{{end}}
</td>
</tr>
{{end}}
{{end}}
{{else}}
<tr>
<td colspan="7" style="color: red;font-weight: bold;font-size: 12px">暂时没有符合模型的比赛推荐,感谢关注~~~</td>
</tr>
{{end}}
</table>
<span style="color: red;font-weight: bold;font-size: 12px">声明:彩市有风险,购彩需谨慎.AI球探只提供预测参考,不构成购彩建议,据AI球探购彩者风险自担.</span>
......@@ -35,6 +35,8 @@ type AnalyResult struct {
//是否己经作废,因后续结果不符合要求
TOVoid bool `xorm:"bool notnull comment('是否己经作废') index"`
TOVoidDesc string `xorm:" comment('作废备注') index"`
//用于增加备注
Desc string `xorm:" comment('备注信息') index"`
pojo.BasePojo `xorm:"extends"`
}
......@@ -9,7 +9,7 @@ import (
*/
type BFJin struct {
//比赛ID
ScheduleID int64 `json:"ScheduleID" xorm:"comment('比赛ID') index"`
ScheduleID int64 `json:"ScheduleID" xorm:"comment('比赛ID') unique(ScheduleID) index"`
//联赛ID
SclassID int64 `json:"SclassID" xorm:"comment('联赛ID') index"`
//联赛名称
......
......@@ -46,7 +46,7 @@ func Analy(all bool) {
base.Log.Info("---------------A3模型--------------")
base.Log.Info("---------------------------------------------------------------")
a3 := new(service.A3Service)
a3.MaxLetBall = 10
a3.MaxLetBall = 5
a3.Analy(all)
base.Log.Info("---------------------------------------------------------------")
base.Log.Info("---------------C1模型--------------")
......@@ -61,6 +61,12 @@ func Analy(all bool) {
c2.MaxLetBall = maxLetBall
c2.Analy(all)
base.Log.Info("---------------------------------------------------------------")
base.Log.Info("---------------C4模型--------------")
base.Log.Info("---------------------------------------------------------------")
c4 := new(service.C4Service)
c4.MaxLetBall = 10
c4.Analy(all)
base.Log.Info("---------------------------------------------------------------")
base.Log.Info("---------------处理结果--------------")
base.Log.Info("---------------------------------------------------------------")
analyService := new(service.AnalyService)
......
......@@ -57,7 +57,7 @@ func (this *AnalyService) FindAll() []*entity5.AnalyResult {
}
func (this *AnalyService) AnalyTest(thiz AnalyInterface) {
var currentPage, pageSize int64 = 1, 30000
var currentPage, pageSize int64 = 1, 10000
var page *pojo.Page
page = new(pojo.Page)
page.PageSize = pageSize
......
package service
import (
"fmt"
"math"
"strings"
"tesou.io/platform/foot-parent/foot-api/common/base"
pojo2 "tesou.io/platform/foot-parent/foot-api/common/base/pojo"
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"
"tesou.io/platform/foot-parent/foot-core/module/analy/constants"
"tesou.io/platform/foot-parent/foot-core/module/match/service"
"time"
)
type C4Service struct {
AnalyService
service.BFScoreService
service.BFBattleService
service.BFFutureEventService
service.BFJinService
//最大让球数据
MaxLetBall float64
}
func (this *C4Service) ModelName() string {
return "C4"
}
func (this *C4Service) AnalyTest() {
this.AnalyService.AnalyTest(this)
}
func (this *C4Service) Analy(analyAll bool) {
this.AnalyService.Analy(analyAll, this)
}
func (this *C4Service) Analy_Near() {
this.AnalyService.Analy_Near(this)
}
/**
-1 参数错误
-2 不符合让球数
-3 计算分析错误
0 新增的分析结果
1 需要更新结果
*/
func (this *C4Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult) {
temp_data := this.Find(v.Id, this.ModelName())
matchId := v.Id
//声明使用变量
var a18Bet *entity3.AsiaHis
//亚赔
aList := this.AsiaHisService.FindByMatchIdCompId(matchId, constants.C1_REFER_ASIA)
if len(aList) < 1 {
return -1, temp_data
}
a18Bet = aList[0]
temp_data.LetBall = a18Bet.ELetBall
if math.Abs(a18Bet.ELetBall) > this.MaxLetBall {
//temp_data.Result =""
return -2, temp_data
}
//限制初盘,即时盘让球在0.25以内
if math.Abs(a18Bet.SLetBall-a18Bet.ELetBall) > 0.25 {
temp_data.TOVoid = true
temp_data.TOVoidDesc = "界限"
return -2, temp_data
}
//得出结果
preResult := -1
matchDateStr := v.MatchDate.Format("2006-01-02 15:04:05")
var currentPage, pageSize int64 = 1, 10
var page *pojo2.Page
page = new(pojo2.Page)
page.PageSize = pageSize
page.CurPage = currentPage
mainJinList := make([]*pojo.BFJin, 0)
err1 := this.BFJinService.PageSql("SELECT j.* FROM foot.t_b_f_jin j WHERE j.SclassID = "+v.LeagueId+" AND (j.HomeTeam = '"+v.MainTeamId+"' OR j.GuestTeam = '"+v.MainTeamId+"') AND STR_TO_DATE(j.MatchTimeStr, '%Y%m%d%H%i%s') < '"+matchDateStr+"' ORDER BY j.MatchTimeStr DESC ", page, &mainJinList)
if nil != err1 {
base.Log.Error(err1)
return -2, temp_data
}
guestJinList := make([]*pojo.BFJin, 0)
err2 := this.BFJinService.PageSql("SELECT j.* FROM foot.t_b_f_jin j WHERE j.SclassID = "+v.LeagueId+" AND (j.HomeTeam = '"+v.GuestTeamId+"' OR j.GuestTeam = '"+v.GuestTeamId+"') AND STR_TO_DATE(j.MatchTimeStr, '%Y%m%d%H%i%s') < '"+matchDateStr+"' ORDER BY j.MatchTimeStr DESC ", page, &guestJinList)
if nil != err2 {
base.Log.Error(err2)
return -2, temp_data
}
if len(mainJinList) < 10 || len(guestJinList) < 10 {
return -2, temp_data
}
mainGoal, guestGoal := 0, 0
mainScore, guestScore := 0, 0
for _, temp := range mainJinList {
if strings.EqualFold(temp.HomeTeam, v.MainTeamId) {
mainGoal += temp.HomeScore
if temp.HomeScore > temp.GuestScore {
mainScore += 3
}
if temp.HomeScore == temp.GuestScore {
mainScore += 1
}
}
if strings.EqualFold(temp.GuestTeam, v.MainTeamId) {
mainGoal += temp.GuestScore
if temp.GuestScore > temp.HomeScore {
mainScore += 3
}
if temp.GuestScore == temp.HomeScore {
mainScore += 1
}
}
}
for _, temp := range guestJinList {
if strings.EqualFold(temp.HomeTeam, v.GuestTeamId) {
guestGoal += temp.HomeScore
if temp.HomeScore > temp.GuestScore {
guestScore += 3
}
if temp.HomeScore == temp.GuestScore {
guestScore += 1
}
}
if strings.EqualFold(temp.GuestTeam, v.GuestTeamId) {
guestGoal += temp.GuestScore
if temp.GuestScore > temp.HomeScore {
guestScore += 3
}
if temp.GuestScore == temp.HomeScore {
guestScore += 1
}
}
}
diffGoal := float64(mainGoal-guestGoal) / 10
diffScore := float64(mainScore-guestScore) / 10
eLetBall := a18Bet.ELetBall
//if eLetBall > 0 {
// if diffGoal > 0 && diffScore > 0 && (math.Abs(diffScore-eLetBall) < 0.25 && math.Abs(diffGoal-eLetBall) < 0.25) {
// preResult = 3
// }
//
//} else if eLetBall == 0 {
//
//} else {
// //<0
// if diffGoal < 0 && diffScore < 0 && (math.Abs(diffScore-eLetBall) < 0.25 && math.Abs(diffGoal-eLetBall) < 0.25) {
// preResult = 0
// }
//}
//
//if preResult < 0 {
// return -3, temp_data
//}
base.Log.Info("对阵:", v.MainTeamId+":"+v.GuestTeamId, ",初盘让球:", a18Bet.SLetBall, ",即时盘让球:", eLetBall, ",球差:", diffGoal, ",分差:", diffScore, " ,比分:", v.MainTeamGoals, ":", v.GuestTeamGoals, " ,半场比分:", v.MainTeamHalfGoals, ":", v.GuestTeamHalfGoals)
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
temp_data.Desc = fmt.Sprintf("分差:%v ,球差:%v", diffScore, diffGoal)
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
data.SLetBall = a18Bet.SLetBall
data.LetBall = a18Bet.ELetBall
data.Desc = fmt.Sprintf("分差:%v ,球差:%v", diffScore, diffGoal)
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
}
}
......@@ -619,11 +619,11 @@ func (this *SuggestTodayService) ModifyTodayTbs(wcClient *core.Client) {
h12, _ = time.ParseDuration("100h")
endDate := now.Add(h12)
param.EndDateStr = endDate.Format("2006-01-02 15:04:05")
param.AlFlags = []string{"E1", "E2", "Q1"}
param.AlFlags = []string{"E1", "E2", "C4","Q1"}
tempList := this.SuggestService.QueryTbs(param)
//更新推送
first := material.Article{}
first.Title = fmt.Sprintf("待选场次-E1,E2,Q1")
first.Title = fmt.Sprintf("待选场次-E1,E2,C4,Q1")
first.Digest = fmt.Sprintf("%d场赛事", len(tempList))
first.ThumbMediaId = today_tbs_thumbMediaId
first.ContentSourceURL = contentSourceURL
......
......@@ -77,7 +77,7 @@ func Spider_History() {
for _, v := range seasons {
mysql.ShowSQL(true)
Spider_match_his(v)
go Spider_euroLast_his(v)
//go Spider_euroLast_his(v)
go Spider_asiaLastNew_his(v)
go Spider_baseFace_his(v)
//欧赔历史变盘euro track win007己无法获取到
......
package win007
const MODULE_FLAG = "win007"
const WIN007_BASE_URL = "http://m.win007.com/"
/**
* 比赛分析页面数据
*/
const WIN007_BASE_FACE_URL_PATTERN = "http://m.win007.com/analy/Analysis/${matchId}.htm"
/**
* 欧赔, scheid为比赛Id , cId为公司Id
*/
const WIN007_EUROODD_URL_PATTERN = "http://m.win007.com/Compensate/${matchId}.htm"
const WIN007_EUROODD_BET_URL_PATTERN = "http://m.win007.com/1x2Detail.aspx?scheid=${scheid}&cId=${cId}"
/**
* 亚赔, scheid为比赛Id , cId为公司Id
*/
const WIN007_ASIAODD_URL_PATTERN = "http://m.win007.com/asian/${matchId}.htm"
const WIN007_ASIAODD_NEW_URL_PATTERN = "http://m.win007.com/HandicapDataInterface.ashx?scheid=${matchId}&type=1&oddskind=0&flesh=${flesh}"
/**
资料库里的比赛赛程前缀
示例:http://m.win007.com/info/Fixture/2019-2020/34_0_0.htm
*/
const WIN007_MATCH_HIS_PATTERN = "http://m.win007.com/info/Fixture/${season}/${leagueId}_${subId}_${round}.htm"
const (
MODULE_FLAG = "win007"
WIN007_BASE_URL = "http://m.win007.com/"
/**
* 比赛分析页面数据
*/
WIN007_BASE_FACE_URL_PATTERN = "http://m.win007.com/analy/Analysis/${matchId}.htm"
/**
* 欧赔, scheid为比赛Id , cId为公司Id
*/
WIN007_EUROODD_URL_PATTERN = "http://m.win007.com/Compensate/${matchId}.htm"
WIN007_EUROODD_BET_URL_PATTERN = "http://m.win007.com/1x2Detail.aspx?scheid=${scheid}&cId=${cId}"
/**
* 亚赔, scheid为比赛Id , cId为公司Id
*/
WIN007_ASIAODD_URL_PATTERN = "http://m.win007.com/asian/${matchId}.htm"
WIN007_ASIAODD_NEW_URL_PATTERN = "http://m.win007.com/HandicapDataInterface.ashx?scheid=${matchId}&type=1&oddskind=0&flesh=${flesh}"
/**
资料库里的比赛赛程前缀
示例:http://m.win007.com/info/Fixture/2019-2020/34_0_0.htm
*/
WIN007_MATCH_HIS_PATTERN = "http://m.win007.com/info/Fixture/${season}/${leagueId}_${subId}_${round}.htm"
)
const (
SLEEP_RAND_S = 10
SLEEP_RAND_E = 100
)
......@@ -54,7 +54,7 @@ func (this *AsiaLastNewProcesser) Startup() {
//先将前面的spider启动
newSpider.SetDownloader(down.NewMAsiaLastApiDownloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(10).Run()
processer = GetAsiaLastNewProcesser()
......@@ -77,7 +77,7 @@ func (this *AsiaLastNewProcesser) Startup() {
newSpider.SetDownloader(down.NewMAsiaLastApiDownloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(1).Run()
}
......
......@@ -58,7 +58,7 @@ func (this *BaseFaceProcesser) Startup() {
//先将前面的spider启动
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(10).Run()
processer = GetBaseFaceProcesser()
......@@ -80,7 +80,7 @@ func (this *BaseFaceProcesser) Startup() {
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(1).Run()
}
......
......@@ -60,7 +60,7 @@ func (this *EuroLastProcesser) Startup() {
//先将前面的spider启动
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(10).Run()
processer = GetEuroLastProcesser()
......@@ -82,7 +82,7 @@ func (this *EuroLastProcesser) Startup() {
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(1).Run()
}
......
......@@ -59,7 +59,7 @@ func (this *EuroTrackProcesser) Startup() {
//先将前面的spider启动
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(10).Run()
processer = GetEuroTrackProcesser()
......@@ -83,7 +83,7 @@ func (this *EuroTrackProcesser) Startup() {
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(1).Run()
}
......
......@@ -70,14 +70,14 @@ func (this *LeagueProcesser) Startup() {
if i%10 == 0 { //10个联赛一个spider,总数1000多个联赛,最多100spider
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(1).Run()
}
})
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(1).Run()
}
......
......@@ -83,14 +83,14 @@ func (this *LeagueSeasonProcesser) Startup() {
if i % 10 == 0 {//10个联赛一个spider,总数1000多个联赛,最多100spider
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(10).Run()
}
}
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(1).Run()
}
......
......@@ -70,7 +70,7 @@ func (this *MatchHisProcesser) Startup() {
//先将前面的spider启动
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(10).Run()
processer = GetMatchHisProcesser()
......@@ -94,7 +94,7 @@ func (this *MatchHisProcesser) Startup() {
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(1).Run()
}
......
......@@ -57,7 +57,7 @@ func (this *MatchLastProcesser) Startup() {
newSpider = newSpider.AddUrl(this.MatchlastUrl, "text")
newSpider.SetDownloader(down.NewMWin007Downloader())
newSpider = newSpider.AddPipeline(pipeline.NewPipelineConsole())
newSpider.SetSleepTime("rand", 1, 300)
newSpider.SetSleepTime("rand", win007.SLEEP_RAND_S, win007.SLEEP_RAND_E)
newSpider.SetThreadnum(1).Run()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册