|
|
@@ -186,6 +186,10 @@ func (s *SyncData) SyncTaskData() {
|
|
|
num, _ := s.SyncXmyFreeData(date, gameIdXmy)
|
|
|
if num != 0 {
|
|
|
gameTarget.PayTarget = num
|
|
|
+ if gameTarget.PayTarget > completeTaskData[gameTask.TaskId].PayTarget {
|
|
|
+ lastPayAddUpdateTimeKey := fmt.Sprintf(LastPayAddUpdateTimeKey, date, gameTask.TaskId)
|
|
|
+ _ = s.cache.SetCacheStr(context.Background(), lastPayAddUpdateTimeKey, time.Now().Unix())
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
gameTarget.NewComplete = roomData.NewCompleteLocal
|
|
|
@@ -201,6 +205,10 @@ func (s *SyncData) SyncTaskData() {
|
|
|
mzGameId := gameTask.MzGameId + "-" + gameTask.MzChannel
|
|
|
if _, ok := wslData[mzGameId]; ok {
|
|
|
gameTarget.PayTarget = wslData[mzGameId]
|
|
|
+ if gameTarget.PayTarget > completeTaskData[gameTask.TaskId].PayTarget {
|
|
|
+ lastPayAddUpdateTimeKey := fmt.Sprintf(LastPayAddUpdateTimeKey, date, gameTask.TaskId)
|
|
|
+ _ = s.cache.SetCacheStr(context.Background(), lastPayAddUpdateTimeKey, time.Now().Unix())
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
gameTarget.IsComplete = -1
|
|
|
@@ -297,7 +305,7 @@ func (s *SyncData) TaskMsgSendInitData(ctx context.Context, completesInfo []task
|
|
|
lastPayCompletedUpdateTimeKey := fmt.Sprintf(LastPayCompletedUpdateTimeKey, date, complete.TaskId)
|
|
|
lastNewCompletedUpdateTimeKey := fmt.Sprintf(LastNewCompletedUpdateTimeKey, date, complete.TaskId)
|
|
|
lastRetainedCompletedUpdateTimeKey := fmt.Sprintf(LastRetainedCompletedUpdateTimeKey, date, complete.TaskId)
|
|
|
- lastPayAddUpdateTimeKey := fmt.Sprintf(LastPayAddUpdateTimeKey, date, complete.TaskId)
|
|
|
+
|
|
|
lastNewCompleted := complete.NewComplete + complete.HandNewComplete //上次新增完成数
|
|
|
_ = s.cache.SetCacheStr(ctx, lastNewCompletedKey, lastNewCompleted)
|
|
|
lastPayCompleted := complete.PayComplete + complete.HandPayComplete //上次支付完成数
|
|
|
@@ -311,7 +319,7 @@ func (s *SyncData) TaskMsgSendInitData(ctx context.Context, completesInfo []task
|
|
|
//lastRetainedCompletedUpdateTime := complete.NewComplete //上次留存完成更新时间
|
|
|
_ = s.cache.SetCacheStr(ctx, lastRetainedCompletedUpdateTimeKey, ctime)
|
|
|
//lastPayAddUpdateTime := complete.NewComplete //上次付费增加更新时间
|
|
|
- _ = s.cache.SetCacheStr(ctx, lastPayAddUpdateTimeKey, ctime)
|
|
|
+
|
|
|
}
|
|
|
_ = s.cache.SetCacheStr(ctx, taskCompletedStatusKey, -1)
|
|
|
_ = s.cache.SetCacheStr(ctx, lastMsgSendTimeKey, time.Now().Unix())
|
|
|
@@ -382,11 +390,12 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
|
|
|
}
|
|
|
|
|
|
var taskStatistics = "%s:taskStatistics"
|
|
|
- var retained = "活跃播报 " + time.Now().Format("2006-01-02 15:04:05")
|
|
|
+ var retained = "# 测试活跃播报 "
|
|
|
if len(mps) == 0 {
|
|
|
global.GVA_LOG.Warn(retained)
|
|
|
}
|
|
|
- var errMsg = "以下游戏目标效率为零:"
|
|
|
+ retained += fmt.Sprintf("<font color=\"warning\">%s</font>", time.Now().Format("2006-01-02 15:04:05"))
|
|
|
+ var errMsg = "**以下游戏目标效率为零:**"
|
|
|
var errMsgZ = ""
|
|
|
var sendMsg = map[string]string{}
|
|
|
var m int // 时间内
|
|
|
@@ -416,7 +425,8 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
|
|
|
sendMsg[name] += "\n"
|
|
|
sendMsg[name] += taskStatistics.GameName
|
|
|
sendMsg[name] += ",新增差"
|
|
|
- sendMsg[name] += strconv.Itoa(info.AlsoTarget)
|
|
|
+ //sendMsg[name] += strconv.Itoa(info.AlsoTarget)
|
|
|
+ sendMsg[name] += fmt.Sprintf("<font color=\"warning\">%d</font>", info.AlsoTarget)
|
|
|
isNew = true
|
|
|
if info.TimeRate > 60*60*24 {
|
|
|
lastNewCompletedUpdateTimeKey := fmt.Sprintf(LastNewCompletedUpdateTimeKey, date, info.TaskId)
|
|
|
@@ -448,7 +458,8 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
|
|
|
rm = info.TimeRate / 60
|
|
|
}
|
|
|
|
|
|
- sendMsg[name] += strconv.Itoa(info.AlsoTarget)
|
|
|
+ //sendMsg[name] += strconv.Itoa(info.AlsoTarget)
|
|
|
+ sendMsg[name] += fmt.Sprintf("<font color=\"warning\">%d</font>", info.AlsoTarget)
|
|
|
if info.Rate == 0 {
|
|
|
retainedErr = true
|
|
|
}
|
|
|
@@ -493,21 +504,28 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
|
|
|
sendMsg[name] += strconv.Itoa(m)
|
|
|
sendMsg[name] += "分钟内完成"
|
|
|
}
|
|
|
- sendMsg[name] += rate
|
|
|
+ //sendMsg[name] += rate
|
|
|
+ sendMsg[name] += fmt.Sprintf("<font color=\"warning\">%s</font>", rate)
|
|
|
}
|
|
|
|
|
|
for name, msg := range sendMsg {
|
|
|
retained += "\n"
|
|
|
- retained += name
|
|
|
+ retained += "**" + name + "**"
|
|
|
retained += msg
|
|
|
}
|
|
|
msg := retained
|
|
|
if errMsgZ != "" {
|
|
|
msg += "\n"
|
|
|
- msg += errMsg + errMsgZ
|
|
|
+ //msg += errMsg + errMsgZ
|
|
|
+ msg += fmt.Sprintf("<font color=\"warning\">%s</font>", errMsg+errMsgZ)
|
|
|
}
|
|
|
global.GVA_LOG.Warn(msg)
|
|
|
_ = s.cache.SetCacheStr(ctx, lastMsgSendTimeKey, time.Now().Unix())
|
|
|
+ url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b"
|
|
|
+ var sendData SendMsg
|
|
|
+ sendData.MsgType = "markdown"
|
|
|
+ sendData.Markdown.Content = msg
|
|
|
+ s.SendMsgData(url, sendData)
|
|
|
}
|
|
|
|
|
|
func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task.GameTargetComplete, ctime int64, date, lastFreeMsgSendTimeKey string, isOne bool) {
|
|
|
@@ -552,8 +570,9 @@ func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task
|
|
|
return
|
|
|
}
|
|
|
var taskStatistics = "%s:taskStatistics"
|
|
|
- var retained = "付费播报 " + time.Now().Format("2006-01-02 15:04:05")
|
|
|
- var errMsg = "以下游戏付费效率为零:"
|
|
|
+ var retained = "测试付费播报 "
|
|
|
+ retained += fmt.Sprintf("<font color=\"warning\">%s</font>", time.Now().Format("2006-01-02 15:04:05"))
|
|
|
+ var errMsg = "**以下游戏付费效率为零:**"
|
|
|
var errMsgZ = ""
|
|
|
var sendMsg = map[string]string{}
|
|
|
var m int //时间内
|
|
|
@@ -580,11 +599,13 @@ func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task
|
|
|
sendMsg[name] += "\n"
|
|
|
sendMsg[name] += taskStatistics.GameName
|
|
|
sendMsg[name] += ",付费差"
|
|
|
- sendMsg[name] += strconv.Itoa(data.AlsoTarget)
|
|
|
+ //sendMsg[name] += strconv.Itoa(data.AlsoTarget)
|
|
|
+ sendMsg[name] += fmt.Sprintf("<font color=\"warning\">%d</font>", data.AlsoTarget)
|
|
|
|
|
|
if data.TimeRate > 60*60*24 {
|
|
|
lastPayCompletedUpdateTimeKey := fmt.Sprintf(LastPayCompletedUpdateTimeKey, date, data.TaskId)
|
|
|
_ = s.cache.SetCacheStr(ctx, lastPayCompletedUpdateTimeKey, ctime) //上次付费更新时间
|
|
|
+ data.TimeRate = 60 * 60 * 2
|
|
|
}
|
|
|
// 5分钟数据没动报异常数据
|
|
|
if data.TimeRate/60 >= 4 {
|
|
|
@@ -613,7 +634,11 @@ func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task
|
|
|
sendMsg[name] += strconv.Itoa(m)
|
|
|
sendMsg[name] += "分钟内完成"
|
|
|
}
|
|
|
- sendMsg[name] += strconv.Itoa(data.Rate)
|
|
|
+ //sendMsg[name] += strconv.Itoa(data.Rate)
|
|
|
+ sendMsg[name] += fmt.Sprintf("<font color=\"warning\">%d</font>", data.Rate)
|
|
|
+ }
|
|
|
+ if len(sendMsg) == 0 {
|
|
|
+ return
|
|
|
}
|
|
|
for name, msg := range sendMsg {
|
|
|
retained += "\n"
|
|
|
@@ -623,10 +648,28 @@ func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task
|
|
|
msg := retained
|
|
|
if errMsgZ != "" {
|
|
|
msg += "\n"
|
|
|
- msg += errMsg + errMsgZ
|
|
|
+ //msg += errMsg + errMsgZ
|
|
|
+ msg += fmt.Sprintf("<font color=\"warning\">%s</font>", errMsg+errMsgZ)
|
|
|
}
|
|
|
global.GVA_LOG.Warn(msg)
|
|
|
_ = s.cache.SetCacheStr(ctx, lastFreeMsgSendTimeKey, time.Now().Unix())
|
|
|
+ url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b"
|
|
|
+ var sendData SendMsg
|
|
|
+ sendData.MsgType = "markdown"
|
|
|
+ sendData.Markdown.Content = msg
|
|
|
+ s.SendMsgData(url, sendData)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+type SendMsg struct {
|
|
|
+ MsgType string `json:"msgtype"`
|
|
|
+ Markdown struct {
|
|
|
+ Content string `json:"content"`
|
|
|
+ } `json:"markdown"`
|
|
|
+}
|
|
|
+
|
|
|
+func (s *SyncData) SendMsgData(url string, params interface{}) {
|
|
|
+ _, _ = utils.HttpPost(url, params)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -701,13 +744,27 @@ func (s *SyncData) CheckTaskCompletedInfo() {
|
|
|
ctx := context.Background()
|
|
|
taskCompletedStatusKey := fmt.Sprintf(TaskCompletedStatusKey, date)
|
|
|
completesInfo, err := s.TaskNoCompleteDate(date)
|
|
|
-
|
|
|
if err != nil {
|
|
|
global.GVA_LOG.Error("CheckTaskCompletedInfo查询任务数据报错", zap.Error(err))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ status, _ := s.cache.GetCacheNum(ctx, taskCompletedStatusKey)
|
|
|
+ if status == 1 {
|
|
|
+ global.GVA_LOG.Info("任务已完成")
|
|
|
+ return
|
|
|
}
|
|
|
if len(completesInfo) == 0 {
|
|
|
global.GVA_LOG.Info("TaskMsgSend没有查询到未完成数据")
|
|
|
- time.Sleep(time.Minute * 1)
|
|
|
+ time.Sleep(time.Second * 10)
|
|
|
_ = s.cache.SetCacheStr(ctx, taskCompletedStatusKey, 1)
|
|
|
+ msg := "# 测试监控报警 "
|
|
|
+ msg += fmt.Sprintf("<font color=\"warning\">%s</font>", time.Now().Format("2006-01-02 15:04:05"))
|
|
|
+ msg += "\n"
|
|
|
+ msg += "今日任务目标已完成"
|
|
|
+ url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b"
|
|
|
+ var sendData SendMsg
|
|
|
+ sendData.MsgType = "markdown"
|
|
|
+ sendData.Markdown.Content = msg
|
|
|
+ s.SendMsgData(url, sendData)
|
|
|
}
|
|
|
}
|