提交 c0eaf980 编写于 作者: M monomania

1.增加稳胆统计

上级 545a4ac0
......@@ -38,7 +38,10 @@
<td><span style="color: {{color .AlFlag}}">{{.AlFlag}}</span></td>
<td>{{.MatchDateStr}}</td>
<td>{{.LeagueName}}</td>
<td>{{.MainTeam}}({{.LetBall}}){{.GuestTeam}}</td>
<td>
{{.MainTeam}}({{.LetBall}}){{.GuestTeam}}
{{if .TOVoid}}<span style="color: red;">{{if .TOVoidDesc}}斥{{end}}</span></del>{{end}}
</td>
<td>
{{.MainTeamGoal}}:{{.GuestTeamGoal}}
</td>
......
......@@ -42,10 +42,11 @@
<td>{{.MatchDateStr}}</td>
<td>{{.LeagueName}}</td>
<td>
{{.MainTeam}}({{.LetBall}}){{.GuestTeam}}
{{.MainTeam}}({{.LetBall}}){{.GuestTeam}}
{{if .TOVoid}}<span style="color: red;">{{if .TOVoidDesc}}斥{{end}}</span></del>{{end}}
</td>
<td>
{{.MainTeamGoal}}:{{.GuestTeamGoal}}
{{.MainTeamGoal}}:{{.GuestTeamGoal}}
</td>
<td style="background-color: {{resultColor .Result}}">
{{preResultStr .PreResult .AlFlag}}
......
<div>
<img src="http://mmbiz.qpic.cn/sz_mmbiz_gif/BePaFicK2B5R6lNrnAdOpR63megZibx7GnwXTAl2yZTEibKIbCFrs0QpsmOWG0CrxWEicHldX2ibqva6Ise5G5vILCQ/0?wx_fmt=gif"/>
</div>
<h1><strong>概况</strong></h1>
<ul style="font-size: 12px;font-weight: bold">
<li>日期:{{.BeginDateStr}} 至 {{.EndDateStr}}</li>
<li>总场次:{{.MatchCount}}</li>
<li><span style="color: greenyellow; ">走:{{.WalkCount}}</span></li>
<li><span style="color: red; ">最长连红:{{.LinkRedCount}}</span></li>
<li><span style="color: gray; ">最长连黑:{{.LinkBlackCount}}</span></li>
<li>全模型统计,
<span style="color: red; ">红:{{.RedCount}},</span>
<span style="color: gray; ">黑:{{.BlackCount}},</span>
胜率:{{.RedCount}}/({{.RedCount}}+{{.BlackCount}})={{.Val}}
</li>
<li>单方向统计,
<span style="color: red; ">红:{{.MainRedCount}},</span>
<span style="color: gray; ">黑:{{.MainBlackCount}},</span>
胜率:{{.MainRedCount}}/({{.MainRedCount}}+{{.MainBlackCount}})={{.MainVal}}
</li>
</ul>
<hr/>
<h1 style="margin-top: 5px">
<div style="float: left;width: 50%"><strong>赛事列表</strong></div>
</h1>
<table style="font-size: 12px;font-weight: bold">
<tr>
<td>模型</td>
<td>时间</td>
<td>联赛</td>
<td>主队(让球)客队</td>
<td>比分</td>
<td>推荐</td>
</tr>
{{with .DataList}}
{{range .}}
<tr>
<td><span style="color: {{color .AlFlag}}">{{.AlFlag}}</span></td>
<td>{{.MatchDateStr}}</td>
<td>{{.LeagueName}}</td>
<td>{{.MainTeam}}({{.LetBall}}){{.GuestTeam}}
{{if .TOVoid}}<span style="color: red;">{{if .TOVoidDesc}}斥{{end}}</span></del>{{end}}
</td>
<td>
{{.MainTeamGoal}}:{{.GuestTeamGoal}}
</td>
<td style="background-color: {{resultColor .Result}}">
{{preResultStr .PreResult .AlFlag}}
</td>
</tr>
{{end}}
{{end}}
</table>
<span style="color: red;font-weight: bold;font-size: 12px">声明:彩市有风险,购彩需谨慎.AI球探只提供预测参考,不构成购彩建议,据AI球探购彩者风险自担.</span>
{{/*
<div>
<img src="http://mmbiz.qpic.cn/sz_mmbiz_png/BePaFicK2B5R6lNrnAdOpR63megZibx7Gnqj9UlhbGMnKbDYmfkFvIhRsz5LEK27Fukf0sE8NzOlNI2nALx25icQQ/0?wx_fmt=png">
</div>*/}}
......@@ -19,5 +19,6 @@ func (this *MaterialService) ModifyNews(wcClient *core.Client) {
this.SuggestWeekService.ModifyWeek(wcClient)
this.SuggestMonthService.ModifyMonth(wcClient)
this.SuggestMonthService.ModifyGutsWeek(wcClient)
this.SuggestMonthService.ModifyGutsMonth(wcClient)
}
......@@ -9,6 +9,7 @@ import (
"strconv"
"strings"
"tesou.io/platform/foot-parent/foot-api/common/base"
"tesou.io/platform/foot-parent/foot-api/module/match/pojo"
"tesou.io/platform/foot-parent/foot-api/module/suggest/vo"
"tesou.io/platform/foot-parent/foot-core/common/base/service/mysql"
"tesou.io/platform/foot-parent/foot-core/common/utils"
......@@ -26,6 +27,7 @@ type SuggestWeekService struct {
}
const week_thumbMediaId = "chP-LBQxy9SVbAFjwZ4QEo81I0bHaY3YDYRwVGmf7o8"
const week_guts_thumbMediaId = "chP-LBQxy9SVbAFjwZ4QEthz2PGUtpVZdZccay_qCi0"
const week_mediaId = "chP-LBQxy9SVbAFjwZ4QEgcfOu5CZ67hiBgn5qnZ-Ac"
func (this *SuggestWeekService) Week(wcClient *core.Client) string {
......@@ -142,3 +144,107 @@ func (this *SuggestWeekService) ModifyWeek(wcClient *core.Client) {
base.Log.Error(err)
}
}
func (this *SuggestMonthService) ModifyGutsWeek(wcClient *core.Client) {
param := new(vo.SuggStubVO)
now := time.Now()
h2, _ := time.ParseDuration("-2h")
endDate := now.Add(h2)
param.EndDateStr = endDate.Format("2006-01-02 15:04:05")
h168, _ := time.ParseDuration("-168h")
beginDate := now.Add(h168)
param.BeginDateStr = beginDate.Format("2006-01-02 15:04:05")
param.IsDesc = true
tempList := this.SuggestService.QueryGuts(param)
//更新推送
first := material.Article{}
first.Title = "稳胆七天战绩"
first.Digest = fmt.Sprintf("%v-%v", beginDate.Format("2006年01月02日"), now.Format("2006年01月02日"))
first.ThumbMediaId = week_guts_thumbMediaId
first.ContentSourceURL = contentSourceURL
first.Author = utils.GetVal("wechat", "author")
temp := vo.TMonthVO{}
temp.SpiderDateStr = constants.SpiderDateStr
temp.FullSpiderDateStr = constants.FullSpiderDateStr
temp.BeginDateStr = param.BeginDateStr
temp.EndDateStr = param.EndDateStr
temp.MatchCount = int64(len(tempList))
var redCount, walkCount, blackCount, linkRedCount, tempLinkRedCount, linkBlackCount, tempLinkBlackCount int64
temp.DataList = make([]vo.SuggStubVO, len(tempList))
for i, e := range tempList {
if strings.EqualFold(constants2.HIT, e.Result) || strings.EqualFold(constants2.HIT_1, e.Result) {
redCount++
tempLinkRedCount++
tempLinkBlackCount = 0
} else if strings.EqualFold(constants2.UNHIT, e.Result) {
blackCount++
tempLinkBlackCount++
tempLinkRedCount = 0
} else {
walkCount++
}
if tempLinkRedCount > linkRedCount {
linkRedCount = tempLinkRedCount
}
if tempLinkBlackCount > linkBlackCount {
linkBlackCount = tempLinkBlackCount
}
e.MatchDateStr = e.MatchDate.Format("02号15:04")
temp.DataList[i] = *e
}
temp.RedCount = redCount
temp.WalkCount = walkCount
temp.BlackCount = blackCount
temp.LinkRedCount = linkRedCount
temp.LinkBlackCount = linkBlackCount
val := float64(redCount) / (float64(redCount) + float64(blackCount)) * 100
val, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", val), 64)
temp.Val = strconv.FormatFloat(val, 'f', -1, 64) + "%"
//计算单方向胜率
var mainRedCount, mainBlackCount int64
for _, e := range tempList {
last := new(pojo.MatchLast)
last.Id = e.MatchId
last.LeagueId = e.LeagueName
last.MatchDate = e.MatchDate
last.MainTeamId = e.MainTeam
last.MainTeamGoals, _ = strconv.Atoi(e.MainTeamGoal)
last.GuestTeamId = e.GuestTeam
last.GuestTeamGoals, _ = strconv.Atoi(e.GuestTeamGoal)
option := this.AnalyService.IsRight(last, &e.AnalyResult)
if option == constants2.HIT || option == constants2.HIT_1{
mainRedCount++
}
if option == constants2.UNHIT {
mainBlackCount++
}
}
mainRedCount /= 2
mainBlackCount /= 2
temp.MainRedCount = mainRedCount
temp.MainBlackCount = mainBlackCount
value := float64(mainRedCount) / (float64(mainRedCount) + float64(mainBlackCount)) * 100
value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64)
temp.MainVal = strconv.FormatFloat(value, 'f', -1, 64) + "%"
var buf bytes.Buffer
tpl, err := template.New("week_guts.html").Funcs(getFuncMap()).ParseFiles("assets/wechat/html/week_guts.html")
if err != nil {
base.Log.Error(err)
}
if err := tpl.Execute(&buf, &temp); err != nil {
base.Log.Fatal(err)
}
first.Content = buf.String()
err = material.UpdateNews(wcClient, week_mediaId, 1, &first)
if err != nil {
base.Log.Error(err)
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册