提交 ddea116f 编写于 作者: M monomania

1.分析内容产生中

上级 34f28a6d
基本面:
主队总场,积{{.Score}}分,排名:{{.Ranking}},胜率:{{.WinRate}}%
主队主场,积{{.Score}}分,排名:{{.Ranking}},胜率:{{.WinRate}}%
客队总场,积{{.Score}}分,排名:{{.Ranking}},胜率:{{.WinRate}}%
客队客场,积{{.Score}}分,排名:{{.Ranking}},胜率:{{.WinRate}}%
...@@ -11,7 +11,5 @@ import ( ...@@ -11,7 +11,5 @@ import (
*/ */
type Suggest struct { type Suggest struct {
pojo2.AnalyResult `xorm:"extends"` pojo2.AnalyResult `xorm:"extends"`
} }
package vo
import (
pojo3 "tesou.io/platform/foot-parent/foot-api/module/match/pojo"
pojo2 "tesou.io/platform/foot-parent/foot-api/module/odds/pojo"
"tesou.io/platform/foot-parent/foot-api/module/suggest/pojo"
)
type SuggestDetailVO struct {
MatchDateStr string
//联赛
LeagueName string
//主队
MainTeam string
//客队
GuestTeam string
//主队进球
MainTeamGoal string
//客队进球
GuestTeamGoal string
//指数
HitCount int
//开始时间
BeginDateStr string
//结束时间
EndDateStr string
//是否倒序
IsDesc bool
//算法标识
AlFlags []string
pojo.Suggest `xorm:"extends"`
//欧赔
EOddList []*pojo2.EuroLast
//亚赔
AOddList []*pojo2.AsiaLast
//基本面
BFSList []*pojo3.BFScore
BFBList []*pojo3.BFBattle
BFFEList []*pojo3.BFFutureEvent
}
package vo
type TodayDetailVO struct {
SpiderDateStr string
//开始时间
BeginDateStr string
//结束时间
EndDateStr string
//数据时间
DataDateStr string
DataList []SuggestDetailVO
}
package vo package vo
import "tesou.io/platform/foot-parent/foot-api/module/odds/pojo"
type TodayVO struct { type TodayVO struct {
SpiderDateStr string SpiderDateStr string
//开始时间 //开始时间
...@@ -12,8 +10,4 @@ type TodayVO struct { ...@@ -12,8 +10,4 @@ type TodayVO struct {
DataDateStr string DataDateStr string
DataList []SuggestVO DataList []SuggestVO
EuroOddList []pojo.EuroLast
AsiaOddList []pojo.AsiaLast
} }
...@@ -21,9 +21,9 @@ func (this *EuroLastService) FindExists(v *pojo.EuroLast) bool { ...@@ -21,9 +21,9 @@ func (this *EuroLastService) FindExists(v *pojo.EuroLast) bool {
} }
//根据比赛ID查找欧赔 //根据比赛ID查找欧赔
func (this *EuroLastService) FindByMatchId(v *pojo.EuroLast) []*pojo.EuroLast { func (this *EuroLastService) FindByMatchId(matchId string) []*pojo.EuroLast {
dataList := make([]*pojo.EuroLast, 0) dataList := make([]*pojo.EuroLast, 0)
err := mysql.GetEngine().Where(" MatchId = ? ", v.MatchId).Find(dataList) err := mysql.GetEngine().Where(" MatchId = ? ",matchId).Find(dataList)
if err != nil { if err != nil {
base.Log.Error("FindByMatchId:", err) base.Log.Error("FindByMatchId:", err)
} }
......
...@@ -4,6 +4,8 @@ import ( ...@@ -4,6 +4,8 @@ import (
"strconv" "strconv"
vo2 "tesou.io/platform/foot-parent/foot-api/module/suggest/vo" vo2 "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/base/service/mysql"
service2 "tesou.io/platform/foot-parent/foot-core/module/match/service"
"tesou.io/platform/foot-parent/foot-core/module/odds/service"
) )
/** /**
...@@ -11,6 +13,11 @@ import ( ...@@ -11,6 +13,11 @@ import (
*/ */
type SuggestService struct { type SuggestService struct {
mysql.BaseService mysql.BaseService
service.EuroLastService
service.AsiaLastService
service2.BFScoreService
service2.BFBattleService
service2.BFFutureEventService
} }
/** /**
...@@ -57,7 +64,6 @@ WHERE mh.LeagueId = l.Id ...@@ -57,7 +64,6 @@ WHERE mh.LeagueId = l.Id
this.FindBySQL(sql, &entitys) this.FindBySQL(sql, &entitys)
return entitys return entitys
} }
func (this *SuggestService) Query(param *vo2.SuggestVO) []*vo2.SuggestVO { func (this *SuggestService) Query(param *vo2.SuggestVO) []*vo2.SuggestVO {
...@@ -103,5 +109,68 @@ WHERE mh.LeagueId = l.Id ...@@ -103,5 +109,68 @@ WHERE mh.LeagueId = l.Id
this.FindBySQL(sql, &entitys) this.FindBySQL(sql, &entitys)
return entitys return entitys
}
func (this *SuggestService) QueryDetail(param *vo2.SuggestDetailVO) []*vo2.SuggestDetailVO {
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
WHERE mh.LeagueId = l.Id
AND mh.Id = ar.MatchId
AND ar.HitCount > 0
AND ar.HitCount >= ar.THitCount
`
if param.HitCount > 0 {
sql += " AND ar.HitCount >= '" + strconv.Itoa(param.HitCount) + "' "
}
if len(param.AlFlag) > 0 {
sql += " AND ar.AlFlag in (" + param.AlFlag + ") "
}
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.`AlFlag` DESC,ar.MatchDate DESC, l.id ASC,mh.MainTeamId asc, ar.PreResult DESC "
} else {
sql += " ORDER BY ar.`AlFlag` DESC,ar.MatchDate ASC, l.id ASC,mh.MainTeamId asc,ar.PreResult DESC "
}
//结果值
entitys := make([]*vo2.SuggestDetailVO, 0)
//执行查询
this.FindBySQL(sql, &entitys)
if len(entitys) <= 0 {
return entitys
}
for _, e := range entitys {
matchId := e.MatchId
eOddList := this.EuroLastService.FindByMatchId(matchId)
aOddList := this.AsiaLastService.FindByMatchId(matchId)
bfsList := this.BFScoreService.FindByMatchId(matchId)
bfbList := this.BFBattleService.FindByMatchId(matchId)
bffeList := this.BFFutureEventService.FindByMatchId(matchId)
e.EOddList = eOddList
e.AOddList = aOddList
e.BFSList = bfsList
e.BFBList = bfbList
e.BFFEList = bffeList
}
return entitys
} }
...@@ -161,7 +161,7 @@ func (this *SuggestTodayService) ModifyToday(wcClient *core.Client) { ...@@ -161,7 +161,7 @@ func (this *SuggestTodayService) ModifyToday(wcClient *core.Client) {
今日赛事分析 今日赛事分析
*/ */
func (this *SuggestTodayService) ModifyTodayDetail(wcClient *core.Client) { func (this *SuggestTodayService) ModifyTodayDetail(wcClient *core.Client) {
param := new(vo.SuggestVO) param := new(vo.SuggestDetailVO)
now := time.Now() now := time.Now()
h12, _ := time.ParseDuration("-24h") h12, _ := time.ParseDuration("-24h")
beginDate := now.Add(h12) beginDate := now.Add(h12)
...@@ -171,7 +171,7 @@ func (this *SuggestTodayService) ModifyTodayDetail(wcClient *core.Client) { ...@@ -171,7 +171,7 @@ func (this *SuggestTodayService) ModifyTodayDetail(wcClient *core.Client) {
param.EndDateStr = endDate.Format("2006-01-02 15:04:05") param.EndDateStr = endDate.Format("2006-01-02 15:04:05")
//今日推荐 //今日推荐
param.AlFlag = getAlFlag() param.AlFlag = getAlFlag()
tempList := this.SuggestService.Query(param) tempList := this.SuggestService.QueryDetail(param)
//更新推送 //更新推送
first := material.Article{} first := material.Article{}
first.Title = fmt.Sprintf("赛事解析") first.Title = fmt.Sprintf("赛事解析")
...@@ -180,12 +180,12 @@ func (this *SuggestTodayService) ModifyTodayDetail(wcClient *core.Client) { ...@@ -180,12 +180,12 @@ func (this *SuggestTodayService) ModifyTodayDetail(wcClient *core.Client) {
first.ContentSourceURL = contentSourceURL first.ContentSourceURL = contentSourceURL
first.Author = utils.GetVal("wechat", "author") first.Author = utils.GetVal("wechat", "author")
temp := vo.TodayVO{} temp := vo.TodayDetailVO{}
temp.SpiderDateStr = constants.SpiderDateStr temp.SpiderDateStr = constants.SpiderDateStr
temp.BeginDateStr = param.BeginDateStr temp.BeginDateStr = param.BeginDateStr
temp.EndDateStr = param.EndDateStr temp.EndDateStr = param.EndDateStr
temp.DataDateStr = now.Format("2006-01-02 15:04:05") temp.DataDateStr = now.Format("2006-01-02 15:04:05")
temp.DataList = make([]vo.SuggestVO, len(tempList)) temp.DataList = make([]vo.SuggestDetailVO, len(tempList))
for i, e := range tempList { for i, e := range tempList {
e.MatchDateStr = e.MatchDate.Format("02号15:04") e.MatchDateStr = e.MatchDate.Format("02号15:04")
temp.DataList[i] = *e temp.DataList[i] = *e
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册