Kaynağa Gözat

Merge branch 'master' of http://10.8.230.114:3000/wangbin/log-server

倚楼听风雨 3 yıl önce
ebeveyn
işleme
037ecffbfc

+ 15 - 0
api/v1/card/enter.go

@@ -0,0 +1,15 @@
+package card
+
+type ApiGroup struct {
+	// Code generated by github.com/flipped-aurora/gin-vue-admin/server Begin; DO NOT EDIT.
+	// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
+	IdCardApi
+}
+
+var(
+	//gameService = service.ServiceGroupApp.TypeServiceGroup.GameChannelService
+	//gameListService = service.ServiceGroupApp.TypeServiceGroup.GameListService
+	//loginTypeService = service.ServiceGroupApp.TypeServiceGroup.LoginTypeService
+	//responsiblePersonService = service.ServiceGroupApp.TypeServiceGroup.ResponsiblePersonService
+	//accountTypeService = service.ServiceGroupApp.TypeServiceGroup.AccountTypeService
+)

+ 11 - 0
api/v1/card/id_card.go

@@ -0,0 +1,11 @@
+package card
+
+import "github.com/gin-gonic/gin"
+
+type IdCardApi struct {
+}
+
+func (a *IdCardApi) GetIdCard(c *gin.Context) {
+	c.Param("")
+}
+

+ 2 - 0
api/v1/enter.go

@@ -1,6 +1,7 @@
 package v1
 
 import (
+	"log-server/api/v1/card"
 	"log-server/api/v1/dataStatistics"
 	"log-server/api/v1/example"
 	"log-server/api/v1/fileManager"
@@ -21,6 +22,7 @@ type ApiGroup struct {
 	RentComputerApiGroup rentComputer.ApiGroup
 	DataStatisticsGroup  dataStatistics.ApiGroup
 	FileManagerGroup     fileManager.ApiGroup
+	IdCardGroup			 card.ApiGroup
 }
 
 var ApiGroupApp = new(ApiGroup)

+ 2 - 0
api/v1/log/enter.go

@@ -9,6 +9,7 @@ type GroupLog struct {
 	ApiEnvLog
 	ApiLoging
 	ApiComputer
+	ApiIpLog
 }
 
 var (
@@ -18,4 +19,5 @@ var (
 	ServiceReportPointsLog = service.ServiceGroupApp.LogServiceGroup.ServiceReportPointsLog
 	ServiceStatisticsLog   = service.ServiceGroupApp.LogServiceGroup.ServiceStatisticsLog
 	ServiceComputer        = service.ServiceGroupApp.LogServiceGroup.ServiceComputer
+	ServiceIpLog		   = service.ServiceGroupApp.LogServiceGroup.ServiceIpLog
 )

+ 161 - 0
api/v1/log/log_ip.go

@@ -0,0 +1,161 @@
+package log
+
+import (
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"go.uber.org/zap"
+	"log-server/global"
+	log2 "log-server/model/log"
+	"log-server/model/log/request"
+	"log-server/model/log/response"
+	"log-server/utils"
+)
+
+type ApiIpLog struct {
+
+}
+
+// @Tags loging
+// @Summary 获取iplog
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body request.IpLogListRequest true "获取iplog"
+// @Success 200 {object} response.Response{data=log2.IpLog} "获取iplog列表"
+// @Router /loging/getIpLogList [post]
+func (s *ApiIpLog) GetIpLogList(c *gin.Context) {
+	var paramsInfo request.IpLogListRequest
+	_ = c.ShouldBindJSON(&paramsInfo)
+	if err := utils.Verify(paramsInfo.PageInfo, utils.PageInfoVerify); err != nil {
+		response.FailWithMessage(err.Error(), c)
+		return
+	}
+	list, total, err := ServiceIpLog.GetIpLogList(paramsInfo.IpLogRequest, paramsInfo.PageInfo, paramsInfo.OrderKey, paramsInfo.Desc)
+	if err != nil {
+		global.GVA_LOG.Error("获取失败!", zap.Error(err))
+		response.FailWithMessage("获取失败", c)
+	} else {
+		response.OkWithDetailed(response.PageResult{
+			List:     list,
+			Total:    total,
+			Page:     paramsInfo.Page,
+			PageSize: paramsInfo.PageSize,
+		}, "获取成功", c)
+	}
+}
+
+//根据gameId分组获取ip
+func (s *ApiIpLog) GetGameIPList(c *gin.Context) {
+	var paramsInfo request.IpLogListRequest
+	_ = c.ShouldBindJSON(&paramsInfo)
+	if err := utils.Verify(paramsInfo.PageInfo, utils.PageInfoVerify); err != nil {
+		response.FailWithMessage(err.Error(), c)
+		return
+	}
+	list, total, err := ServiceIpLog.GetGameIpList(paramsInfo.IpLogRequest, paramsInfo.PageInfo, paramsInfo.OrderKey, paramsInfo.Desc)
+	if err != nil {
+		global.GVA_LOG.Error("获取失败!", zap.Error(err))
+		response.FailWithMessage("获取失败", c)
+	} else {
+		response.OkWithDetailed(response.PageResult{
+			List:     list,
+			Total:    total,
+			Page:     paramsInfo.Page,
+			PageSize: paramsInfo.PageSize,
+		}, "获取成功", c)
+	}
+}
+
+
+
+
+// @Tags loging
+// @Summary 获取某天具体ip
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body log2.IpLog true "获取ip"
+// @Success 200 {object} response.Response{data=log2.IpResponse} "获取iplog列表"
+// @Router /loging/getIp [post]
+func (s *ApiIpLog) GetIp(c *gin.Context) {
+	var ip log2.IpLogResponse
+	_ = c.ShouldBindJSON(&ip)
+	if ip.GameId == 0 {
+		response.FailWithMessage("游戏id不能为空", c)
+		return
+	}
+	if ip.PcCode == "" {
+		response.FailWithMessage("租机编号不能为空", c)
+		return
+	}
+	if ip.CreateDate == ""{
+		response.FailWithMessage("创建日期不能为空", c)
+		return
+	}
+	list, total, err := ServiceIpLog.GetIp(ip)
+	if err != nil {
+		global.GVA_LOG.Error("获取失败!", zap.Error(err))
+		response.FailWithMessage("获取失败", c)
+	} else {
+		response.OkWithDetailed(response.PageResult{
+			List:     list,
+			Total:    total,
+		}, "获取成功", c)
+	}
+}
+
+//游戏id分组获取某天具体ip
+func (s *ApiIpLog) GetGameIp(c *gin.Context) {
+	var ip log2.GameIpResponse
+	_ = c.ShouldBindJSON(&ip)
+	if ip.GameId == 0 {
+		response.FailWithMessage("游戏id不能为空", c)
+		return
+	}
+
+	if ip.CreateDate == ""{
+		response.FailWithMessage("创建日期不能为空", c)
+		return
+	}
+	list, total, err := ServiceIpLog.GetGameIp(ip)
+	if err != nil {
+		global.GVA_LOG.Error("获取失败!", zap.Error(err))
+		response.FailWithMessage("获取失败", c)
+	} else {
+		response.OkWithDetailed(response.PageResult{
+			List:     list,
+			Total:    total,
+		}, "获取成功", c)
+	}
+}
+
+//导出gameIp列表
+func (s *ApiIpLog) GameIpExport(c *gin.Context) {
+	var excelInfo request.ExcelIpInfo
+	_ = c.ShouldBindJSON(&excelInfo)
+	fmt.Println(excelInfo)
+	paramsInfo := excelInfo.InfoList
+	paramsInfo.PageSize = 300
+	paramsInfo.Page = 1
+	if err := utils.Verify(paramsInfo.PageInfo, utils.PageInfoVerify); err != nil {
+		response.FailWithMessage(err.Error(), c)
+		return
+	}
+	list, _, err := ServiceIpLog.GetGameIpList(paramsInfo.IpLogRequest, paramsInfo.PageInfo, paramsInfo.OrderKey, paramsInfo.Desc)
+	if err != nil {
+		global.GVA_LOG.Error("获取失败!", zap.Error(err))
+		response.FailWithMessage("获取失败 "+err.Error(), c)
+	}
+	//var nowTime string = time.Now().Format("2006-01-02_15:04")
+	//excelInfo.FileName = nowTime + "-ip.xlsx"
+	//fmt.Println(excelInfo.FileName)
+	filePath := global.GVA_CONFIG.Excel.Dir + excelInfo.FileName
+	err = ServiceIpLog.GameIpListExcel(list, filePath)
+	if err != nil {
+		global.GVA_LOG.Error("转换Excel失败!", zap.Error(err))
+		response.FailWithMessage("转换Excel失败", c)
+		return
+	}
+	c.Writer.Header().Add("success", "true")
+	c.File(filePath)
+}

+ 31 - 0
api/v1/log/loging.go

@@ -129,6 +129,10 @@ func (s *ApiLoging) GetReportPointsLogList(c *gin.Context) {
 	}
 }
 
+
+
+
+
 // @Tags loging
 // @Summary 获取统计节点log
 // @Security ApiKeyAuth
@@ -460,3 +464,30 @@ func (e *ApiLoging) ComputerRateExport(c *gin.Context) {
 	c.Writer.Header().Add("success", "true")
 	c.File(filePath)
 }
+
+// @Tags loging
+// @Summary 七天電腦效率
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce  application/octet-stream
+// @Param data body request.GetStatisticsComputerRequest true "导出Excel文件信息"
+// @Success 200
+// @Router /loging/computerSevenRate [post]
+func (e *ApiLoging) ComputerSevenRate(c *gin.Context) {
+	var paramsInfo request.GetStatisticsComputerRequest
+	_ = c.ShouldBindJSON(&paramsInfo)
+	paramsInfo.PageSize = 300
+	paramsInfo.Page = 1
+	list, _, err := ServiceStatisticsLog.ComputerSevenStatistics(c, paramsInfo.LogComputer, paramsInfo.PageInfo, paramsInfo.OrderKey, paramsInfo.Desc)
+	if err != nil {
+		global.GVA_LOG.Error("获取失败!", zap.Error(err))
+		response.FailWithMessage("获取失败", c)
+	} else {
+		response.OkWithDetailed(response.PageResult{
+			List:     list,
+			Total:    1,
+			Page:     paramsInfo.Page,
+			PageSize: paramsInfo.PageSize,
+		}, "获取成功", c)
+	}
+}

+ 54 - 0
api/v1/typeManage/responsiblePerson.go

@@ -7,6 +7,7 @@ import (
 	"log-server/model/common/request"
 	"log-server/model/common/response"
 	"log-server/model/typeManage"
+	typeManageReq "log-server/model/typeManage/request"
 	typeManageRes "log-server/model/typeManage/response"
 	"log-server/utils"
 )
@@ -17,6 +18,14 @@ type ResponsiblePersonApi struct{}
 func (r *ResponsiblePersonApi) CreateResponsiblePerson(c *gin.Context) {
 	var responsiblePerson typeManage.ResponsiblePerson
 	_ = c.ShouldBindJSON(&responsiblePerson)
+	//推送状态和启用状态默认赋予1
+	if responsiblePerson.PushStatus == 0 {
+		responsiblePerson.PushStatus = 1
+	}
+	if responsiblePerson.State == 0 {
+		responsiblePerson.State = 1
+	}
+
 	if err := utils.Verify(responsiblePerson, utils.ResponsiblePersonVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
@@ -63,6 +72,11 @@ func (r *ResponsiblePersonApi) DeleteResponsiblePersonsByIds(c *gin.Context) {
 func (r *ResponsiblePersonApi) UpdateResponsiblePerson(c *gin.Context) {
 	var person typeManage.ResponsiblePerson
 	_ = c.ShouldBindJSON(&person)
+	//获取托管状态, 1是托管, -1不需要托管
+	//不需要托管
+	//if person.ManagedStatus == -1 {
+	//	person.Custodians = ""
+	//}
 	if err := utils.Verify(person, utils.ResponsiblePersonVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
@@ -143,3 +157,43 @@ func (r *ResponsiblePersonApi) SelectResponsiblePerson(c *gin.Context) {
 		response.OkWithDetailed(list, "获取成功", c)
 	}
 }
+
+//更改负责人启用状态
+func (r *ResponsiblePersonApi) StatusChange(c *gin.Context) {
+	var paramsInfo typeManageReq.UpdateResponsibleStatusRequest
+	_ = c.ShouldBindJSON(&paramsInfo)
+	if paramsInfo.State == 0 {
+		response.FailWithMessage("状态值不能为空", c)
+		return
+	}
+	if paramsInfo.Id == 0 {
+		response.FailWithMessage("Id不能为空", c)
+		return
+	}
+	if err := responsiblePersonService.UpdateResponsibleStatus(paramsInfo); err != nil {
+		global.GVA_LOG.Error("修改失败!", zap.Error(err))
+		response.FailWithMessage(err.Error(), c)
+	} else {
+		response.OkWithMessage("修改成功", c)
+	}
+}
+
+//更改负责人推送状态
+func (r *ResponsiblePersonApi) PushStatusChange(c *gin.Context) {
+	var paramsInfo typeManageReq.UpdatePushStatusRequest
+	_ = c.ShouldBindJSON(&paramsInfo)
+	if paramsInfo.PushStatus == 0 {
+		response.FailWithMessage("状态值不能为空", c)
+		return
+	}
+	if paramsInfo.Id == 0 {
+		response.FailWithMessage("Id不能为空", c)
+		return
+	}
+	if err := responsiblePersonService.UpdatePushStatus(paramsInfo); err != nil {
+		global.GVA_LOG.Error("修改失败!", zap.Error(err))
+		response.FailWithMessage(err.Error(), c)
+	} else {
+		response.OkWithMessage("修改成功", c)
+	}
+}

+ 3 - 0
config.yaml

@@ -161,6 +161,9 @@ zap:
 send-url:
   computer-send-url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b111"
   keyword-send-url: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=34cbfa5a-c31d-464f-baf8-8363d6f4ac6a"
+extranet-domain:
+  #control: "http://bpm.kfzs.com:7089"
+  control: "http://192.168.50.35:8099"
 #extranet-domain:
 #  control: "http://192.168.50.35:8099"
 prefix-url:

+ 3 - 0
initialize/router.go

@@ -23,6 +23,7 @@ func Routers() *gin.Engine {
 	taskRouter := router.RouterGroupApp.Task
 	uploadFileRouter := router.RouterGroupApp.UploadFile
 
+	ipLogRouter := router.RouterGroupApp.IpLog
 	typeManageRouter := router.RouterGroupApp.TypeManage
 	rentComputerRouter := router.RouterGroupApp.RentComputer
 	dataStatisticsRouter := router.RouterGroupApp.DataStatistics
@@ -65,6 +66,8 @@ func Routers() *gin.Engine {
 		typeManageRouter.InitLoginTypeRouter(PublicGroup)         //登录类型路由
 		typeManageRouter.InitResponsiblePersonRouter(PublicGroup) //负责人路由
 		typeManageRouter.InitAccountTypeRouter(PublicGroup)       //账号类型路由
+		ipLogRouter.InitIpLogRouter(PublicGroup)				  //ip日志路由
+
 		taskRouter.InitGameTaskRouter(PublicGroup)
 		uploadFileRouter.InitUploadFileRouter(PublicGroup)
 		rentComputerRouter.InitRentComputerRouter(PublicGroup)     //租机管理

+ 13 - 129
initialize/timer.go

@@ -100,143 +100,21 @@ func Timer() {
 
 	//// 定时检查是否有电脑到期,修改租机状态@every 1s
 	//_, err = global.GVA_Timer.AddTaskByFunc("CheckIsExpire", "0 0/5 * * * *", serviceRentComputer.CheckIsExpire)
-	//// 定时更新前一天的统计数据
-	//_, err := global.GVA_Timer.AddTaskByFunc("StatisticsLog", "2 8 5 * * * ", serviceStatisticsLog.CreateStatisticsLog)
-	//if err != nil {
-	//	fmt.Println("add taskCode timer error:", err)
-	//}
-	//
-	////定时同步电脑相关的统计数据
-	//_, err = global.GVA_Timer.AddTaskByFunc("CreateComputerStatisticsData", "40 9,19,29,39,49,59 7-23 * * * ", serviceStatisticsLog.CreateComputerStatisticsData)
-	//if err != nil {
-	//	fmt.Println("add CreateComputerStatisticsData timer error:", err)
-	//}
-
-	//// 同步游戏相关的统计数据
-	//_, err = global.GVA_Timer.AddTaskByFunc("TodayCreateStatisticsGameInfoLog", "2 8,18,28,38,48,58 6-23 * * * ", serviceStatisticsLog.TodayCreateStatisticsGameInfoLog)
-	//if err != nil {
-	//	fmt.Println("add TodayCreateStatisticsGameInfoLog timer error:", err)
-	//}
-	//// 同步任务统计数据
-	//_, err = global.GVA_Timer.AddTaskByFunc("TaskStatisticsDataCache", "20 0/3 6-23 * * * ", serviceStatisticsLog.TaskStatisticsDataCache)
-	//if err != nil {
-	//	fmt.Println("add TaskStatisticsDataCache timer error:", err)
-	//}
-	//// 重试失败数据
-	//_, err = global.GVA_Timer.AddTaskByFunc("createFailLog", "2 5,15,25,35,45,55 6-23 * * * ", ServiceLogList.CreateFailLog)
-	//if err != nil {
-	//	fmt.Println("everyDayResetStatisticsCache timer error:", err)
-	//}
-	//// 定时检查电脑上报
-	//_, err = global.GVA_Timer.AddTaskByFunc("RegularCheckPc", "2 57 8-23 * * * ", serviceStatisticsLog.RegularCheckPc)
-	//if err != nil {
-	//	fmt.Println("RegularCheckPc timer error:", err)
-	//}
-	//// 新建日志表
-	//_, err = global.GVA_Timer.AddTaskByFunc("RegularCreateLogingTable", "2 1 19 20 * * ", ServiceLogList.RegularCreateLogingTable)
 	//if err != nil {
-	//	fmt.Println("add RegularCreateLogingTable timer error:", err)
+	//	fmt.Println("add CheckIsExpire timer error:", err)
 	//}
-	//// 定时删缓存
-	//_, err = global.GVA_Timer.AddTaskByFunc("RegularDelCheckData", "2 33 11 * * *", serviceStatisticsLog.RegularDelCheckData)
+	//// 定时生成租机每日台账@every 1s
+	//_, err = global.GVA_Timer.AddTaskByFunc("CreateRentComputerLedger", "0 30 23 * * *", serviceRentComputer.CreateRentComputerLedger)
 	//if err != nil {
-	//	fmt.Println("add RegularDelCheckData timer error:", err)
+	//	fmt.Println("add CreateRentComputerLedger timer error:", err)
 	//}
-	////定时添加任务
-	//_, err = global.GVA_Timer.AddTaskByFunc("EveryDaySyncTaskData", "30 22 21 * * *", syncData.EveryDaySyncTaskData)
-	//if err != nil {
-	//	fmt.Println("add EveryDaySyncTaskData timer error:", err)
-	//}
-	//同步任务数据
-	//_, err = global.GVA_Timer.AddTaskByFunc("SyncTaskData", "2 0/3 1-23 * * *", syncData.SyncTaskData)
-	//if err != nil {
-	//	fmt.Println("add SyncTaskData timer error:", err)
-	//}
-	//// 数优任务统计
-	//_, err = global.GVA_Timer.AddTaskByFunc("DayTargetDataStatistics", "40 2 5 * * *", syncData.DayTargetDataStatistics)
-	//if err != nil {
-	//	fmt.Println("add DayTargetDataStatistics timer error:", err)
-	//}
-	//
-	////// 定时检查是否有电脑到期,修改租机状态@every 1s
-	////_, err = global.GVA_Timer.AddTaskByFunc("CheckIsExpire", "0 0/5 * * * *", serviceRentComputer.CheckIsExpire)
-	////if err != nil {
-	////	fmt.Println("add CheckIsExpire timer error:", err)
-	////}
-	////// 定时生成租机每日台账@every 1s
-	////_, err = global.GVA_Timer.AddTaskByFunc("CreateRentComputerLedger", "0 30 23 * * *", serviceRentComputer.CreateRentComputerLedger)
-	////if err != nil {
-	////	fmt.Println("add CreateRentComputerLedger timer error:", err)
-	////}
 	//
 	////定时获取扫码平台余额,每小时执行一次
 	////_, err = global.GVA_Timer.AddTaskByFunc("SyncGetWeChatScannerBalance", "0 58 * * * *", serviceWeChatScannerApi.SyncGetWeChatScannerBalance)
 	//_, err = global.GVA_Timer.AddTaskByFunc("SyncGetWeChatScannerBalance", "0 58 * * * *", serviceWeChatScannerApi.SyncGetWeChatScannerBalance)
-	//_, err = global.GVA_Timer.AddTaskByFunc("SyncGetWeChatScannerBalance", "0 58 * * * *", serviceWeChatScannerApi.SyncGetWeChatScannerBalance)
-	//if err != nil {
-	//	fmt.Println("add SyncGetWeChatScannerBalance timer error:", err)
-	//}
-
-	//定时更新异常率
-	//_, err := global.GVA_Timer.AddTaskByFunc("SyncAbnormalRateByBatch", "0 1,22 * * * *", serviceDataAbnormalRate.SyncAbnormalRateByBatch)
-	//if err != nil {
-	//	fmt.Println("add SyncAbnormalRateByBatch timer error:", err)
-	//}
-
-	//定时更新当日微信扫码订单列表
-	//_, err = global.GVA_Timer.AddTaskByFunc("SyncTodayWeChatScannerDetailed", "0 3,33 * * * *", serviceWeChatScannerDetailed.SyncTodayWeChatScannerDetailed)
-	//if err != nil {
-	//	fmt.Println("add SyncTodayWeChatScannerDetailed timer error:", err)
-	//}
-
-	//0点更新昨日微信扫码订单列表
-	//_, err = global.GVA_Timer.AddTaskByFunc("SyncYesterdayWeChatScannerDetailed", "1 1 0 * * *", serviceWeChatScannerDetailed.SyncYesterdayWeChatScannerDetailed)
-	//if err != nil {
-	//	fmt.Println("add SyncYesterdayWeChatScannerDetailed timer error:", err)
-	//}
-
-	//半小时同步一次机房设备信息,播报是否有异常
-	//_, err = global.GVA_Timer.AddTaskByFunc("SyncJfDevicesMessage", "0 0,30 * * * *", robotService.SyncJfDevicesMessage)
-	//if err != nil {
-	//	fmt.Println("add SyncJfDevicesMessage timer error:", err)
-	//}
-	//
-	//// 活跃定时推送消息
-	//_, err = global.GVA_Timer.AddTaskByFunc("TaskMsgSend", "20 29,59 8-21 * * *", syncData.TaskMsgSend)
-	//if err != nil {
-	//	fmt.Println("add TaskMsgSend timer error:", err)
-	//}
-	//
-	//// 活跃定时推送消息
-	//_, err = global.GVA_Timer.AddTaskByFunc("TaskMsgSend", "20 0/10 22-23 * * *", syncData.TaskMsgSend)
-	//if err != nil {
-	//	fmt.Println("add TaskMsgSend timer error:", err)
-	//}
-	//
-	//// 付费定时推送消息
-	//_, err = global.GVA_Timer.AddTaskByFunc("TaskMsgSend", "40 15,30,45,59 8-21 * * *", syncData.TaskFreeMsgSend)
-	//if err != nil {
-	//	fmt.Println("add TaskFreeMsgSend timer error:", err)
-	//}
-	//
-	//// 付费定时推送消息
-	//_, err = global.GVA_Timer.AddTaskByFunc("TaskMsgSend", "40 0/5 22-23 * * *", syncData.TaskFreeMsgSend)
-	//if err != nil {
-	//	fmt.Println("add TaskFreeMsgSend timer error:", err)
-	//}
-	//
-	//// 23起检测任务完成情况
-	//_, err = global.GVA_Timer.AddTaskByFunc("CheckTaskCompletedInfo", "10 0/4 23 * * *", syncData.CheckTaskCompletedInfo)
-	//if err != nil {
-	//	fmt.Println("add CheckTaskCompletedInfo timer error:", err)
-	//}
-
-	//定时更新游戏版本号和链接
-	//_, err := global.GVA_Timer.AddTaskByFunc("UpdateGameVersion", "0 3/15 * * * *", serviceDownLoadUrl.UpdateGameVersion)
 	//if err != nil {
 	//	fmt.Println("add UpdateGameVersion timer error:", err)
 	//}
-
 	////定时更新异常率
 	//_, err = global.GVA_Timer.AddTaskByFunc("SyncAbnormalRateByBatch", "0 1,31 * * * *", serviceDataAbnormalRate.SyncAbnormalRateByBatch)
 	//if err != nil {
@@ -268,7 +146,7 @@ func Timer() {
 	//}
 	//
 	//// 活跃定时推送消息
-	//_, err = global.GVA_Timer.AddTaskByFunc("TaskMsgSend", "20 0/10 22-23 * * *", syncData.TaskMsgSend)
+	//_, err = global.GVA_Timer.AddTaskByFunc("TaskMsgSend", "40 0/10 22-23 * * *", syncData.TaskMsgSend)
 	//if err != nil {
 	//	fmt.Println("add TaskMsgSend timer error:", err)
 	//}
@@ -280,14 +158,20 @@ func Timer() {
 	//}
 	//
 	//// 付费定时推送消息
-	//_, err = global.GVA_Timer.AddTaskByFunc("TaskMsgSend", "40 0/5 22-23 * * *", syncData.TaskFreeMsgSend)
+	//_, err = global.GVA_Timer.AddTaskByFunc("TaskMsgSend", "50 0/5 22-23 * * *", syncData.TaskFreeMsgSend)
 	//if err != nil {
 	//	fmt.Println("add TaskFreeMsgSend timer error:", err)
 	//}
 	//
 	//// 23起检测任务完成情况
-	//_, err = global.GVA_Timer.AddTaskByFunc("CheckTaskCompletedInfo", "10 0/4 23 * * *", syncData.CheckTaskCompletedInfo)
+	//_, err = global.GVA_Timer.AddTaskByFunc("CheckTaskCompletedInfo", "57 0/4 23 * * *", syncData.CheckTaskCompletedInfo)
 	//if err != nil {
 	//	fmt.Println("add CheckTaskCompletedInfo timer error:", err)
 	//}
+	//
+	////定时更新游戏版本号和链接
+	//_, err = global.GVA_Timer.AddTaskByFunc("UpdateGameVersion", "0 3/15 * * * *", serviceDownLoadUrl.UpdateGameVersion)
+	//if err != nil {
+	//	fmt.Println("add UpdateGameVersion timer error:", err)
+	//}
 }

+ 1 - 17
model/log/computer.go

@@ -28,23 +28,7 @@ func (c *Computer) OnlinePcCodeCache() (mps map[string]string, err error) {
 		mps, err = global.GVA_REDIS.HGetAll(ctx, OnlinePcCode).Result()
 		return
 	}
-	var computers []*Computer
-	err = global.GVA_DB.Where("status = ?", 1).Find(&computers).Error
-	if err != nil {
-		return
-	}
-	if len(computers) == 0 {
-		return
-	}
-	var mp = map[string]string{}
-	for _, pc := range computers {
-		mp[pc.PcCode] = pc.User
-	}
-	err = global.GVA_REDIS.HSet(ctx, OnlinePcCode, mp).Err()
-	if err != nil {
-		return
-	}
-	return mp, err
+	return
 }
 
 // 更新单条缓存数据

+ 51 - 0
model/log/log_ip.go

@@ -0,0 +1,51 @@
+package log
+
+type IpLog struct {
+	Id         	uint    `json:"id"`
+	Ip     		string  `json:"ip"`	//模拟器ip
+	LogUuid   	string 	`json:"log_uuid"`	//日志UUID
+	GameId		int 	`json:"game_id"`	//游戏id
+	Account 	string 	`json:"account"`	//账号
+	PcCode 		string 	`json:"pc_code"`	//电脑编号
+	CreateDate  string 	`json:"create_date"` // 创建日期
+	CreateTime  string 	`json:"create_time"` // 创建时间
+}
+
+type IpLogRequest struct {
+	Id         	uint    `json:"id"`
+	Ip     		string  `json:"ip"`	//模拟器ip
+	Date		[]string	`json:"date"`
+	LogUuid   	string 	`json:"log_uuid"`	//日志UUID
+	GameId		int 	`json:"game_id"`	//游戏id
+	Account 	string 	`json:"account"`	//账号
+	PcCode 		string 	`json:"pc_code"`	//电脑编号
+	CreateDate  string 	`json:"create_date"` // 创建日期
+	CreateTime  string 	`json:"create_time"` // 创建时间
+}
+
+type IpLogResponse struct {
+	PcCode 		string 	`json:"pc_code"`	//电脑编号
+	GameId		int 	`json:"game_id"`	//游戏id
+	CreateDate  string 	`json:"create_date"` // 创建日期
+	CountTotal  int		`json:"count_total"`	//ip总上报次数
+	CountDistinctIp	int	`json:"count_distinct_ip"`	//IP个数
+}
+
+type GameIpResponse struct {
+	GameId		int 	`json:"game_id"`	//游戏id
+	CreateDate  string 	`json:"create_date"` // 创建日期
+	CountTotal  int		`json:"count_total"`	//ip总上报次数
+	SuccessIp   int 	`json:"success_ip"`		//进入游戏所上报ip个数
+	CountDistinctIp	int	`json:"count_distinct_ip"`	//ip个数
+	TaskCount	int		`json:"task_count"`			//完成任务总数
+}
+
+type QueryIpList struct {
+	Ip     		string  `json:"ip"`	//模拟器ip
+	Count		int 	`json:"count"`
+}
+
+
+func (IpLog) TableName() string {
+	return "ip_log"
+}

+ 10 - 0
model/log/request/log_ip.go

@@ -0,0 +1,10 @@
+package request
+
+import "log-server/model/log"
+
+type IpLogListRequest struct {
+	log.IpLogRequest
+	PageInfo
+	OrderKey string `json:"orderKey"` // 排序
+	Desc     bool   `json:"desc"`     // 排序方式:升序false(默认)|降序true
+}

+ 12 - 0
model/log/request/log_statistics.go

@@ -69,6 +69,18 @@ type ExcelInfo struct {
 	} `json:"infoList"`
 }
 
+//导出ip列表
+type ExcelIpInfo struct {
+	FileName string `json:"fileName"` // 文件名
+	InfoList struct {
+		log.IpLogRequest
+		PageInfo
+		OrderKey string `json:"orderKey"` // 排序
+		Desc     bool   `json:"desc"`     // 排序方式:升序false(默认)|降序true
+	} `json:"infoList"`
+}
+
+
 type GetLogScanningCodeRequest struct {
 	LogScanningRequest
 	PageInfo

+ 16 - 0
model/task/game_add_fee.go

@@ -0,0 +1,16 @@
+package task
+
+import "time"
+
+type GameAddFee struct {
+	Id         uint      `json:"id"`
+	TaskName   string    `json:"task_name"`
+	CreateTime time.Time `json:"create_time"` // 创建时间
+	CreateDate time.Time `json:"create_date"`
+	Num        int       `json:"num"`
+	Target     int       `json:"target"`
+}
+
+func (GameAddFee) TableName() string {
+	return "game_add_fee"
+}

+ 11 - 0
model/typeManage/request/responsible_status.go

@@ -0,0 +1,11 @@
+package request
+
+type UpdateResponsibleStatusRequest struct {
+	State int `json:"state"` // 状态-1关闭,1开启
+	Id int `json:"id"`
+}
+
+type UpdatePushStatusRequest struct {
+	PushStatus int `json:"state"` // 状态-1关闭,1开启
+	Id int `json:"id"`
+}

+ 30 - 0
model/typeManage/responsiblePerson.go

@@ -1,5 +1,9 @@
 package typeManage
 
+import (
+	"log-server/global"
+)
+
 type ResponsiblePerson struct {
 	Id                int64     `json:"id"`
 	Img               string    `json:"img"`
@@ -8,8 +12,34 @@ type ResponsiblePerson struct {
 	DepartmentName    string    `json:"department_name"`
 	MobilePhoneNumber string    `json:"mobile_phone_number"`
 	GameCounts        int64     `json:"game_counts"`
+	Custodians		  string	`json:"custodians"`
 	Remark            string    `json:"remark"`
+	StartTime		  int64		`json:"start_time"`
+	Url				  string	`json:"url"`
 	State             int8      `json:"state"`
+	PushStatus		  int8		`json:"push_status"`
 	CreateTime        LocalTime `gorm:"column:create_time;" json:"createTime"`
 	UpdateTime        LocalTime `gorm:"column:update_time;" json:"updateTime"`
 }
+
+type ResponsiblePersonMobile struct {
+	Id                int64  `json:"id"`
+	Name              string `json:"name"`
+	MobilePhoneNumber string `json:"mobile_phone_number"`
+}
+
+func (m *ResponsiblePerson) GetUserInfo() (mps map[string]string, err error) {
+	var person []*ResponsiblePerson
+	err = global.GVA_DB.Table("responsible_person").Where("state = ?", 1).Find(&person).Error
+	if err != nil {
+		return
+	}
+	if len(person) == 0 {
+		return
+	}
+	var mp = map[string]string{}
+	for _, pc := range person {
+		mp[pc.Name] = pc.MobilePhoneNumber
+	}
+	return mp, err
+}

+ 5 - 0
router/card/enter.go

@@ -0,0 +1,5 @@
+package card
+
+type RouterGroup struct {
+	IdCardRouter
+}

+ 18 - 0
router/card/id_card.go

@@ -0,0 +1,18 @@
+package card
+
+import (
+	"github.com/gin-gonic/gin"
+	v1 "log-server/api/v1"
+)
+
+type IdCardRouter struct {
+}
+
+func (r *IdCardRouter) InitIdCardRouter(Router *gin.RouterGroup) {
+	IdCardRouter := Router.Group("idCard")
+	IdCardApi := v1.ApiGroupApp.IdCardGroup.IdCardApi
+	{
+		IdCardRouter.GET("getIdCard", IdCardApi.GetIdCard)
+	}
+
+}

+ 1 - 0
router/enter.go

@@ -22,6 +22,7 @@ type RouterGroup struct {
 	RentComputer   rentComputer.RouterGroup
 	DataStatistics dataStatistics.RouterGroup
 	FileManager    fileManager.RouterGroup
+	IpLog 		   log.IpLogRouter
 }
 
 var RouterGroupApp = new(RouterGroup)

+ 23 - 0
router/log/log_ip.go

@@ -0,0 +1,23 @@
+package log
+
+import (
+	"github.com/gin-gonic/gin"
+	v1 "log-server/api/v1"
+)
+
+type IpLogRouter struct {
+
+}
+
+func (e *IpLogRouter) InitIpLogRouter(Router *gin.RouterGroup) {
+	ipLogRouter := Router.Group("ipLog")
+	logApi := v1.ApiGroupApp.LogApiGroup.ApiIpLog
+	{
+		ipLogRouter.POST("getIpLogList", logApi.GetIpLogList)	//获取ip日志列表
+		ipLogRouter.POST("getIp", logApi.GetIp)	//获取ip
+		ipLogRouter.POST("getGameIpList", logApi.GetGameIPList)	//获取ip日志列表
+		ipLogRouter.POST("getGameIp", logApi.GetGameIp)	//获取游戏ip
+		ipLogRouter.POST("gameIpExport", logApi.GameIpExport)	//导出游戏ip列表
+	}
+}
+

+ 2 - 0
router/log/loging.go

@@ -27,5 +27,7 @@ func (e *LogingRouter) InitLogingRouter(Router *gin.RouterGroup) {
 		excelRouter.POST("updatePcRemarks", logApi.UpdatePcRemarks)
 		excelRouter.POST("getLogScanningList", logApi.GetLogScanningList)
 		excelRouter.POST("computerRateExport", logApi.ComputerRateExport)
+		excelRouter.POST("computerSevenRate", logApi.ComputerSevenRate)
+
 	}
 }

+ 2 - 0
router/typeManage/responsiblePerson.go

@@ -19,5 +19,7 @@ func (r *ResponsiblePersonRouter) InitResponsiblePersonRouter(Router *gin.Router
 		responsiblePersonRouter.POST("getResponsiblePerson", responsiblePersonApi.GetResponsiblePerson)                     // 条件查询所有负责人
 		responsiblePersonRouter.POST("getDirectorList", responsiblePersonApi.GetResponsiblePersonAll)                       // 查询所有负责人
 		responsiblePersonRouter.POST("selectResponsiblePerson", responsiblePersonApi.SelectResponsiblePerson)
+		responsiblePersonRouter.POST("statusChange", responsiblePersonApi.StatusChange) // 更改负责人启用状态
+		responsiblePersonRouter.POST("pushStatusChange", responsiblePersonApi.PushStatusChange) // 更改负责人推送状态
 	}
 }

+ 6 - 6
service/dataStatistics/data_abnormal_rate.go

@@ -309,11 +309,11 @@ func (s *ServiceDataAbnormalRate) SyncAbnormalRateByBatch() {
 
 	}
 
-	for _, task := range dataList {
-		taskId := task.TaskId     //任务id
-		taskName := task.TaskName // 任务名
-		directorName := task.User //负责人
-		numFrozen := 0            //冻结
+	for _, task1 := range dataList {
+		taskId := task1.TaskId     //任务id
+		taskName := task1.TaskName // 任务名
+		directorName := task1.User //负责人
+		numFrozen := 0             //冻结
 		numPullAccount := 0
 		numStartSimulator := 0
 		numIp := 0
@@ -386,7 +386,7 @@ func (s *ServiceDataAbnormalRate) SyncAbnormalRateByBatch() {
 				global.GVA_LOG.Error("Error", zap.Error(err))
 				return
 			}
-			if gameId == task.TaskId {
+			if gameId == task1.TaskId {
 				orderSuccessRate, err = info.Get("order_success_rate").String()
 				if err != nil {
 					global.GVA_LOG.Error("Error", zap.Error(err))

+ 3 - 12
service/dataStatistics/wechat_scanner_detailed.go

@@ -170,10 +170,7 @@ func (s *ServiceWeChatScannerDetailed) SyncWeChatScannerDetailed(today string) {
 			data.AuthorizationTime = Time
 			data.TaskName = v.GameName
 			if errors.Is(global.GVA_DB.Model(&dataStatistics.WeChatScannerDetailed{}).Where("new_date = ? and task_id = ? and order_id = ?", today, k, orderId).First(&dataStatistics.WeChatScannerDetailed{}).Error, gorm.ErrRecordNotFound) {
-				err = global.GVA_DB.Create(&data).Error
-				if err != nil {
-					return
-				}
+				_ = global.GVA_DB.Create(&data).Error
 			}
 		}
 		//计算微信扫码消耗
@@ -230,15 +227,9 @@ func (s *ServiceWeChatScannerDetailed) SyncWeChatScannerDetailed(today string) {
 			//global.GVA_LOG.Info(db1Ledger.LedgerRetained)
 			//global.GVA_LOG.Info(db1Ledger.Ledger)
 			if !errors.Is(global.GVA_DB.Model(&dataStatistics.WeChatScannerLedger{}).Where("new_date = ? and task_id = ? and platform = ?", today, k, platform).First(&dataStatistics.WeChatScannerLedger{}).Error, gorm.ErrRecordNotFound) {
-				err = global.GVA_DB.Model(&dataStatistics.WeChatScannerLedger{}).Where("new_date = ? and task_id = ? and platform = ?", today, k, platform).Updates(db1Ledger).Error
-				if err != nil {
-					return
-				}
+				_ = global.GVA_DB.Model(&dataStatistics.WeChatScannerLedger{}).Where("new_date = ? and task_id = ? and platform = ?", today, k, platform).Updates(db1Ledger).Error
 			} else {
-				err = global.GVA_DB.Create(&db1Ledger).Error
-				if err != nil {
-					return
-				}
+				_ = global.GVA_DB.Create(&db1Ledger).Error
 			}
 
 		}

+ 1 - 0
service/log/enter.go

@@ -8,4 +8,5 @@ type ServiceGroup struct {
 	ServiceLogList
 	ServiceStatisticsLog
 	ServiceComputer
+	ServiceIpLog
 }

+ 189 - 0
service/log/log_ip.go

@@ -0,0 +1,189 @@
+package log
+
+import (
+	"fmt"
+	"github.com/xuri/excelize/v2"
+	"go.uber.org/zap"
+	"log-server/global"
+	"log-server/model/log"
+	"log-server/model/log/request"
+	"time"
+)
+
+type ServiceIpLog struct {
+}
+
+//根据gameId、机器编号分组获取ip
+func (s *ServiceIpLog) GetIpLogList(api log.IpLogRequest, info request.PageInfo, order string, desc bool) (list interface{}, total int64, err error) {
+	limit := info.PageSize
+	offset := info.PageSize * (info.Page - 1)
+	db := global.GVA_DB.Model(&log.IpLog{})
+	var apiList []log.IpLogResponse
+	startDate := time.Now().Format("2006-01-02")
+	endDate := time.Now().Format("2006-01-02")
+	if len(api.Date) == 2 {
+		startDate = api.Date[0]
+		endDate = api.Date[1]
+	}
+	db = db.Where("create_date >= ? and create_date <= ?", startDate, endDate)
+	if api.GameId != 0 {
+		db = db.Where("game_id = ?", api.GameId)
+	}
+	if api.PcCode != "" {
+		db = db.Where("pc_code = ?", api.PcCode)
+	}
+	if api.Ip != "" {
+		db = db.Where("ip = ?", api.Ip)
+	}
+
+	db = db.Select("create_date,pc_code,game_id,count(*) as count_total,count(distinct(ip)) as count_distinct_ip")
+	db = db.Group("pc_code, game_id, create_date")
+	//db.Select("count(*)").Count(&countTotal)
+	//db.Select("count(distinct(ip))").Count(&countDistinctIp)
+	err = db.Count(&total).Error
+	if err != nil {
+		return apiList, total, err
+	} else {
+		db = db.Limit(limit).Offset(offset)
+		if order != "" {
+			var OrderStr string
+			// 设置有效排序key 防止sql注入
+			// 感谢 Tom4t0 提交漏洞信息
+			orderMap := make(map[string]bool, 4)
+			orderMap["game_id"] = true
+			orderMap["count_distinct_ip"] = true
+			orderMap["count_total"] = true
+			orderMap["create_date"] = true
+			if orderMap[order] {
+				if desc {
+					OrderStr = order + " desc"
+				} else {
+					OrderStr = order
+				}
+			} else { // didn't matched any order key in `orderMap`
+				global.GVA_LOG.Error("获取失败!", zap.Error(err))
+				return apiList, total, err
+			}
+
+			err = db.Order(OrderStr).Find(&apiList).Error
+		} else {
+			err = db.Order("id").Find(&apiList).Error
+		}
+	}
+	//遍历更改日期格式
+	for i, _ := range apiList {
+		apiList[i].CreateDate = apiList[i].CreateDate[:10]
+	}
+	return apiList, total, err
+}
+
+//根据gameId获取ip
+func (s *ServiceIpLog) GetGameIpList(api log.IpLogRequest, info request.PageInfo, order string, desc bool) (apiList []log.GameIpResponse, total int64, err error) {
+	limit := info.PageSize
+	offset := info.PageSize * (info.Page - 1)
+	db := global.GVA_DB.Model(&log.IpLog{})
+
+	startDate := time.Now().Format("2006-01-02")
+	endDate := time.Now().Format("2006-01-02")
+	if len(api.Date) == 2 {
+		startDate = api.Date[0]
+		endDate = api.Date[1]
+	}
+	db = db.Where("ip_log.create_date >= ? and ip_log.create_date <= ?", startDate, endDate)
+	if api.GameId != 0 {
+		db = db.Where("ip_log.game_id = ?", api.GameId)
+		db = db.Joins("left join" + "(select count(*) as count, game_id, create_date from ip_log where game_id = ? and create_date >= ? and create_date <= ? group by game_id, create_date)" + " as late on late.game_id = ip_log.game_id and late.create_date = ip_log.create_date", api.GameId, startDate, endDate)
+	} else {
+		db = db.Joins("left join" + "(select count(*) as count, game_id, create_date from ip_log where create_date >= ? and create_date <= ? group by game_id, create_date)" + " as late on late.game_id = ip_log.game_id and late.create_date = ip_log.create_date",  startDate, endDate)
+	}
+
+	db = db.Where("status = 2")
+
+	db = db.Select("ip_log.create_date,ip_log.game_id,late.count as count_total, count(*) as success_ip , retained_complete as task_count, count(distinct(ip)) as count_distinct_ip")
+	db = db.Joins("left join game_target_complete as gtc on gtc.task_id = ip_log.game_id and gtc.create_date = ip_log.create_date")
+
+	db = db.Group("ip_log.game_id, ip_log.create_date")
+	//db.Select("count(*)").Count(&countTotal)
+	//db.Select("count(distinct(ip))").Count(&countDistinctIp)
+	err = db.Count(&total).Error
+	if err != nil {
+		return apiList, total, err
+	} else {
+		db = db.Limit(limit).Offset(offset)
+		if order != "" {
+			var OrderStr string
+			// 设置有效排序key 防止sql注入
+			// 感谢 Tom4t0 提交漏洞信息
+			orderMap := make(map[string]bool, 5)
+			//orderMap["game_id"] = true
+			orderMap["count_distinct_ip"] = true
+			orderMap["count_total"] = true
+			orderMap["success_ip"] = true
+			orderMap["task_count"] = true
+			orderMap["create_date"] = true
+			if orderMap[order] {
+				if desc {
+					OrderStr = order + " desc"
+				} else {
+					OrderStr = order
+				}
+			} else { // didn't matched any order key in `orderMap`
+				global.GVA_LOG.Error("获取失败!", zap.Error(err))
+				return apiList, total, err
+			}
+
+			err = db.Order(OrderStr).Find(&apiList).Error
+		} else {
+			err = db.Order("ip_log.id").Find(&apiList).Error
+		}
+	}
+	//遍历更改日期格式
+	for i, _ := range apiList {
+		apiList[i].CreateDate = apiList[i].CreateDate[:10]
+	}
+	return apiList, total, err
+}
+
+
+//展示ip
+func (s *ServiceIpLog) GetIp(iplog log.IpLogResponse) (list interface{}, total int64, err error) {
+	var ipList []log.QueryIpList
+	db := global.GVA_DB.Model(&log.IpLog{}).Select("ip, COUNT(1) as count").Where("game_id = ? and pc_code = ? and create_date = ?", iplog.GameId, iplog.PcCode, iplog.CreateDate).Group("ip")
+	db.Count(&total)
+	err = db.Order("count desc").Find(&ipList).Error
+	return ipList, total, err
+}
+
+//gameID分组展示ip
+func (s *ServiceIpLog) GetGameIp(ip log.GameIpResponse) (list interface{}, total int64, err error) {
+	var ipList []log.QueryIpList
+	db := global.GVA_DB.Model(&log.IpLog{}).Select("ip, COUNT(1) as count").Where("game_id = ? and status = 2 and create_date = ?", ip.GameId, ip.CreateDate).Group("ip")
+	db.Count(&total)
+	err = db.Order("count desc").Find(&ipList).Error
+	return ipList, total, err
+}
+
+//获取gameIP列表
+func (s *ServiceIpLog) GameIpListExcel(infoList []log.GameIpResponse, filePath string) error {
+	excel := excelize.NewFile()
+	excel.SetSheetRow("Sheet1", "A1", &[]string{
+		"游戏id",
+		"上报ip次数",
+		"任务完成",
+		"成功ip次数",
+		"ip个数",
+		"日期"})
+	for i, statisticsLog := range infoList {
+		axis := fmt.Sprintf("A%d", i+2)
+		excel.SetSheetRow("Sheet1", axis, &[]interface{}{
+			statisticsLog.GameId,
+			statisticsLog.CountTotal,
+			statisticsLog.TaskCount,
+			statisticsLog.SuccessIp,
+			statisticsLog.CountDistinctIp,
+			statisticsLog.CreateDate[:10],
+		})
+	}
+	err := excel.SaveAs(filePath)
+	return err
+}

+ 119 - 61
service/log/log_statistics.go

@@ -13,6 +13,7 @@ import (
 	"log-server/model/log"
 	"log-server/model/log/request"
 	"log-server/model/log/response"
+	"log-server/model/typeManage"
 	loging2 "log-server/service/log/loging"
 	"log-server/utils"
 	"strconv"
@@ -22,6 +23,7 @@ import (
 
 type ServiceStatisticsLog struct {
 	loging2.LogicalLog
+	Person typeManage.ResponsiblePerson
 }
 
 var StatisticsCompletedKey = "%s:StatisticsCompleted"
@@ -514,14 +516,18 @@ func (s *ServiceStatisticsLog) CreateComputerStatisticsData() {
 	onlineComputerMpa, _ := s.LogicalLog.GetOnlineComputerNumCache(ctx, s.LogicalLog.CurrentDate())
 	var computer log.Computer
 	computerData, _ := computer.OnlinePcCodeCache()
-	var csReplys []*log.LogComputer
-	// 不统计本地测试电脑
-	notStatistics := map[string]int{
-		"001": 1,
-		"002": 1,
+	if computerData == nil {
+		global.GVA_LOG.Warn("电脑缓存数据获取失败TaskStatisticsDataCache")
+		return
 	}
+	var csReplys []*log.LogComputer
 	for code, r := range codeMps {
-		if _, ok := notStatistics[code]; ok {
+		// 不统计不在电脑列表里的
+		if _, ok := computerData[code]; !ok {
+			continue
+		}
+		// 负责人为空的不统计
+		if computerData[code] == "" {
 			continue
 		}
 		accountMps, err := s.LogicalLog.GetComputerPullAccountNumCache(ctx, s.LogicalLog.CurrentDate(), code)
@@ -569,7 +575,7 @@ func (s *ServiceStatisticsLog) CreateComputerStatisticsData() {
 			csReply.ComputerHourAverageRate = csReply.TaskSuccessNum / runTime
 			csReply.Status = 2
 			global.GVA_DB.Where("create_date = ?", csReply.CreateDate).Where("pc_code = ?", csReply.PcCode).Where("game_id = ?", 0).Delete(&log.LogComputer{})
-			if !errors.Is(global.GVA_DB.Where("create_date = ?", csReply.CreateDate).Where("pc_code = ?", csReply.PcCode).First(&log.LogComputer{}).Error, gorm.ErrRecordNotFound) {
+			if !errors.Is(global.GVA_DB.Where("create_date = ?", csReply.CreateDate).Where("pc_code = ?", csReply.PcCode).Where("game_id = ?", gameId).First(&log.LogComputer{}).Error, gorm.ErrRecordNotFound) {
 				// 已存在,更新
 				mp := make(map[string]interface{})
 				if csReply.Operator != "" {
@@ -583,7 +589,7 @@ func (s *ServiceStatisticsLog) CreateComputerStatisticsData() {
 				mp["game_fee_rate"] = csReply.GameFeeRate
 				mp["computer_hour_average_rate"] = csReply.ComputerHourAverageRate
 				mp["enter_main"] = csReply.EnterMain
-				err = global.GVA_DB.Table("log_computer").Where("create_date = ?", csReply.CreateDate).Where("pc_code = ?", csReply.PcCode).Updates(mp).Error
+				err = global.GVA_DB.Table("log_computer").Where("create_date = ?", csReply.CreateDate).Where("pc_code = ?", csReply.PcCode).Where("game_id = ?", gameId).Updates(mp).Error
 				if err != nil {
 					global.GVA_LOG.Error("更新数据失败", zap.Error(err))
 				}
@@ -982,56 +988,6 @@ func (s *ServiceStatisticsLog) ComputerTest(c context.Context) (interface{}, err
 	return mps, err
 }
 
-// RegularCheckPc1 定时检查电脑情况
-func (s *ServiceStatisticsLog) RegularCheckPc1() {
-	ctx := context.Background()
-	date := s.LogicalLog.CurrentDate()
-	// 获取当天已上报的电脑数据
-	onlineComputerMpa, _ := s.LogicalLog.GetOnlineComputerNumCache(ctx, date)
-	// 获取数据库的数据
-	var computer log.Computer
-	computers, err := computer.OnlinePcCodeCache()
-	if err != nil {
-		global.GVA_LOG.Error("获取租机表数据失败", zap.Error(err))
-	}
-	// 查询两小时内上报的数据
-	var noReportingPc []string
-	for pc, _ := range onlineComputerMpa {
-		num := s.LogicalLog.GetPcReportingLog(ctx, pc)
-		delete(computers, pc)
-		if num == 0 {
-			noReportingPc = append(noReportingPc, pc)
-		}
-	}
-	// 未上报逻辑
-	var errReportingPc []string
-	for pc, name := range computers {
-		if name == "备用" {
-			continue
-		}
-		errReportingPc = append(errReportingPc, pc)
-	}
-	var content string
-	if len(errReportingPc) != 0 {
-		// 发信息数据群里
-		content += fmt.Sprintf("异常租机数据<font color=\"warning\">%d台</font>: %s", len(errReportingPc), errReportingPc)
-	}
-	if len(noReportingPc) != 0 {
-		// 发信息数据群里
-		content += "\n"
-		content += fmt.Sprintf("两小时内未检测到中控数据<font color=\"warning\">%d台</font>: %s", len(noReportingPc), noReportingPc)
-	}
-	if content != "" {
-		var sendMsg SendMsg
-		sendMsg.MsgType = "markdown"
-		sendMsg.Markdown.Content = content
-		//c ,_ := json.Marshal(sendMsg)
-		url := global.GVA_CONFIG.SendUrl.ComputerSendUrl
-		//url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b"
-		_, err = s.SendMsgData(url, sendMsg)
-	}
-}
-
 // 定时检查电脑情况
 func (s *ServiceStatisticsLog) RegularCheckPc() {
 	ctx := context.Background()
@@ -1040,6 +996,11 @@ func (s *ServiceStatisticsLog) RegularCheckPc() {
 	//computersF, err := computer.OnlinePcCodeCache()
 	if err != nil {
 		global.GVA_LOG.Error("获取租机表数据失败", zap.Error(err))
+		return
+	}
+	if computers == nil {
+		global.GVA_LOG.Warn("电脑缓存数据获取失败TaskStatisticsDataCache")
+		return
 	}
 	// 查询两小时内上报的数据
 	var computersF = map[string]string{}
@@ -1050,21 +1011,34 @@ func (s *ServiceStatisticsLog) RegularCheckPc() {
 			delete(computers, pc)
 			continue
 		}
+		if name == "" {
+			delete(computers, pc)
+			continue
+		}
 		num := s.LogicalLog.GetPcReportingLog(ctx, pc)
 		delete(computers, pc)
 		if num == 0 {
 			noReportingPc = append(noReportingPc, pc)
 		}
 	}
-
+	mpsPerson, _ := s.Person.GetUserInfo()
+	var mobile []string
 	var content string
-
+	nameMps := map[string]int{}
 	if len(noReportingPc) != 0 {
-		content += fmt.Sprintf("小时内未检测到中控数据<font color=\"warning\">%d台</font>:", len(noReportingPc))
+		content += fmt.Sprintf("小时内未检测到中控数据<font color=\"warning\">%d台</font>:", len(noReportingPc))
 		for _, pc := range noReportingPc {
 			content += "\n"
 			name := computersF[pc]
 			content += name + " : " + pc
+			nameMps[name] = 1
+		}
+	}
+	if len(nameMps) != 0 {
+		for name, _ := range nameMps {
+			if _, ok := mpsPerson[name]; ok {
+				mobile = append(mobile, mpsPerson[name])
+			}
 		}
 	}
 	if content != "" {
@@ -1075,9 +1049,22 @@ func (s *ServiceStatisticsLog) RegularCheckPc() {
 		url := global.GVA_CONFIG.SendUrl.ComputerSendUrl
 		//url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7d095d5b-8240-45fd-a68c-baff3628d83b"
 		_, err = s.SendMsgData(url, sendMsg)
+		if len(mobile) != 0 {
+			var sendTextData SendTextMsg
+			sendTextData.MsgType = "text"
+			sendTextData.Text.MentionedMobileList = mobile
+			_, _ = s.SendMsgData(url, sendTextData)
+		}
 	}
 }
 
+type SendTextMsg struct {
+	MsgType string `json:"msgtype"`
+	Text    struct {
+		MentionedMobileList []string `json:"mentioned_mobile_list"`
+	} `json:"text"`
+}
+
 type SendMsg struct {
 	MsgType  string `json:"msgtype"`
 	Markdown struct {
@@ -1248,3 +1235,74 @@ func (exa *ServiceStatisticsLog) ComputeRateList2Excel(infoList []*response.Comp
 	err := excel.SaveAs(filePath)
 	return err
 }
+
+// 电脑效率七天数据查询
+func (s *ServiceStatisticsLog) ComputerSevenStatistics(ctx context.Context, api log.LogComputer, info request.PageInfo, order string, desc bool) (statisticsLogsComputer []*response.ComputerStatisticsReply1, total int64, err error) {
+	date := api.CreateDate
+	endDate := ""
+	startDate := ""
+	if date == "" {
+		endDate = time.Now().Add(-time.Hour * 24).Format("2006-01-02")
+		startDate = time.Now().Add(-time.Hour * 24 * 8).Format("2006-01-02")
+	} else {
+		formatTime, _ := time.Parse("2006-01-02", date)
+		endDate = date
+		startDate = formatTime.Add(-time.Hour * 24 * 7).Format("2006-01-02")
+	}
+	db := global.GVA_DB.Model(&log.LogComputer{})
+	db = db.Where("create_date >= ? and create_date <= ?", startDate, endDate)
+	db = db.Where("pc_code = ?", api.PcCode)
+
+	err = db.Count(&total).Error
+	if err != nil {
+		return nil, 0, err
+	}
+	limit := info.PageSize
+	offset := info.PageSize * (info.Page - 1)
+	var statisticsLogs []*log.LogComputer
+	db = db.Limit(limit).Offset(offset)
+	db.Group("create_date")
+	if order != "" {
+		var OrderStr string
+		// 设置有效排序key 防止sql注入
+		// 感谢 Tom4t0 提交漏洞信息
+		orderMap := make(map[string]bool, 3)
+		orderMap["pc_code"] = true
+		orderMap["game_id"] = true
+		orderMap["operator"] = true
+		if orderMap[order] {
+			if desc {
+				OrderStr = order + " desc"
+			} else {
+				OrderStr = order
+			}
+		} else { // didn't matched any order key in `orderMap`
+			global.GVA_LOG.Error("获取失败!", zap.Error(err))
+			return statisticsLogsComputer, total, err
+		}
+		err = db.Order(OrderStr).Find(&statisticsLogs).Error
+	} else {
+		err = db.Order("id").Find(&statisticsLogs).Error
+	}
+	if err != nil {
+		return nil, 0, err
+	}
+
+	for _, statisticsLog := range statisticsLogs {
+		statisticsLogComputer := new(response.ComputerStatisticsReply1)
+		statisticsLogComputer.PcCode = statisticsLog.PcCode
+		statisticsLogComputer.Operator = statisticsLog.Operator
+		statisticsLogComputer.CreateDate = statisticsLog.CreateDate[:10]
+		statisticsLogComputer.GameId = statisticsLog.GameId
+		statisticsLogComputer.PullAccountNum = statisticsLog.PullAccountNum
+		statisticsLogComputer.TaskSuccessNum = statisticsLog.TaskSuccessNum
+		statisticsLogComputer.TargetNum = statisticsLog.TargetNum
+		statisticsLogComputer.ComputerFreeTime = statisticsLog.ComputerFreeTime
+		statisticsLogComputer.ComputerFeeRate = statisticsLog.ComputerFeeRate
+		statisticsLogComputer.EnterMain = statisticsLog.EnterMain
+		statisticsLogComputer.ComputerFeeRate = statisticsLog.ComputerFeeRate
+		statisticsLogComputer.ComputerHourAverageRate = statisticsLog.ComputerHourAverageRate
+		statisticsLogsComputer = append(statisticsLogsComputer, statisticsLogComputer)
+	}
+	return statisticsLogsComputer, total, err
+}

+ 19 - 1
service/log/loging/logical_log.go

@@ -764,7 +764,7 @@ func (s *LogicalLog) GetPcReportingLog(ctx context.Context, pcCode string) (num
 		return
 	}
 	end := time.Now().UnixNano()/1e6 + 60*1000*2
-	start := end - (120*60*1000 + 60*1000)
+	start := end - (60*60*1000 + 60*1000)
 	op := redis.ZRangeBy{
 		Min: strconv.Itoa(int(start)),
 		Max: strconv.Itoa(int(end)),
@@ -860,3 +860,21 @@ func (s *LogicalLog) AddCodeLog(request request.AddLogRequest, status int) {
 		global.GVA_LOG.Error("create LogScanningCode fail", zap.Error(err))
 	}
 }
+
+// 记录ip信息
+func (s *LogicalLog) AddIpLog(request request.AddLogRequest) {
+	if request.SimulatorIp == "" {
+		return
+	}
+	logSC := new(log.IpLog)
+	logSC.GameId = request.GameId
+	logSC.LogUuid = request.LogUuid
+	logSC.Ip = request.SimulatorIp
+	logSC.Account = request.Account
+	logSC.PcCode = request.PcCode
+	logSC.CreateDate = time.Now().Format("2006-01-02")
+	err := global.GVA_DB.Omit("create_time").Create(&logSC).Error
+	if err != nil {
+		global.GVA_LOG.Error("create LogScanningCode fail", zap.Error(err))
+	}
+}

+ 1 - 0
service/log/loging/simulator_start_log.go

@@ -25,6 +25,7 @@ func (s *SimulatorStartLog) SuccessLog(ctx context.Context, request request.AddL
 	} else {
 		_ = s.logical.SetUuidCodeCache(context.Background(), s.logical.CurrentDate(), s.logical.Request.LogUuid, s.logical.Request.Coding, s.logical.Request.GameId)
 	}
+	s.logical.AddIpLog(s.logical.Request)
 	err = s.logical.PartTypeLogSetNum(ctx, s.logical.CurrentDate(), s.logical.Request.GameId, code, OkStatus, s.logical.Request.TaskType)
 	if err != nil {
 		return

+ 23 - 1
service/task/common.go

@@ -1,6 +1,11 @@
 package task
 
-import "log-server/utils"
+import (
+	"log-server/global"
+	"log-server/model/task"
+	"log-server/utils"
+	"time"
+)
 
 type Common struct {
 }
@@ -12,7 +17,24 @@ type SendMsg struct {
 	} `json:"markdown"`
 }
 
+type SendTextMsg struct {
+	MsgType string `json:"msgtype"`
+	Text    struct {
+		MentionedMobileList []string `json:"mentioned_mobile_list"`
+	} `json:"text"`
+}
+
 func (s *Common) SendMsgData(url string, params interface{}) {
 	_, _ = utils.HttpPost(url, params)
 	return
 }
+
+func (s *Common) SaveGameAddFee(num, target int, taskName string) {
+	fee := new(task.GameAddFee)
+	fee.TaskName = taskName
+	fee.Num = num
+	fee.Target = target
+	fee.CreateDate = time.Now()
+	global.GVA_DB.Omit("create_time").Create(&fee)
+	return
+}

+ 16 - 1
service/task/game_task.go

@@ -763,7 +763,21 @@ func (s *GameTask) UpdateGameTaskTarget(requestData request.UpdateGameTaskTarget
 			global.GVA_LOG.Warn("进入修改add update")
 			lastPayAddUpdateTimeKey := fmt.Sprintf(LastPayAddUpdateTimeKey, date, gameTask.TaskId)
 			_ = s.cache.SetCacheStr(context.Background(), lastPayAddUpdateTimeKey, time.Now().Unix())
-			msg := "# 测试监控报警 " + time.Now().Format("2006-01-02 15:04:05")
+			// 本次加付费目标数据
+			lastPayAddNumKey := fmt.Sprintf(LastPayAddNumKey, date, gameTask.TaskId)
+			_ = s.cache.SetCacheStr(context.Background(), lastPayAddNumKey, requestData.PayTarget-gameTask.PayTarget)
+			payErrAddNumKey := fmt.Sprintf(PayErrAddNumKey, date, gameTask.TaskId)
+			s.common.SaveGameAddFee(requestData.PayTarget-gameTask.PayTarget, requestData.PayTarget, taskData.TaskName)
+			// 如果当前付费目标完成,加入一下逻辑
+			if gameTask.PayTarget <= gameTask.PayComplete {
+				lastPayCompletedUpdateTimeKey := fmt.Sprintf(LastPayCompletedUpdateTimeKey, date, gameTask.TaskId)
+				_ = s.cache.SetCacheStr(context.Background(), lastPayCompletedUpdateTimeKey, time.Now().Unix())
+				_ = s.cache.SetCacheStr(context.Background(), payErrAddNumKey, requestData.PayTarget-gameTask.PayTarget)
+			} else {
+				n, _ := s.cache.GetCacheNum(context.Background(), payErrAddNumKey)
+				_ = s.cache.SetCacheStr(context.Background(), payErrAddNumKey, requestData.PayTarget-gameTask.PayTarget+n)
+			}
+			msg := "# 监控报警 " + time.Now().Format("2006-01-02 15:04:05")
 			msg += "\n"
 			msg += "**" + taskData.User + "**"
 			msg += "\n"
@@ -1068,6 +1082,7 @@ func (exa *GameTask) TaskStatisticsList2Excel(infoList []response.GetGameTargetC
 			isComplete,
 			statisticsLog.HandPayComplete,
 			statisticsLog.HandAmountTotal,
+			statisticsLog.Amount,
 		})
 	}
 	err := excel.SaveAs(filePath)

+ 53 - 0
service/task/regular_task.go

@@ -0,0 +1,53 @@
+package task
+
+import (
+	"context"
+	"go.uber.org/zap"
+	"log-server/global"
+	"log-server/model/rentComputer"
+)
+
+type ServiceRegularTask struct {
+}
+
+const OnlinePcCode = "Online:PcCode"
+
+func (s *ServiceRegularTask) OnlinePcCodeUpdateCache() {
+	ctx := context.Background()
+	isNull, err := global.GVA_REDIS.Exists(ctx, OnlinePcCode).Result()
+	mps := map[string]string{}
+	if isNull != 0 {
+		mps, err = global.GVA_REDIS.HGetAll(ctx, OnlinePcCode).Result()
+		if err != nil {
+			global.GVA_LOG.Error("OnlinePcCodeUpdateCache获取表失败", zap.Error(err))
+			return
+		}
+	}
+	var computers []*rentComputer.RentComputer
+	err = global.GVA_DB.Where("is_off_shelf = ?", 0).Find(&computers).Error
+	if err != nil {
+		global.GVA_LOG.Error("OnlinePcCodeUpdateCache获取表失败", zap.Error(err))
+		return
+	}
+	if len(computers) == 0 {
+		return
+	}
+	var mp = map[string]string{}
+	for _, pc := range computers {
+		mp[pc.PcNum] = pc.DirectorName
+		if _, ok := mps[pc.PcNum]; ok {
+			delete(mps, pc.PcNum)
+		}
+	}
+	err = global.GVA_REDIS.HSet(ctx, OnlinePcCode, mp).Err()
+	if err != nil {
+		global.GVA_LOG.Error("OnlinePcCodeUpdateCache更新缓存失败", zap.Error(err))
+		return
+	}
+	if mps != nil {
+		for code, _ := range mps {
+			global.GVA_REDIS.HDel(ctx, OnlinePcCode, code)
+		}
+	}
+	return
+}

+ 147 - 53
service/task/sync_data.go

@@ -13,6 +13,7 @@ import (
 	"log-server/model/task"
 	"log-server/model/task/control"
 	request2 "log-server/model/task/request"
+	"log-server/model/typeManage"
 	"log-server/service/cache"
 	"log-server/utils"
 	"strconv"
@@ -22,6 +23,8 @@ import (
 type SyncData struct {
 	GameTask GameTask
 	cache    cache.Cache
+	common   Common
+	Person   typeManage.ResponsiblePerson
 }
 
 func (s *SyncData) SyncXmyGameData(date string) (mps map[int]control.XmyPayRequestReplyData, err error) {
@@ -190,6 +193,20 @@ func (s *SyncData) SyncTaskData() {
 				if gameTarget.PayTarget > completeTaskData[gameTask.TaskId].PayTarget {
 					lastPayAddUpdateTimeKey := fmt.Sprintf(LastPayAddUpdateTimeKey, date, gameTask.TaskId)
 					_ = s.cache.SetCacheStr(context.Background(), lastPayAddUpdateTimeKey, time.Now().Unix())
+					// 本次加付费目标数据
+					lastPayAddNumKey := fmt.Sprintf(LastPayAddNumKey, date, gameTask.TaskId)
+					_ = s.cache.SetCacheStr(context.Background(), lastPayAddNumKey, gameTarget.PayTarget-completeTaskData[gameTask.TaskId].PayTarget)
+					payErrAddNumKey := fmt.Sprintf(PayErrAddNumKey, date, gameTask.TaskId)
+					s.common.SaveGameAddFee(gameTarget.PayTarget-completeTaskData[gameTask.TaskId].PayTarget, gameTarget.PayTarget, gameTask.TaskName)
+					// 如果当前付费目标完成,加入一下逻辑
+					if completeTaskData[gameTask.TaskId].PayTarget <= completeTaskData[gameTask.TaskId].PayComplete {
+						lastPayCompletedUpdateTimeKey := fmt.Sprintf(LastPayCompletedUpdateTimeKey, date, gameTask.TaskId)
+						_ = s.cache.SetCacheStr(context.Background(), lastPayCompletedUpdateTimeKey, time.Now().Unix())
+						_ = s.cache.SetCacheStr(context.Background(), payErrAddNumKey, gameTarget.PayTarget-completeTaskData[gameTask.TaskId].PayTarget)
+					} else {
+						n, _ := s.cache.GetCacheNum(context.Background(), payErrAddNumKey)
+						_ = s.cache.SetCacheStr(context.Background(), payErrAddNumKey, gameTarget.PayTarget-completeTaskData[gameTask.TaskId].PayTarget+n)
+					}
 				}
 			}
 
@@ -197,11 +214,10 @@ func (s *SyncData) SyncTaskData() {
 			gameTarget.NewComplete = roomData.NewCompleteLocal
 			gameTarget.PayComplete = roomData.PayCompleteLocal
 			gameTarget.RetainedComplete = roomData.NewCompleteLocal + roomData.RetainedCompleteLocal
-			gameTarget.Amount = 6 * roomData.PayCompleteLocal
+			gameTarget.Amount = gameTask.PayPrice * roomData.PayCompleteLocal
 			if gameTarget.RetainedComplete < roomData.RetainedComplete {
 				gameTarget.RetainedComplete = roomData.RetainedComplete
 			}
-
 		}
 		gameTarget.GameRate = roomData.GameRate
 		if gameTask.GamePortId == 5 && gameTask.LoginMethod == 2 {
@@ -211,6 +227,20 @@ func (s *SyncData) SyncTaskData() {
 				if gameTarget.PayTarget > completeTaskData[gameTask.TaskId].PayTarget {
 					lastPayAddUpdateTimeKey := fmt.Sprintf(LastPayAddUpdateTimeKey, date, gameTask.TaskId)
 					_ = s.cache.SetCacheStr(context.Background(), lastPayAddUpdateTimeKey, time.Now().Unix())
+					// 本次加付费目标数据
+					lastPayAddNumKey := fmt.Sprintf(LastPayAddNumKey, date, gameTask.TaskId)
+					_ = s.cache.SetCacheStr(context.Background(), lastPayAddNumKey, gameTarget.PayTarget-completeTaskData[gameTask.TaskId].PayTarget)
+					payErrAddNumKey := fmt.Sprintf(PayErrAddNumKey, date, gameTask.TaskId)
+					s.common.SaveGameAddFee(gameTarget.PayTarget-completeTaskData[gameTask.TaskId].PayTarget, gameTarget.PayTarget, gameTask.TaskName)
+					// 如果当前付费目标完成,加入一下逻辑
+					if completeTaskData[gameTask.TaskId].PayTarget <= completeTaskData[gameTask.TaskId].PayComplete {
+						lastPayCompletedUpdateTimeKey := fmt.Sprintf(LastPayCompletedUpdateTimeKey, date, gameTask.TaskId)
+						_ = s.cache.SetCacheStr(context.Background(), lastPayCompletedUpdateTimeKey, time.Now().Unix())
+						_ = s.cache.SetCacheStr(context.Background(), payErrAddNumKey, gameTarget.PayTarget-completeTaskData[gameTask.TaskId].PayTarget)
+					} else {
+						n, _ := s.cache.GetCacheNum(context.Background(), payErrAddNumKey)
+						_ = s.cache.SetCacheStr(context.Background(), payErrAddNumKey, gameTarget.PayTarget-completeTaskData[gameTask.TaskId].PayTarget+n)
+					}
 				}
 			}
 		}
@@ -269,16 +299,18 @@ func (s *SyncData) DayTargetDataStatistics() {
 	global.GVA_DB.Omit("update_time").Create(gameTargetDates)
 }
 
-var LastMsgSendTimeKey = "%s:lastMsgSendTime"
-var LastNewCompletedKey = "%s:msgSendInfo:%d:lastNewCompleted"
-var LastPayCompletedKey = "%s:msgSendInfo:%d:lastPayCompleted"
-var LastRetainedCompletedKey = "%s:msgSendInfo:%d:lastRetainedCompleted"
-var LastNewCompletedUpdateTimeKey = "%s:msgSendInfo:%d:lastNewCompletedUpdateTime"
-var LastPayCompletedUpdateTimeKey = "%s:msgSendInfo:%d:lastPayCompletedUpdateTime"
-var LastRetainedCompletedUpdateTimeKey = "%s:msgSendInfo:%d:lastRetainedCompletedUpdateTime"
-var LastPayAddUpdateTimeKey = "%s:msgSendInfo:%d:lastPayAddUpdateTime"
-var TaskCompletedStatusKey = "%s:taskCompletedStatus"
-var LastFreeMsgSendTimeKey = "%s:lastFreeMsgSendTime"
+var LastMsgSendTimeKey = "%s:lastMsgSendTime"                                                // 上次活跃发送消息时间
+var LastNewCompletedKey = "%s:msgSendInfo:%d:lastNewCompleted"                               // 最后新增完成数量
+var LastPayCompletedKey = "%s:msgSendInfo:%d:lastPayCompleted"                               // 最后支付完成数量
+var LastRetainedCompletedKey = "%s:msgSendInfo:%d:lastRetainedCompleted"                     // 最后留存完成数量
+var LastNewCompletedUpdateTimeKey = "%s:msgSendInfo:%d:lastNewCompletedUpdateTime"           // 最后新增完成更新时间
+var LastPayCompletedUpdateTimeKey = "%s:msgSendInfo:%d:lastPayCompletedUpdateTime"           // 最后支付完成更新时间
+var LastRetainedCompletedUpdateTimeKey = "%s:msgSendInfo:%d:lastRetainedCompletedUpdateTime" // 最后留存完成更新时间
+var LastPayAddUpdateTimeKey = "%s:msgSendInfo:%d:lastPayAddUpdateTime"                       // 最后加付费时间
+var LastPayAddNumKey = "%s:msgSendInfo:%d:lastPayAddNum"                                     // 最后加付费数量
+var PayErrAddNumKey = "%s:msgSendInfo:%d:PayErrAddNum"                                       // 支付异常累加数量
+var TaskCompletedStatusKey = "%s:taskCompletedStatus"                                        // 任务完成状态-1,1
+var LastFreeMsgSendTimeKey = "%s:lastFreeMsgSendTime"                                        // 上次付费发送消息时间
 
 type CompletedInfo struct {
 	AlsoTarget       int //剩余数量
@@ -393,7 +425,7 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
 	}
 
 	var taskStatistics = "%s:taskStatistics"
-	var retained = "# 测试活跃播报 "
+	var retained = "# 活跃播报 "
 	if len(mps) == 0 {
 		global.GVA_LOG.Warn(retained)
 	}
@@ -401,6 +433,7 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
 	var errMsg = "**以下游戏目标效率为零:**"
 	var errMsgZ = ""
 	var sendMsg = map[string]string{}
+	var errSendMsg = map[string]string{}
 	var m int // 时间内
 	m = (int(ctime) - lastMsgSendTime) / 60
 	for taskId, data := range mps {
@@ -417,6 +450,7 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
 		}
 		var taskStatistics request.TaskStatistics
 		_ = json.Unmarshal([]byte(gameTask), &taskStatistics)
+		var eMsg = "" //单条异常数据
 		var isNew = false
 		var nm int      //新增时间内
 		var rm int      //存时间内
@@ -470,35 +504,39 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
 
 		// 5分钟数据没动报异常数据
 		if newErr && nm > 4 {
-			errMsgZ += "\n"
-			errMsgZ += taskStatistics.GameName
-			errMsgZ += ",新增"
+			eMsg += "\n"
+			eMsg += taskStatistics.GameName
+			eMsg += ",新增"
 			if nm >= 60 {
-				errMsgZ += "("
-				errMsgZ += strconv.Itoa(nm / 60)
-				errMsgZ += "小时内)"
+				eMsg += "("
+				eMsg += strconv.Itoa(nm / 60)
+				eMsg += "小时内)"
 			} else {
-				errMsgZ += "("
-				errMsgZ += strconv.Itoa(nm)
-				errMsgZ += "分钟内)"
+				eMsg += "("
+				eMsg += strconv.Itoa(nm)
+				eMsg += "分钟内)"
 			}
 		}
 		if retainedErr && rm > 4 {
 			if !newErr {
-				errMsgZ += "\n"
-				errMsgZ += taskStatistics.GameName
+				eMsg += "\n"
+				eMsg += taskStatistics.GameName
 			}
-			errMsgZ += ",活跃"
+			eMsg += ",活跃"
 			if rm >= 60 {
-				errMsgZ += "("
-				errMsgZ += strconv.Itoa(rm / 60)
-				errMsgZ += "小时内)"
+				eMsg += "("
+				eMsg += strconv.Itoa(rm / 60)
+				eMsg += "小时内)"
 			} else {
-				errMsgZ += "("
-				errMsgZ += strconv.Itoa(rm)
-				errMsgZ += "分钟内)"
+				eMsg += "("
+				eMsg += strconv.Itoa(rm)
+				eMsg += "分钟内)"
 			}
 		}
+		if eMsg != "" {
+			errMsgZ += eMsg
+			errSendMsg[name] += eMsg
+		}
 		sendMsg[name] += ","
 		if m >= 60 {
 			sendMsg[name] += strconv.Itoa(m / 60)
@@ -510,28 +548,68 @@ func (s *SyncData) TaskMsgSendRetainedData(ctx context.Context, completesInfo []
 		//sendMsg[name] += rate
 		sendMsg[name] += fmt.Sprintf("<font color=\"warning\">%s</font>", rate)
 	}
+	hour := time.Now().Hour()
+	msg := ""
+	mpsPerson, _ := s.Person.GetUserInfo()
+	//b1 ,_ := json.Marshal(mpsPerson)
+	//global.GVA_LOG.Warn(string(b1))
+	var mobile []string
+	if hour >= 16 {
+		if len(sendMsg) == 0 {
+			return
+		}
+		if len(mps) != 0 && len(errSendMsg) != 0 {
+			for name, _ := range errSendMsg {
+				mobile = append(mobile, mpsPerson[name])
+			}
+		}
+		for name, msg := range sendMsg {
+			retained += "\n"
+			retained += "**" + name + "**"
+			retained += msg
+		}
+		msg = retained
+		if errMsgZ != "" {
+			msg += "\n"
+			//msg += errMsg + errMsgZ
+			msg += fmt.Sprintf("<font color=\"warning\">%s</font>", errMsg+errMsgZ)
+		}
+	} else {
+		if errMsgZ != "" {
 
-	if len(sendMsg) == 0 {
-		return
-	}
-	for name, msg := range sendMsg {
-		retained += "\n"
-		retained += "**" + name + "**"
-		retained += msg
-	}
-	msg := retained
-	if errMsgZ != "" {
-		msg += "\n"
-		//msg += errMsg + errMsgZ
-		msg += fmt.Sprintf("<font color=\"warning\">%s</font>", errMsg+errMsgZ)
+			//msg += errMsg + errMsgZ
+
+		}
+		if len(mps) != 0 && len(errSendMsg) != 0 {
+			msg += "# 活跃播报 "
+			msg += errMsg
+			for name, m := range errSendMsg {
+				mobile = append(mobile, mpsPerson[name])
+				msg += "\n"
+				msg += "**" + name + "**"
+				msg += fmt.Sprintf("<font color=\"warning\">%s</font>", m)
+			}
+		}
 	}
-	global.GVA_LOG.Warn(msg)
+	//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"
+	if msg == "" {
+		return
+	}
+	url := global.GVA_CONFIG.SendUrl.ComputerSendUrl
 	var sendData SendMsg
 	sendData.MsgType = "markdown"
 	sendData.Markdown.Content = msg
 	s.SendMsgData(url, sendData)
+
+	if len(mobile) != 0 {
+		var sendTextData SendTextMsg
+		sendTextData.MsgType = "text"
+		sendTextData.Text.MentionedMobileList = mobile
+		//b ,_ := json.Marshal(sendTextData)
+		//global.GVA_LOG.Warn(string(b))
+		s.SendMsgData(url, sendTextData)
+	}
 }
 
 func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task.GameTargetComplete, ctime int64, date, lastFreeMsgSendTimeKey string, isOne bool) {
@@ -576,13 +654,15 @@ func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task
 		return
 	}
 	var taskStatistics = "%s:taskStatistics"
-	var retained = "测试付费播报 "
+	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 //时间内
 	m = (int(ctime) - lastFreeMsgSendTime) / 60
+	mpsPerson, _ := s.Person.GetUserInfo()
+	var mobile []string
 	for taskId, data := range RateMp {
 		if data.AlsoTarget <= 0 {
 			continue
@@ -614,22 +694,30 @@ func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task
 			data.TimeRate = 60 * 60 * 2
 		}
 		// 5分钟数据没动报异常数据
-		if data.TimeRate/60 >= 4 {
+		if data.TimeRate/60 >= 2 {
 			if data.Rate == 0 {
+				lastPayAddNumKey := fmt.Sprintf(LastPayAddNumKey, date, data.TaskId)
+				payErrAddNumKey := fmt.Sprintf(PayErrAddNumKey, date, data.TaskId)
+				numErr, _ := s.cache.GetCacheNum(context.Background(), payErrAddNumKey)
+				lastAddFeeNumErr, _ := s.cache.GetCacheNum(context.Background(), lastPayAddNumKey)
 				errMsgZ += "\n"
 				errMsgZ += taskStatistics.GameName
 				errMsgZ += "("
 				if data.TimeRate/60 >= 60 {
 					errMsgZ += strconv.Itoa(data.TimeRate / 60 / 60)
-					errMsgZ += "小时内)"
+					errMsgZ += "小时内(+" + strconv.Itoa(numErr) + "))"
 				} else {
 					errMsgZ += strconv.Itoa(data.TimeRate / 60)
-					errMsgZ += "分钟内)"
+					errMsgZ += "分钟内(+" + strconv.Itoa(numErr) + "))"
 				}
 				errMsgZ += ","
 				errMsgZ += "最后加付费时间 "
 				t := time.Unix(int64(data.AddPayUpdateTime), 0)
 				errMsgZ += t.Format("15:04:05")
+				errMsgZ += "(+" + strconv.Itoa(lastAddFeeNumErr) + ")"
+				if _, ok := mpsPerson[name]; ok {
+					mobile = append(mobile, mpsPerson[name])
+				}
 			}
 		}
 		sendMsg[name] += ","
@@ -659,11 +747,17 @@ func (s *SyncData) TaskMsgSendFreeData(ctx context.Context, completesInfo []task
 	}
 	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"
+	url := global.GVA_CONFIG.SendUrl.ComputerSendUrl
 	var sendData SendMsg
 	sendData.MsgType = "markdown"
 	sendData.Markdown.Content = msg
 	s.SendMsgData(url, sendData)
+	if len(mobile) != 0 {
+		var sendTextData SendTextMsg
+		sendTextData.MsgType = "text"
+		sendTextData.Text.MentionedMobileList = mobile
+		s.SendMsgData(url, sendTextData)
+	}
 	return
 }
 
@@ -756,11 +850,11 @@ func (s *SyncData) CheckTaskCompletedInfo() {
 		global.GVA_LOG.Info("TaskMsgSend没有查询到未完成数据")
 		time.Sleep(time.Second * 10)
 		_ = s.cache.SetCacheStr(ctx, taskCompletedStatusKey, 1)
-		msg := "# 测试监控报警 "
+		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"
+		url := global.GVA_CONFIG.SendUrl.ComputerSendUrl
 		var sendData SendMsg
 		sendData.MsgType = "markdown"
 		sendData.Markdown.Content = msg

+ 22 - 1
service/typeManage/tm_responsiblePerson.go

@@ -7,6 +7,7 @@ import (
 	"log-server/global"
 	"log-server/model/common/request"
 	"log-server/model/typeManage"
+	typeReq "log-server/model/typeManage/request"
 	"math/rand"
 )
 
@@ -97,7 +98,7 @@ func (r *ResponsiblePersonService) UpdateResponsiblePerson(person typeManage.Res
 	if !errors.Is(err, gorm.ErrRecordNotFound) {
 		return errors.New("已存在相同名字,无法更改")
 	}
-	return global.GVA_DB.Table("responsible_person").Updates(&person).Error
+	return global.GVA_DB.Table("responsible_person").Omit("create_time, update_time").Save(&person).Error
 }
 
 // 通过id查询负责人
@@ -168,3 +169,23 @@ func (r *ResponsiblePersonService) SelectResponsiblePersonList() (list interface
 	err = db.Find(&personList).Error
 	return personList, err
 }
+
+//更改负责人启用状态
+func (r *ResponsiblePersonService) UpdateResponsibleStatus(c typeReq.UpdateResponsibleStatusRequest) (err error) {
+	err = global.GVA_DB.Table("responsible_person").Where("id = ?", c.Id).Error
+	if errors.Is(err, gorm.ErrRecordNotFound) {
+		return errors.New("请传入正确的Id")
+	}
+	err = global.GVA_DB.Table("responsible_person").Where("id = ?", c.Id).Update("state", c.State).Error
+	return err
+}
+
+//更改负责人推送状态
+func (r *ResponsiblePersonService) UpdatePushStatus(c typeReq.UpdatePushStatusRequest) (err error) {
+	err = global.GVA_DB.Table("responsible_person").Where("id = ?", c.Id).Error
+	if errors.Is(err, gorm.ErrRecordNotFound) {
+		return errors.New("请传入正确的Id")
+	}
+	err = global.GVA_DB.Table("responsible_person").Where("id = ?", c.Id).Update("push_status", c.PushStatus).Error
+	return err
+}

+ 1 - 1
utils/verify.go

@@ -24,7 +24,7 @@ var (
 	GameChannelVerify       = Rules{"ChannelName": {NotEmpty()}, "ChannelDesc": {NotEmpty()}, "DisplaySequence": {NotEmpty()}}
 	GameListVerify          = Rules{"GameName": {NotEmpty()}, "GamePort": {NotEmpty()}, "LoginType": {NotEmpty()}}
 	LoginTypeVerify         = Rules{"LoginName": {NotEmpty()}, "LoginDesc": {NotEmpty()}}
-	ResponsiblePersonVerify = Rules{"Name": {NotEmpty()}}
+	ResponsiblePersonVerify = Rules{"Name": {NotEmpty()} }
 	AccountTypeVerify       = Rules{"TypeName": {NotEmpty()}}
 	GameTaskVerify          = Rules{"TaskId": {NotEmpty()}, "TaskName": {NotEmpty()}, "User": {NotEmpty()}, "NewRetained": {NotEmpty()}, "GamePortId": {NotEmpty()}}
 	TaskIdVerify            = Rules{"TaskId": {NotEmpty()}}