提交 adfed63c 编写于 作者: M monomania

1.处理提前计算结果的bug

上级 27475c64
......@@ -148,6 +148,7 @@ func main() {
// time.Sleep(time.Duration(pubService.CycleTime()) * time.Minute)
// }
//}()
time.Sleep(1 * time.Second)
for {
matchLastService := new(service3.MatchLastService)
matchLasts := matchLastService.FindNear()
......
......@@ -165,6 +165,7 @@ HEAD:
// time.Sleep(time.Duration(pubService.CycleTime()) * time.Minute)
// }
//}()
time.Sleep(1 * time.Second)
go func() {
for {
matchLastService := new(service3.MatchLastService)
......
......@@ -3,7 +3,9 @@ package main
import (
"fmt"
"strconv"
service2 "tesou.io/platform/foot-parent/foot-core/module/analy/service"
"tesou.io/platform/foot-parent/foot-core/module/spider/constants"
"tesou.io/platform/foot-parent/foot-core/module/wechat/service"
"time"
)
func abort(funcname string, err string) {
......@@ -23,9 +25,21 @@ func Decimal(value float64) float64 {
}
var aaa int
func set() {
constants.SpiderDateStr = time.Now().Format("2006-01-02 15:04:05")
constants.FullSpiderDateStr = constants.SpiderDateStr
}
func main(){
flag := new(service2.AnalyService).FindOtherAlFlag("1721915", "C1", 3)
fmt.Println(flag)
go func() {
set()
new(service.SuggestTodayService).Print11()
}()
time.Sleep(1 * time.Second)
}
//func main() {
......
......@@ -27,21 +27,18 @@
<table style="font-size: 12px;font-weight: bold">
<tr>
<td>模型</td>
<td>指数</td>
<td>时间</td>
<td>联赛</td>
<td>主队(让球)客队</td>
<td>比分</td>
<td>推荐</td>
<td>指数</td>
</tr>
{{if .DataList}}
{{with .DataList}}
{{range .}}
<tr>
<td><span style="color: {{color .AlFlag}}">{{.AlFlag}}</span></td>
<td style="color: red">
<strong>{{.HitCount}}</strong>
</td>
<td>{{.MatchDateStr}}</td>
<td>{{.LeagueName}}</td>
<td>
......@@ -55,6 +52,9 @@
<td style="background-color: {{resultColor .Result}}">
{{preResultStr .PreResult .AlFlag}}
</td>
<td style="color: red">
<strong>{{.HitCount}}</strong>
</td>
</tr>
{{end}}
{{end}}
......
......@@ -28,21 +28,18 @@
<table style="font-size: 12px;font-weight: bold">
<tr>
<td>模型</td>
<td style="min-width: 58px">BF让球</td>
<td>时间</td>
<td>联赛</td>
<td>主队(让球)客队</td>
<td>比分</td>
<td>推荐</td>
<td style="min-width: 58px">BF让球</td>
</tr>
{{if .DataList}}
{{with .DataList}}
{{range .}}
<tr>
<td><span style="color: {{color .AlFlag}}">{{.AlFlag}}</span></td>
<td style="color: red">
{{.MyLetBall}}
</td>
<td>{{.MatchDateStr}}</td>
<td>{{.LeagueName}}</td>
<td>
......@@ -56,6 +53,9 @@
<td style="background-color: {{resultColor .Result}}">
{{preResultStr .PreResult .AlFlag}}
</td>
<td style="color: red">
{{.MyLetBall}}
</td>
</tr>
{{end}}
{{end}}
......
......@@ -27,21 +27,18 @@
<table style="font-size: 12px;font-weight: bold">
<tr>
<td>模型</td>
<td>指数</td>
<td>时间</td>
<td>联赛</td>
<td>主队(让球)客队</td>
<td>比分</td>
<td>推荐</td>
<td>指数</td>
</tr>
{{if .DataList}}
{{with .DataList}}
{{range .}}
<tr>
<td><span style="color: {{color .AlFlag}}">{{.AlFlag}}</span></td>
<td style="color: red">
<strong>{{.HitCount}}</strong>
</td>
<td>{{.MatchDateStr}}</td>
<td>{{.LeagueName}}</td>
<td>
......@@ -55,6 +52,9 @@
<td style="background-color: {{resultColor .Result}}">
{{preResultStr .PreResult .AlFlag}}
</td>
<td style="color: red">
<strong>{{.HitCount}}</strong>
</td>
</tr>
{{end}}
{{end}}
......
[mysql]
#url=root:Meta.123@tcp(mysql.io:3306)/foot?charset=utf8
url=root:awe.FOG5188@tcp(39.108.212.245:3306)/foot?charset=utf8
url=root:Meta.123@tcp(mysql.io:3306)/foot?charset=utf8
#url=root:awe.FOG5188@tcp(39.108.212.245:3306)/foot?charset=utf8
maxIdle=10
maxConn=50
[cookies]
......
......@@ -4,6 +4,7 @@ import (
"fmt"
"math"
"strconv"
"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/analy/vo"
......@@ -99,7 +100,7 @@ FROM
last.MainTeamGoals = his.MainTeamGoals
last.GuestTeamId = his.GuestTeamId
last.GuestTeamGoals = his.GuestTeamGoals
if e.AlFlag == "E2" || e.AlFlag == "C1" {
if strings.EqualFold(e.AlFlag, "E2") || strings.EqualFold(e.AlFlag, "C1") {
//E2使用特别自身的验证结果方法
e.Result = this.IsRight2Option(last, e)
} else {
......@@ -146,7 +147,7 @@ WHERE DATE_ADD(ar.MatchDate, INTERVAL 3 HOUR) > NOW()
last.MainTeamGoals = his.MainTeamGoals
last.GuestTeamId = his.GuestTeamId
last.GuestTeamGoals = his.GuestTeamGoals
if e.AlFlag == "E2" || e.AlFlag == "C1" {
if strings.EqualFold(e.AlFlag, "E2") || strings.EqualFold(e.AlFlag, "C1") {
//E2使用特别自身的验证结果方法
e.Result = this.IsRight2Option(last, e)
} else {
......@@ -227,9 +228,10 @@ WHERE ml.id = el.matchid
func (this *AnalyService) IsRight2Option(v *entity2.MatchLast, analy *entity5.AnalyResult) string {
//比赛结果
var globalResult int
h2, _ := time.ParseDuration("158m")
matchDate := v.MatchDate.Add(h2)
if matchDate.After(time.Now()) {
h2, _ := time.ParseDuration("129m")
//比赛结束的时间点
matchEndDate := v.MatchDate.Add(h2)
if matchEndDate.Before(time.Now()) {
//比赛未结束
globalResult = -1
} else {
......@@ -283,9 +285,9 @@ func (this *AnalyService) IsRight(last *entity2.MatchLast, analy *entity5.AnalyR
*/
func (this *AnalyService) ActualResult(last *entity2.MatchLast, analy *entity5.AnalyResult) int {
var result int
h2, _ := time.ParseDuration("158m")
matchDate := last.MatchDate.Add(h2)
if matchDate.After(time.Now()) {
h2, _ := time.ParseDuration("129m")
matchEndDate := last.MatchDate.Add(h2)
if matchEndDate.Before(time.Now()) {
//比赛未结束
return -1
}
......
......@@ -328,7 +328,7 @@ func (this *C1Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult)
temp_data := this.Find(v.Id, this.ModelName())
if len(temp_data.Id) > 0 {
temp_data.PreResult = preResult
temp_data.HitCount = temp_data.HitCount + 10
temp_data.HitCount = temp_data.HitCount + 1
temp_data.LetBall = a18betData.ELetBall
temp_data.MyLetBall = Decimal(letBall)
data = temp_data
......
......@@ -148,7 +148,7 @@ func (this *E2Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult)
temp_data.LetBall = a18betData.ELetBall
data = temp_data
//比赛结果
data.Result = this.IsRight(v, data)
data.Result = this.IsRight2Option(v, data)
return 1, data
} else {
data = new(entity5.AnalyResult)
......@@ -162,7 +162,7 @@ func (this *E2Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult)
data.HitCount = 1
data.LetBall = a18betData.ELetBall
//比赛结果
data.Result = this.IsRight(v, data)
data.Result = this.IsRight2Option(v, data)
return 0, data
}
}
......
......@@ -3,33 +3,48 @@ package service
import (
"strconv"
"strings"
"tesou.io/platform/foot-parent/foot-api/module/analy/vo"
vo2 "tesou.io/platform/foot-parent/foot-api/module/suggest/vo"
"tesou.io/platform/foot-parent/foot-core/common/utils"
"tesou.io/platform/foot-parent/foot-core/module/analy/service"
"tesou.io/platform/foot-parent/foot-core/module/leisu/constants"
"tesou.io/platform/foot-parent/foot-core/module/suggest/service"
"time"
)
type LeisuService struct {
service.AnalyService
service.SuggestService
}
/**
获取可发布的数据
*/
func (this *LeisuService) ListPubAbleData() []*vo.AnalyResultVO {
teamOption := this.teamOption()
al_flag := utils.GetVal(constants.SECTION_NAME, "al_flag")
hit_count_str := utils.GetVal(constants.SECTION_NAME, "hit_count")
hit_count, _ := strconv.Atoi(hit_count_str)
func (this *LeisuService) ListPubAbleData() []*vo2.SuggStubDetailVO {
//获取分析计算出的比赛列表
analyList := this.AnalyService.List(al_flag, hit_count, teamOption)
return analyList
param := new(vo2.SuggStubDetailVO)
now := time.Now()
h12, _ := time.ParseDuration("-1h")
beginDate := now.Add(h12)
param.BeginDateStr = beginDate.Format("2006-01-02 15:04:05")
h12, _ = time.ParseDuration("24h")
endDate := now.Add(h12)
param.EndDateStr = endDate.Format("2006-01-02 15:04:05")
//只推送稳胆
tempList := this.SuggestService.QueryLeisu(param)
if len(tempList) <= 0 {
return tempList
}
//过滤重复选项
dataList := make([]*vo2.SuggStubDetailVO, 0)
for _, e := range tempList {
for _, e2 := range dataList {
if strings.EqualFold(e.MatchId, e2.MatchId) {
continue
}
dataList = append(dataList, e)
}
}
return dataList
}
/**
###推送的主客队选项,
#格式为:时间:选项,时间:选项,时间:选项
......@@ -59,4 +74,4 @@ func (this *LeisuService) teamOption() int {
}
}
return result
}
\ No newline at end of file
}
......@@ -7,7 +7,7 @@ import (
"strconv"
"strings"
"tesou.io/platform/foot-parent/foot-api/common/base"
"tesou.io/platform/foot-parent/foot-api/module/analy/vo"
vo3 "tesou.io/platform/foot-parent/foot-api/module/suggest/vo"
"tesou.io/platform/foot-parent/foot-core/common/utils"
constants2 "tesou.io/platform/foot-parent/foot-core/module/leisu/constants"
utils2 "tesou.io/platform/foot-parent/foot-core/module/leisu/utils"
......@@ -46,8 +46,8 @@ func (this *PubService) CycleTime() int64 {
*/
func (this *PubService) PubBJDC() {
//获取分析计算出的比赛列表
analyList := this.LeisuService.ListPubAbleData()
if len(analyList) < 1 {
tempList := this.LeisuService.ListPubAbleData()
if len(tempList) < 1 {
base.Log.Info(fmt.Sprintf("1.当前没有可发布的比赛!!!!"))
return
}
......@@ -55,24 +55,24 @@ func (this *PubService) PubBJDC() {
//获取发布池的比赛列表
matchPool := this.MatchPoolService.GetMatchList()
//适配比赛,获取发布列表
pubList := make(map[*vo.AnalyResultVO]*vo2.MatchVO, 0)
for _, analy := range analyList {
analy_mainTeam := analy.MainTeamId
analy_guestTeam := analy.GuestTeamId
pubList := make(map[*vo3.SuggStubDetailVO]*vo2.MatchVO, 0)
for _, temp := range tempList {
analy_mainTeam := temp.MainTeam
analy_guestTeam := temp.GuestTeam
for _, match := range matchPool {
if strings.EqualFold(analy_mainTeam, match.MainTeam) {
pubList[analy] = match
pubList[temp] = match
break;
}
if strings.EqualFold(analy_guestTeam, match.GuestTeam) {
pubList[analy] = match
pubList[temp] = match
break;
}
}
}
if len(pubList) <= 0 {
base.Log.Info(fmt.Sprintf("2.当前无可发布的比赛!!!!比赛池size:%d,分析赛果size:%d", len(matchPool), len(analyList)))
base.Log.Info(fmt.Sprintf("2.当前无可发布的比赛!!!!比赛池size:%d,分析赛果size:%d", len(matchPool), len(tempList)))
return
}
//打印要发布的比赛
......@@ -99,7 +99,7 @@ func (this *PubService) PubBJDC() {
case 0, 100002:
//0 成功 100002 每场比赛同一种玩法只可选择1次
analy.LeisuPubd = true
this.AnalyService.Modify(&analy.AnalyResult)
//this.AnalyService.Modify(&analy.AnalyResult)
case 100003:
//100003 标题长度不正确
default:
......
......@@ -82,7 +82,7 @@ FROM
foot.t_league l
WHERE la.LeagueId = l.Id
AND l.LevelAssist > 0
AND la.MatchDate > DATE_SUB(NOW(), INTERVAL 3 HOUR)
AND la.MatchDate > DATE_SUB(NOW(), INTERVAL 6 HOUR)
ORDER BY la.MatchDate ASC
`
//结果值
......
package constants
import "time"
var (
//数据爬取时间
SpiderDateStr string
SpiderDateStr = time.Now().Format("2006-01-02 15:04:05")
//全量数据爬取时间
FullSpiderDateStr string
FullSpiderDateStr = time.Now().Format("2006-01-02 15:04:05")
)
......@@ -66,11 +66,11 @@ WHERE mh.LeagueId = l.Id
sql += " ORDER BY ar.MatchDate ASC, l.id ASC,mh.MainTeamId asc,ar.`AlFlag` DESC,ar.PreResult DESC "
}
//结果值
entitys := make([]*vo2.SuggStubVO, 0)
dataList := make([]*vo2.SuggStubVO, 0)
//执行查询
this.FindBySQL(sql, &entitys)
this.FindBySQL(sql, &dataList)
return entitys
return dataList
}
/**
......@@ -204,14 +204,14 @@ WHERE mh.LeagueId = l.Id
}
//结果值
entitys := make([]*vo2.SuggStubDetailVO, 0)
dataList := make([]*vo2.SuggStubDetailVO, 0)
//执行查询
this.FindBySQL(sql, &entitys)
if len(entitys) <= 0 {
return entitys
this.FindBySQL(sql, &dataList)
if len(dataList) <= 0 {
return dataList
}
//for _, e := range entitys {
//for _, e := range dataList {
// matchId := e.MatchId
// eOddList := this.EuroLastService.FindByMatchId(matchId)
// aOddList := this.AsiaLastService.FindByMatchId(matchId)
......@@ -220,7 +220,7 @@ WHERE mh.LeagueId = l.Id
// bffeList := this.BFFutureEventService.FindByMatchId(matchId)
//
//}
for _, v := range entitys {
for _, v := range dataList {
matchId := v.MatchId
//积分,排名
bfsList := this.BFScoreService.FindByMatchId(matchId)
......@@ -308,5 +308,146 @@ WHERE mh.LeagueId = l.Id
v.GuestNextMainTeam = bffe_guest.EventMainTeamId
}
}
return entitys
return dataList
}
func (this *SuggestService) QueryLeisu(param *vo2.SuggStubDetailVO) []*vo2.SuggStubDetailVO {
sql := `
SELECT
l.Name AS LeagueName,
mh.MainTeamId AS MainTeam,
mh.GuestTeamId AS GuestTeam,
mh.MainTeamGoals AS MainTeamGoal,
mh.GuestTeamGoals AS GuestTeamGoal,
ar.*
FROM
foot.t_league l,
foot.t_match_his mh,
foot.t_analy_result ar,
(SELECT
ar1.MatchId
FROM
foot.t_analy_result ar1,
foot.t_analy_result ar2
WHERE ar1.MatchId = ar2.MatchId
AND ar1.AlFlag = 'E2'
AND ar2.AlFlag = 'C1'
AND ar1.PreResult = ar2.PreResult
) temp
WHERE mh.LeagueId = l.Id
AND mh.Id = ar.MatchId
AND ar.MatchId = temp.MatchId
AND ar.AlFlag IN ('E2' ,'C1')
`
if len(param.BeginDateStr) > 0 {
sql += " AND mh.`MatchDate` >= '" + param.BeginDateStr + "' "
}
if len(param.EndDateStr) > 0 {
sql += " AND mh.`MatchDate` <= '" + param.EndDateStr + "' "
}
if param.IsDesc {
sql += " ORDER BY ar.MatchDate DESC, l.id ASC,mh.MainTeamId asc, ar.`AlFlag` DESC,ar.PreResult DESC "
} else {
sql += " ORDER BY ar.MatchDate ASC, l.id ASC,mh.MainTeamId asc,ar.`AlFlag` DESC,ar.PreResult DESC "
}
//结果值
dataList := make([]*vo2.SuggStubDetailVO, 0)
//执行查询
this.FindBySQL(sql, &dataList)
if len(dataList) <= 0 {
return dataList
}
for _, v := range dataList {
matchId := v.MatchId
//积分,排名
bfsList := this.BFScoreService.FindByMatchId(matchId)
if len(bfsList) > 0 {
for _, e := range bfsList { //bfs_arr有多语言版本,条数很多
if e.TeamId == v.MainTeam {
if e.Type == "总" {
v.BFSMainZong = e
}
if e.Type == "主" {
v.BFSMainZhu = e
}
if e.Type == "近" {
v.BFSMainJin = e
}
} else if e.TeamId == v.GuestTeam {
if e.Type == "总" {
v.BFSGuestZong = e
}
if e.Type == "客" {
v.BFSGuestKe = e
}
if e.Type == "近" {
v.BFSGuestJin = e
}
}
}
}
if nil == v.BFSMainZong {
v.BFSMainZong = new(pojo.BFScore)
}
if nil == v.BFSMainZhu {
v.BFSMainZhu = new(pojo.BFScore)
}
if nil == v.BFSMainJin {
v.BFSMainJin = new(pojo.BFScore)
}
if nil == v.BFSGuestZong {
v.BFSGuestZong = new(pojo.BFScore)
}
if nil == v.BFSGuestKe {
v.BFSGuestKe = new(pojo.BFScore)
}
if nil == v.BFSGuestJin {
v.BFSGuestJin = new(pojo.BFScore)
}
//过往战绩
bfbList := this.BFBattleService.FindByMatchId(matchId)
battleCount := 0
mainWin := 0
drawCount := 0
guestWin := 0
for _, e := range bfbList {
if e.BattleMainTeamId == v.MainTeam || e.BattleMainTeamId == v.GuestTeam {
battleCount++
}
if e.BattleMainTeamId == v.MainTeam && e.BattleMainTeamGoals > e.BattleGuestTeamGoals {
mainWin++
}
if e.BattleGuestTeamId == v.MainTeam && e.BattleGuestTeamGoals > e.BattleMainTeamGoals {
mainWin++
}
if e.BattleMainTeamId == v.GuestTeam && e.BattleMainTeamGoals > e.BattleGuestTeamGoals {
guestWin++
}
if e.BattleGuestTeamId == v.GuestTeam && e.BattleGuestTeamGoals > e.BattleMainTeamGoals {
guestWin++
}
if (e.BattleMainTeamId == v.MainTeam || e.BattleMainTeamId == v.GuestTeam) && e.BattleMainTeamGoals == e.BattleGuestTeamGoals {
drawCount++
}
}
v.BattleCount = battleCount
v.BattleMainWinCount = mainWin
v.BattleDrawCount = drawCount
v.BattleGuestWinCount = guestWin
//未来赛事
bffe_main := this.BFFutureEventService.FindNextBattle(matchId, v.MainTeam)
if nil != bffe_main {
v.MainNextMainTeam = bffe_main.EventMainTeamId
}
bffe_guest := this.BFFutureEventService.FindNextBattle(matchId, v.GuestTeam)
if nil != bffe_main {
v.GuestNextMainTeam = bffe_guest.EventMainTeamId
}
}
return dataList
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ func (this *MessageService) Today() []response.Article {
matchDateStr := e.MatchDate.Format("01月02日15点04分")
article := response.Article{}
article.Title = fmt.Sprintf("%v", matchDateStr)
article.Description = fmt.Sprintf("%v %v vs %v", e.LeagueName, e.MainTeamId, e.GuestTeamId)
article.Description = fmt.Sprintf("%v %v vs %v", e.LeagueName, e.MainTeam, e.GuestTeam)
article.PicURL = "http://mmbiz.qpic.cn/sz_mmbiz_jpg/BePaFicK2B5QZuw0bf1HsiarnqQXzuWxE9XYC25oe2mVLeguvo6Rd1j1D2ibRibfmpu8eDqs0lfXaEfXR2bhslrPKQ/0?wx_fmt=jpeg"
article.URL = "https://gitee.com/aoe5188/foot-parent"
articles[i] = article
......
......@@ -440,7 +440,10 @@ func (this *SuggestTodayService) ModifyTodayA1(wcClient *core.Client) {
base.Log.Error(err)
}
}
func (this *SuggestTodayService) Print11(){
fmt.Println(constants.SpiderDateStr)
fmt.Println(constants.FullSpiderDateStr)
}
/**
今日待选池比赛
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册