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

1.移除mysql.Show的设置 2.更新算法分析名称带上时间归类

上级 386d18a8
......@@ -9,7 +9,7 @@ import (
func main() {
//开启SQL输出
mysql.ShowSQL(true)
pubService := new(service.PubService)
pubService.PubBJDC()
......
......@@ -7,16 +7,19 @@ import (
"io"
"math/rand"
"strconv"
"tesou.io/platform/foot-parent/foot-core/common/base/service/mysql"
utils2 "tesou.io/platform/foot-parent/foot-core/common/utils"
service2 "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/leisu/service"
"tesou.io/platform/foot-parent/foot-core/module/leisu/utils"
"tesou.io/platform/foot-parent/foot-spider/launch"
"time"
)
func main() {
//测试获取比赛
launch.Spider_match(4)
//测试获取配置
val := utils2.GetVal("cookies", "Hm_lpvt_2fb6939e65e63cfbc1953f152ec2402e")
fmt.Println(val)
......@@ -49,9 +52,9 @@ func main() {
fmt.Println(time.Duration(int64(24 - hours)))
//测试分析结果获取及更新
mysql.ShowSQL(true)
analyService := new(service2.AnalyService)
list := analyService.GetPubDataList("Euro81_616_104Service", 0, -1)
list := analyService.GetPubDataList("Euro20191206Service", 0, -1)
result := &list[0].AnalyResult
analyService.Modify(result)
......
......@@ -8,6 +8,6 @@ import (
func main() {
//开启SQL输出
mysql.ShowSQL(true)
launch.Spider_asiaLastNew()
}
......@@ -9,7 +9,7 @@ import (
//抓取欧赔数据少于两条的不完整的比赛
func main() {
//开启SQL输出
mysql.ShowSQL(true)
launch.Spider_euroHis_Incomplete(3)
}
......@@ -8,7 +8,7 @@ import (
func main() {
//开启SQL输出
mysql.ShowSQL(true)
launch.Spider_euroLast()
launch.Spider_euroHis()
}
......@@ -27,7 +27,7 @@ cycle_time=30
#示例0-3:-1,4-18:3,19-23:-1,未设置时间段为默认只推送3
team_option=0-3:-1,4-18:3,19-23:3
###使用的算法
al_flag=Euro616_104Service
al_flag=Euro20191212Service
###处法命中次数
hit_count=3
###标题模板,为空则使用默认模板.支持格式如下:
......
......@@ -48,7 +48,7 @@ func setEngine() *xorm.Engine {
//engine.ShowExecTime(true)
//则会在控制台打印出生成的SQL语句
//则会在控制台打印调试及以上的信息
//engine.ShowSQL(true)
engine.ShowSQL(true)
//engine.Logger().SetLevel(core.LOG_DEBUG)
engine.SetMaxIdleConns(maxIdle)
engine.SetMaxOpenConns(maxConn)
......
......@@ -7,7 +7,7 @@ import (
func TruncateTable() {
//开启SQL输出
mysql.ShowSQL(true)
opsService := new(mysql.DBOpsService)
//指定需要清空的数据表
opsService.TruncateTable([]string{"t_match_last", "t_asia_last", "t_euro_last", "t_euro_his"})
......@@ -15,7 +15,7 @@ func TruncateTable() {
func GenTable() {
//开启SQL输出
mysql.ShowSQL(true)
generateService := new(mysql.DBOpsService)
generateService.SyncTableStruct()
}
......@@ -11,22 +11,23 @@ func Analy() {
//关闭SQL输出
mysql.ShowSQL(false)
base.Log.Info("---------------------------------------------------------------")
base.Log.Info("----------------Euro616_104Service-------------------")
base.Log.Info("----------------Euro20191212Service-------------------")
base.Log.Info("---------------------------------------------------------------")
euro616_104Service := new(service.Euro616_104Service)
euro616_104Service := new(service.Euro20191212Service)
euro616_104Service.MaxLetBall = 0.5
euro616_104Service.PrintOddData = false
euro616_104Service.Analy()
base.Log.Info("---------------------------------------------------------------")
base.Log.Info("----------------Euro81_616_104Service-------------------")
base.Log.Info("----------------Euro20191206Service-------------------")
base.Log.Info("---------------------------------------------------------------")
euro_81_616Service := new(service.Euro81_616_104Service)
euro_81_616Service := new(service.Euro20191206Service)
euro_81_616Service.MaxLetBall = 0.75
euro_81_616Service.PrintOddData = false
euro_81_616Service.Analy()
base.Log.Info("---------------------------------------------------------------")
base.Log.Info("---------------Asia18EuroUDReverseService--------------")
base.Log.Info("---------------Asia20191206Service--------------")
base.Log.Info("---------------------------------------------------------------")
euro81616Service := new(service.Asia18EuroUDReverseService)
euro81616Service := new(service.Asia20191206Service)
euro81616Service.Analy()
mysql.ShowSQL(true)
}
......@@ -12,7 +12,7 @@ import (
/**
亚赔与欧赔up down 颠倒
*/
type Asia18EuroUDReverseService struct {
type Asia20191206Service struct {
AnalyService
//最大让球数据
MaxLetBall float64
......@@ -23,7 +23,7 @@ type Asia18EuroUDReverseService struct {
( 1.欧赔降水,亚赔反之,以亚赔为准)
( 2.欧赔升水,亚赔反之,以亚赔为准)
*/
func (this *Asia18EuroUDReverseService) Analy() {
func (this *Asia20191206Service) Analy() {
matchList := this.MatchLastService.FindAll()
data_list_slice := make([]interface{}, 0)
data_modify_list_slice := make([]interface{}, 0)
......@@ -47,7 +47,7 @@ func (this *Asia18EuroUDReverseService) Analy() {
this.AnalyService.ModifyList(data_modify_list_slice)
}
func (this *Asia18EuroUDReverseService) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult) {
func (this *Asia20191206Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult) {
matchId := v.Id
//声明使用变量
var e81data *entity3.EuroLast
......
......@@ -10,7 +10,7 @@ import (
"time"
)
type Euro81_616_104Service struct {
type Euro20191206Service struct {
AnalyService
//最大让球数据
MaxLetBall float64
......@@ -19,7 +19,7 @@ type Euro81_616_104Service struct {
/**
计算欧赔81 616的即时盘,和初盘的差异
*/
func (this *Euro81_616_104Service) Analy() {
func (this *Euro20191206Service) Analy() {
matchList := this.MatchLastService.FindAll()
data_list_slice := make([]interface{}, 0)
data_modify_list_slice := make([]interface{}, 0)
......@@ -45,7 +45,7 @@ func (this *Euro81_616_104Service) Analy() {
}
func (this *Euro81_616_104Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult) {
func (this *Euro20191206Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult) {
matchId := v.Id
//声明使用变量
var e81data *entity3.EuroLast
......
......@@ -10,7 +10,7 @@ import (
"time"
)
type Euro616_104Service struct {
type Euro20191212Service struct {
AnalyService
//最大让球数据
MaxLetBall float64
......@@ -19,7 +19,7 @@ type Euro616_104Service struct {
/**
计算欧赔81 616的即时盘,和初盘的差异
*/
func (this *Euro616_104Service) Analy() {
func (this *Euro20191212Service) Analy() {
matchList := this.MatchLastService.FindAll()
data_list_slice := make([]interface{}, 0)
data_modify_list_slice := make([]interface{}, 0)
......@@ -45,7 +45,7 @@ func (this *Euro616_104Service) Analy() {
}
func (this *Euro616_104Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult) {
func (this *Euro20191212Service) analyStub(v *pojo.MatchLast) (int, *entity5.AnalyResult) {
matchId := v.Id
//声明使用变量
var e616data *entity3.EuroLast
......
package service
import "tesou.io/platform/foot-parent/foot-core/common/base/service/mysql"
import (
"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-core/common/base/service/mysql"
)
type MatchHisService struct {
mysql.BaseService
}
func (this *MatchHisService) FindExists(v *pojo.MatchHis) bool {
has, err := mysql.GetEngine().Table("`t_match_his`").Where(" `Id` = ? ", v.Id).Exist()
if err != nil {
base.Log.Info("FindExists", err)
}
return has
}
......@@ -17,11 +17,11 @@ type MatchLastService struct {
通过比赛时间,主队id,客队id,判断比赛信息是否已经存在
*/
func (this *MatchLastService) FindExists(v *pojo.MatchLast) bool {
exist, err := mysql.GetEngine().Exist(&pojo.MatchLast{MatchDate: v.MatchDate, MainTeamId: v.MainTeamId, GuestTeamId: v.GuestTeamId})
has, err := mysql.GetEngine().Table("`t_match_last`").Where(" `Id` = ? ", v.Id).Exist()
if err != nil {
base.Log.Info("FindExists:", err)
base.Log.Info("FindExists", err)
}
return exist
return has
}
func (this *MatchLastService) FindAll() []*pojo.MatchLast {
......
......@@ -2,14 +2,13 @@ package launch
import (
"strconv"
"tesou.io/platform/foot-parent/foot-core/common/base/service/mysql"
"tesou.io/platform/foot-parent/foot-core/common/utils"
"tesou.io/platform/foot-parent/foot-core/launch"
)
func Spider() {
//开启SQL输出
mysql.ShowSQL(true)
//清空数据表
launch.TruncateTable()
Before_spider_match()
......
......@@ -18,6 +18,7 @@ import (
type MatchPageProcesser struct {
service.MatchLastService
service.MatchHisService
service2.LeagueService
service2.CompService
//抓取的url
......@@ -192,15 +193,14 @@ func (this *MatchPageProcesser) Finish() {
this.LeagueService.SaveList(league_list_slice)
matchLast_list_slice := make([]interface{}, 0)
matchLast_modify_list_slice := make([]interface{}, 0)
matchHis_list_slice := make([]interface{}, 0)
matchHis_modify_list_slice := make([]interface{}, 0)
for _, v := range matchLast_list {
if nil == v {
continue
}
exists := this.MatchLastService.FindExists(v)
if exists {
continue
}
//v.Id = v.Ext["win007Id"].(string);
//处理比赛配置信息
......@@ -212,8 +212,26 @@ func (this *MatchPageProcesser) Finish() {
matchExt.Sid = v.Id
v.Ext = make(map[string]interface{})
v.Ext[win007.MODULE_FLAG] = matchExt
matchLast_list_slice = append(matchLast_list_slice, v)
exists := this.MatchLastService.FindExists(v)
if exists {
matchLast_modify_list_slice = append(matchLast_modify_list_slice,v)
}else{
matchLast_list_slice = append(matchLast_list_slice, v)
}
his := new(pojo.MatchHis)
his.MatchLast = *v
his_exists := this.MatchHisService.FindExists(his)
if his_exists {
matchHis_modify_list_slice = append(matchHis_modify_list_slice,his)
}else{
matchHis_list_slice = append(matchHis_list_slice, his)
}
}
this.MatchLastService.SaveList(matchLast_list_slice)
this.MatchLastService.ModifyList(matchLast_modify_list_slice)
this.MatchHisService.SaveList(matchHis_list_slice)
this.MatchHisService.ModifyList(matchHis_modify_list_slice)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册