提交 72ecb590 编写于 作者: M monomania

1.增加主推模型胜率统计

上级 762ec344
......@@ -53,6 +53,13 @@ func getFuncMap() map[string]interface{} {
}
func main() {
var mainRedCount, mainBlackCount int64
mainRedCount =27
mainBlackCount = 22
value := float64(mainRedCount) / (float64(mainRedCount) + float64(mainBlackCount)) *100
value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64)
fmt.Println(strconv.FormatFloat(value,'f', -1, 64)+"%")
//测试
suggestService := new(service3.SuggestService)
i := vo.SuggestVO{}
......
......@@ -7,6 +7,7 @@
<li><span style="color: gray; "><strong>黑(错误):{{.BlackCount}}</strong></span></li>
<li><span style="color: red; "><strong>最长连红:{{.LinkRedCount}}</strong></span></li>
<li><span style="color: gray; "><strong>最长连黑:{{.LinkBlackCount}}</strong></span></li>
<li style="font-size: 12px;font-weight: bold"><strong>E2模型统计,红(正确):{{.MainRedCount}} 黑(错误):{{.MainBlackCount}},胜率:{{.MainRedCount}}/({{.MainRedCount}}+{{.MainBlackCount}})={{.MainVal}}</strong></li>
</ul>
<hr/>
<h1 style="margin-top: 5px">
......@@ -40,7 +41,7 @@
style="background-color: orange"
{{end}}
>
{{preResultStr .PreResult}}({{alFlagStr .AlFlag}})
{{preResultStr .PreResult}}<span style="color: {{color .AlFlag}}">({{alFlagStr .AlFlag}})</span>
</td>
</tr>
......
......@@ -5,7 +5,7 @@
<li><strong>3.推荐的场次为当前时间"往前推12个小时"至"往后推24小时"的比赛.</strong></li>
<li style="text-shadow: 0 0 7px blue"><strong>(重要)4.推荐的场次会随指数的变化而变化,如再次进入不见上次推荐的比赛,请查看"待选池比赛".</strong></li>
<li><strong>5.推荐选项跟着的字母,如A1 A2 E1 E2,为算法模型标识,仅是为了方便观察不同模型的表现.</strong></li>
<li style="text-shadow: 0 0 7px blue"><strong>(重要)6.建议多关注支持模型E2的比赛.</strong></li>
<li style="text-shadow: 0 0 7px blue"><strong>(重要)6.公众号主推模型为E2,敬请关注.</strong></li>
</ul>
<hr/>
<ul style="font-size: 12px;font-weight: lighter">
......@@ -21,7 +21,7 @@
<span style="color: orangered">A2</span>
<span style="color: blue">E1</span>
<span style="color: darkblue">E2</span>
<span style="color: blue">Q1</span>
<span style="color: olivedrab">Q1</span>
</div>
</h1>
<table style="font-size: 12px;font-weight: bold">
......@@ -53,7 +53,7 @@
style="background-color: orange"
{{end}}
>
{{preResultStr .PreResult}}({{alFlagStr .AlFlag}})
{{preResultStr .PreResult}}<span style="color: {{color .AlFlag}}">({{alFlagStr .AlFlag}})</span>
</td>
</tr>
......
......@@ -5,7 +5,7 @@
<li><strong>3.推荐的场次为当前时间"往前推12个小时"至"往后推24小时"的比赛.</strong></li>
<li style="text-shadow: 0 0 7px blue"><strong>(重要)4.推荐的场次会随指数的变化而变化,如再次进入不见上次推荐的比赛,请查看"待选池比赛".</strong></li>
<li><strong>5.推荐选项跟着的字母,如A1 A2 E1 E2,为算法模型标识,仅是为了方便观察不同模型的表现.</strong></li>
<li style="text-shadow: 0 0 7px blue"><strong>(重要)6.建议多关注支持模型E2的比赛.</strong></li>
<li style="text-shadow: 0 0 7px blue"><strong>(重要)6.公众号主推模型为E2,敬请关注.</strong></li>
</ul>
<hr/>
<ul style="font-size: 12px;font-weight: lighter">
......@@ -20,9 +20,9 @@
<li>比赛时间:{{.MatchDateStr}}</li>
<li>联  赛:{{.LeagueName}}</li>
<li>对阵双方:{{.MainTeam}}({{.LetBall}}){{.GuestTeam}}</li>
<li>算法模型:<span style="color: red;font-weight: bold;">{{alFlagStr .AlFlag}}</span></li>
<li>球探指数:<span style="color: red;font-weight: bold;">{{.HitCount}}(指数越大,越稳定)</span></li>
<li>推荐选项:<span style="color: red;font-weight: bold;">{{preResultStr .PreResult}}</span></li>
<li>算法模型:<span style="color: {{color .AlFlag}}">({{alFlagStr .AlFlag}})</span></li>
<li>球探指数:{{.HitCount}}<span style="color: red;font-weight: bold;">(指数越大,越稳定)</span></li>
<li>推荐选项:{{preResultStr .PreResult}}</li>
<li>说  明:<span style="color: red;font-weight: bold;">程序只分析预测胜负,平局仅作为次防选项.历史统计以亚指为依据.</span></li>
</ul>
<hr/>
......
......@@ -5,7 +5,7 @@
<li style="text-shadow: 0 0 7px blue"><strong>(重要)3.获取最新推荐请发送"今日推荐"给公众号.</strong></li>
<li><strong>4.待选的场次为当前时间"往前推48小时"至"往后推24小时"的比赛.</strong></li>
<li><strong>5.待选的场次会随指数的变化而变化,如再次进入不见上次待选的比赛,请查看"今日推荐".</strong></li>
<li style="text-shadow: 0 0 7px blue"><strong>(重要)6.建议多关注支持模型E2的比赛.</strong></li>
<li style="text-shadow: 0 0 7px blue"><strong>(重要)6.公众号主推模型为E2,敬请关注.</strong></li>
</ul>
<hr/>
<ul style="font-size: 12px;font-weight: lighter">
......@@ -17,11 +17,11 @@
<div style="float: left;width: 40%"><strong>赛事列表</strong></div>
<div style="float: right;width: 40%;font-weight: bold;font-size: 12px">
模型:
<span style="color: orange">A1</span>
<span style="color: orangered">A2</span>
<span style="color: blue">E1</span>
<span style="color: darkblue">E2</span>
<span style="color: blue">Q1</span>
<span style="color: orange">A1</span>
<span style="color: orangered">A2</span>
<span style="color: blue">E1</span>
<span style="color: darkblue">E2</span>
<span style="color: olivedrab">Q1</span>
</div>
</h1>
<table style="font-size: 12px;font-weight: bold">
......@@ -44,7 +44,7 @@
{{.MainTeamGoal}}:{{.GuestTeamGoal}}
</td>
<td>
{{preResultStr .PreResult}}({{alFlagStr .AlFlag}})
{{preResultStr .PreResult}}<span style="color: {{color .AlFlag}}">({{alFlagStr .AlFlag}})</span>
</td>
<td style="color: red">
<strong>{{.HitCount}}</strong>
......
......@@ -7,6 +7,7 @@
<li><span style="color: gray; "><strong>黑(错误):{{.BlackCount}}</strong></span></li>
<li><span style="color: red; "><strong>最长连红:{{.LinkRedCount}}</strong></span></li>
<li><span style="color: gray; "><strong>最长连黑:{{.LinkBlackCount}}</strong></span></li>
<li style="font-size: 12px;font-weight: bold"><strong>E2模型统计,红(正确):{{.MainRedCount}} 黑(错误):{{.MainBlackCount}},胜率:{{.MainRedCount}}/({{.MainRedCount}}+{{.MainBlackCount}})={{.MainVal}}</strong></li>
</ul>
<hr/>
<h1 style="margin-top: 5px">
......@@ -40,7 +41,7 @@
style="background-color: orange"
{{end}}
>
{{preResultStr .PreResult}}({{alFlagStr .AlFlag}})
{{preResultStr .PreResult}}<span style="color: {{color .AlFlag}}">({{alFlagStr .AlFlag}})</span>
</td>
</tr>
......
[mysql]
url=root:Meta.123@tcp(localhost:3306)/foot?charset=utf8
#url=root:awe.FOG5188@tcp(39.108.212.245:3306)/foot?charset=utf8
maxIdle=10
maxConn=50
[cookies]
......@@ -52,7 +53,8 @@ content_tpl="本次推荐为程序全自动处理,全程无人为参与干预.
price_strategy=0
[wechat]
###推荐使用的算法
#al_flag=Euro20191212Service
al_flag='Asia20191206Service','Euro20191206Service','Euro20191212Service'
main_al_flag='','Euro20191212Service'
OriId=gh_a8328f3c25d2
AppID=wx76e3dd0445aa0055
AppSecret=4257a40eb6f59e50777fdcc2b47b31a4
......
......@@ -52,7 +52,8 @@ content_tpl="本次推荐为程序全自动处理,全程无人为参与干预.
price_strategy=0
[wechat]
###推荐使用的算法
#al_flag=Euro20191212Service
al_flag='Asia20191206Service','Euro20191206Service','Euro20191212Service'
main_al_flag='','Euro20191212Service'
OriId=gh_a8328f3c25d2
AppID=wx76e3dd0445aa0055
AppSecret=4257a40eb6f59e50777fdcc2b47b31a4
......
......@@ -19,5 +19,12 @@ type MonthVO struct {
//最长连黑
LinkBlackCount int64
//红
MainRedCount int64
//黑
MainBlackCount int64
//胜率
MainVal string
DataList []SuggestVO
}
......@@ -19,5 +19,14 @@ type WeekVO struct {
//最长连黑
LinkBlackCount int64
//红
MainRedCount int64
//黑
MainBlackCount int64
//胜率
MainVal string
DataList []SuggestVO
}
......@@ -81,7 +81,7 @@ WHERE mh.LeagueId = l.Id
}
if len(param.AlFlag) > 0 {
sql += " AND ar.AlFlag = '" + param.AlFlag + "' "
sql += " AND ar.AlFlag in (" + param.AlFlag + ") "
}
if len(param.BeginDateStr) > 0 {
sql += " AND mh.`MatchDate` >= '" + param.BeginDateStr + "' "
......
......@@ -6,6 +6,7 @@ import (
"github.com/chanxuehong/wechat/mp/core"
"github.com/chanxuehong/wechat/mp/material"
"html/template"
"strconv"
"strings"
"tesou.io/platform/foot-parent/foot-api/common/base"
"tesou.io/platform/foot-parent/foot-api/module/suggest/vo"
......@@ -62,7 +63,7 @@ func (this *SuggestMonthService) ModifyMonth(wcClient *core.Client) {
first.Digest = fmt.Sprintf("%v-%v", beginDate.Format("2006年01月02日"), now.Format("2006年01月02日"))
first.ThumbMediaId = month_thumbMediaId
first.ContentSourceURL = contentSourceURL
first.Author = utils.GetVal("wechat","author")
first.Author = utils.GetVal("wechat", "author")
temp := vo.WeekVO{}
temp.BeginDateStr = param.BeginDateStr
......@@ -100,6 +101,25 @@ func (this *SuggestMonthService) ModifyMonth(wcClient *core.Client) {
temp.LinkRedCount = linkRedCount
temp.LinkBlackCount = linkBlackCount
//计算主要模型胜率
param.AlFlag = getMainAlFlag()
mainTempList := this.SuggestService.Query(param)
var mainRedCount, mainBlackCount int64
for _, e := range mainTempList {
if e.PreResult == 3 && e.MainTeamGoal >= e.GuestTeamGoal{
mainRedCount++
}else if e.PreResult == 0 && e.MainTeamGoal <= e.GuestTeamGoal{
mainRedCount++
}else{
mainBlackCount++
}
}
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("month.html").Funcs(getFuncMap()).ParseFiles("assets/wechat/html/month.html")
if err != nil {
......@@ -114,4 +134,4 @@ func (this *SuggestMonthService) ModifyMonth(wcClient *core.Client) {
if err != nil {
base.Log.Error(err)
}
}
\ No newline at end of file
}
......@@ -45,10 +45,24 @@ func alFlagStr(str string) string {
return "XX"
}
func color(str string) string {
if "Asia20191206Service" == str {
return "orange"
} else if "Euro20191206Service" == str {
return "blue"
} else if "Euro20191212Service" == str {
return "darkblue"
}else if "Euro20191226Service" == str{
return "olivedrab"
}
return "XX"
}
func getFuncMap() map[string]interface{} {
funcMap := template.FuncMap{
"preResultStr": preResultStr,
"alFlagStr": alFlagStr,
"color": color,
}
return funcMap
}
......@@ -58,6 +72,11 @@ func getAlFlag() string{
return al_flag;
}
func getMainAlFlag() string{
al_flag := utils.GetVal("wechat", "main_al_flag")
return al_flag;
}
const contentSourceURL = "https://gitee.com/aoe5188/foot"
const today_thumbMediaId = "chP-LBQxy9SVbAFjwZ4QEuxc8rI6Dy-bm5n3yZbsuJA"
const today_detail_thumbMediaId = "chP-LBQxy9SVbAFjwZ4QEgIU_dXnFnXHvYzocwCpkM4"
......@@ -197,8 +216,8 @@ func (this *SuggestTodayService) ModifyTodayTbs(wcClient *core.Client) {
h12, _ = time.ParseDuration("24h")
endDate := now.Add(h12)
param.EndDateStr = endDate.Format("2006-01-02 15:04:05")
//今日推荐
param.AlFlag = getAlFlag()
//待选池释放Q1
param.AlFlag = ""
tempList := this.SuggestService.QueryTbs(param)
//更新推送
first := material.Article{}
......
......@@ -6,6 +6,7 @@ import (
"github.com/chanxuehong/wechat/mp/core"
"github.com/chanxuehong/wechat/mp/material"
"html/template"
"strconv"
"strings"
"tesou.io/platform/foot-parent/foot-api/common/base"
"tesou.io/platform/foot-parent/foot-api/module/suggest/vo"
......@@ -25,7 +26,6 @@ type SuggestWeekService struct {
const week_thumbMediaId = "chP-LBQxy9SVbAFjwZ4QEo81I0bHaY3YDYRwVGmf7o8"
const week_mediaId = "chP-LBQxy9SVbAFjwZ4QEgcfOu5CZ67hiBgn5qnZ-Ac"
func (this *SuggestWeekService) Week(wcClient *core.Client) string {
articles := make([]material.Article, 1)
first := material.Article{}
......@@ -64,7 +64,7 @@ func (this *SuggestWeekService) ModifyWeek(wcClient *core.Client) {
first.ThumbMediaId = week_thumbMediaId
first.ContentSourceURL = contentSourceURL
first.ShowCoverPic = 0
first.Author = utils.GetVal("wechat","author")
first.Author = utils.GetVal("wechat", "author")
temp := vo.WeekVO{}
temp.BeginDateStr = param.BeginDateStr
temp.EndDateStr = param.EndDateStr
......@@ -101,6 +101,25 @@ func (this *SuggestWeekService) ModifyWeek(wcClient *core.Client) {
temp.LinkRedCount = linkRedCount
temp.LinkBlackCount = linkBlackCount
//计算主要模型胜率
param.AlFlag = getMainAlFlag()
mainTempList := this.SuggestService.Query(param)
var mainRedCount, mainBlackCount int64
for _, e := range mainTempList {
if e.PreResult == 3 && e.MainTeamGoal >= e.GuestTeamGoal{
mainRedCount++
}else if e.PreResult == 0 && e.MainTeamGoal <= e.GuestTeamGoal{
mainRedCount++
}else{
mainBlackCount++
}
}
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.html").Funcs(getFuncMap()).ParseFiles("assets/wechat/html/week.html")
if err != nil {
......@@ -115,4 +134,4 @@ func (this *SuggestWeekService) ModifyWeek(wcClient *core.Client) {
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.
先完成此消息的编辑!
想要评论请 注册