ソースを参照

Merge remote-tracking branch 'origin/master'

wangbin 3 年 前
コミット
4fd8a8b828

+ 3 - 1
api/v1/card/enter.go

@@ -1,5 +1,7 @@
 package card
 
+import "log-server/service"
+
 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.
@@ -7,7 +9,7 @@ type ApiGroup struct {
 }
 
 var(
-	//gameService = service.ServiceGroupApp.TypeServiceGroup.GameChannelService
+	idCardService = service.ServiceGroupApp.CardServiceGroup.IdCardService
 	//gameListService = service.ServiceGroupApp.TypeServiceGroup.GameListService
 	//loginTypeService = service.ServiceGroupApp.TypeServiceGroup.LoginTypeService
 	//responsiblePersonService = service.ServiceGroupApp.TypeServiceGroup.ResponsiblePersonService

+ 35 - 2
api/v1/card/id_card.go

@@ -1,11 +1,44 @@
 package card
 
-import "github.com/gin-gonic/gin"
+import (
+	"github.com/gin-gonic/gin"
+	"go.uber.org/zap"
+	"log-server/global"
+	cardReq "log-server/model/card/request"
+	"log-server/model/common/response"
+	"strconv"
+)
 
 type IdCardApi struct {
 }
 
 func (a *IdCardApi) GetIdCard(c *gin.Context) {
-	c.Param("")
+	var idCard cardReq.IdCardRequest
+	_ = c.ShouldBind(&idCard)
+	//rows转型为整型
+	rows, _ := strconv.Atoi(c.Query("rows"))
+	idCard.Rows = rows
+	if idCard.Channel != "tencent" && idCard.Channel != "xmy" && idCard.Channel != "mz" {
+		response.FailWithMessage("请传入正确的渠道", c)
+		return
+	}
+	if idCard.Rows == 0 {
+		idCard.Rows = 1
+	}
+	if idCard.Flag != "realuser" {
+		idCard.Flag = ""
+	}
+	if idCardList, err := idCardService.GetIdCard(idCard); err != nil{
+		global.GVA_LOG.Error("获取失败!", zap.Error(err))
+		response.FailWithMessage("获取失败", c)
+	} else {
+		response.OkWithDetailed(idCardList, "success", c)
+	}
+
+
+
+
+
+
 }
 

+ 6 - 4
api/v1/log/log_ip.go

@@ -44,15 +44,17 @@ func (s *ApiIpLog) GetIpLogList(c *gin.Context) {
 	}
 }
 
+
+
 //根据gameId分组获取ip
 func (s *ApiIpLog) GetGameIPList(c *gin.Context) {
-	var paramsInfo request.IpLogListRequest
+	var paramsInfo request.GameIpRequest
 	_ = 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)
+	list, total, err := ServiceIpLog.GetGameIpList(paramsInfo.GameIpRequest, paramsInfo.PageInfo, paramsInfo.OrderKey, paramsInfo.Desc)
 	if err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Error(err))
 		response.FailWithMessage("获取失败", c)
@@ -129,7 +131,7 @@ func (s *ApiIpLog) GetGameIp(c *gin.Context) {
 	}
 }
 
-//导出gameIp列表
+//导出列表
 func (s *ApiIpLog) GameIpExport(c *gin.Context) {
 	var excelInfo request.ExcelIpInfo
 	_ = c.ShouldBindJSON(&excelInfo)
@@ -141,7 +143,7 @@ func (s *ApiIpLog) GameIpExport(c *gin.Context) {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	list, _, err := ServiceIpLog.GetGameIpList(paramsInfo.IpLogRequest, paramsInfo.PageInfo, paramsInfo.OrderKey, paramsInfo.Desc)
+	list, _, err := ServiceIpLog.GetGameIpList(paramsInfo.GameIpRequest, paramsInfo.PageInfo, paramsInfo.OrderKey, paramsInfo.Desc)
 	if err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Error(err))
 		response.FailWithMessage("获取失败 "+err.Error(), c)

+ 3 - 2
initialize/router.go

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

+ 32 - 0
model/card/id_card.go

@@ -0,0 +1,32 @@
+package card
+
+type IdCard struct {
+	IdName   string `json:"id_name"`
+	IdNumber string `json:"id_number"`
+	Flag     string `json:"flag"`
+}
+
+type UnionIdCard struct {
+	IdCard
+	Id       int `json:"id"`	//shuyou_id_card的主键
+	UseCount int `json:"use_count"` //使用次数
+	UsageId  int `json:"usage_id"`  //shuyou_id_card_usage表的主键
+}
+
+type IdCardUsage struct {
+	Id         int    `json:"id"`
+	IdIdCard   int    `json:"id_id_card" gorm:"column:id_idCard"` //主表id
+	IdNumber   string `json:"id_number"`                   //身份证号
+	Channel    string `json:"channel"`                     //渠道
+	UseCount   int    `json:"use_count"`                   //使用次数
+	CreateTime string `json:"create_time" gorm:"column:createTime"`                 // 创建时间
+	UpdateTime string `json:"update_time" gorm:"column:updateTime"`                 // 更新时间
+}
+
+func (IdCard) TableName() string {
+	return "shuyou_id_card"
+}
+
+func (IdCardUsage) TableName() string {
+	return "shuyou_id_card_usage"
+}

+ 7 - 0
model/card/request/id_card.go

@@ -0,0 +1,7 @@
+package request
+
+type IdCardRequest struct {
+	Channel string `json:"channel" form:"channel"`
+	Rows	int `json:"rows" form:"rows"`
+	Flag    string `json:"flag" form:"flag"`
+}

+ 50 - 32
model/log/log_ip.go

@@ -1,51 +1,69 @@
 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"` // 创建时间
+	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"` // 创建时间
+	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个数
+	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 GameIpRequest struct {
+	Id         uint     `json:"id"`
+	Ip         string   `json:"ip"` //模拟器ip
+	Date       []string `json:"date"`
+	User       string   `json:"user"`        //负责人
+	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 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"`			//完成任务总数
+	GameId                  int     `json:"game_id"`                    //游戏id
+	User                    string  `json:"user"`                       //负责人
+	TaskName                string  `json:"task_name"`                  //游戏名
+	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"`                 //完成任务总数
+	MaxCount                int     `json:"max_count"`                  //最多ip的数量
+	ExceedThree             int64   `json:"exceed_three"`               //超过3的ip数量
+	IpRepetitionRate        float64 `json:"ip_repetition_rate"`         //ip重复率
+	AverageIpRepetitionRate float64 `json:"average_ip_repetition_rate"` //平均重复率
 }
 
 type QueryIpList struct {
-	Ip     		string  `json:"ip"`	//模拟器ip
-	Count		int 	`json:"count"`
+	Ip    string `json:"ip"` //模拟器ip
+	Count int    `json:"count"`
 }
 
-
 func (IpLog) TableName() string {
 	return "ip_log"
-}
+}

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

@@ -8,3 +8,10 @@ type IpLogListRequest struct {
 	OrderKey string `json:"orderKey"` // 排序
 	Desc     bool   `json:"desc"`     // 排序方式:升序false(默认)|降序true
 }
+
+type GameIpRequest struct {
+	log.GameIpRequest
+	PageInfo
+	OrderKey string `json:"orderKey"` // 排序
+	Desc     bool   `json:"desc"`     // 排序方式:升序false(默认)|降序true
+}

+ 1 - 1
model/log/request/log_statistics.go

@@ -73,7 +73,7 @@ type ExcelInfo struct {
 type ExcelIpInfo struct {
 	FileName string `json:"fileName"` // 文件名
 	InfoList struct {
-		log.IpLogRequest
+		log.GameIpRequest
 		PageInfo
 		OrderKey string `json:"orderKey"` // 排序
 		Desc     bool   `json:"desc"`     // 排序方式:升序false(默认)|降序true

BIN
resource/excel/2023-03-24-ip.xlsx


+ 4 - 2
router/enter.go

@@ -1,6 +1,7 @@
 package router
 
 import (
+	"log-server/router/card"
 	"log-server/router/dataStatistics"
 	"log-server/router/example"
 	"log-server/router/fileManager"
@@ -18,11 +19,12 @@ type RouterGroup struct {
 	Computer       log.ComputerRouter
 	TypeManage     typeManage.RouterGroup
 	Task           task.GameTaskRouter
-	UploadFile	   task.UploadFileRouter
+	UploadFile     task.UploadFileRouter
 	RentComputer   rentComputer.RouterGroup
 	DataStatistics dataStatistics.RouterGroup
 	FileManager    fileManager.RouterGroup
-	IpLog 		   log.IpLogRouter
+	IpLog          log.IpLogRouter
+	IdCard         card.IdCardRouter
 }
 
 var RouterGroupApp = new(RouterGroup)

+ 7 - 0
service/card/enter.go

@@ -0,0 +1,7 @@
+package card
+type ServiceGroup 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.
+	IdCardService
+}

+ 121 - 0
service/card/id_card.go

@@ -0,0 +1,121 @@
+package card
+
+import (
+	"fmt"
+	"log-server/global"
+	"log-server/model/card"
+	cardReq "log-server/model/card/request"
+	"math/rand"
+	"time"
+)
+
+type IdCardService struct {
+}
+
+//查找身份证信息
+func (s *IdCardService) GetIdCard(idCard cardReq.IdCardRequest) (list []card.IdCard, err error) {
+	var unionIdCardList []card.UnionIdCard
+	var idCardList = make([]card.IdCard, idCard.Rows)
+	var total int64
+	//查找此渠道和此id_idCard记录是否存在, 1是创建,2是更新
+	var status int
+	//取一个0-1000的随机数作为偏移值
+	//将时间戳设置成种子数
+	rand.Seed(time.Now().UnixNano())
+	//生成10个0-99之间的随机数
+	randomOffset := rand.Intn(1000)
+	limit := idCard.Rows
+	//联合查询符合条件的身份证信息
+	//查找channel != channel 的表单信息
+	db := global.GVA_DB.Table("(select * from shuyou_id_card where id not in (select id_idCard from `shuyou_id_card_usage` where channel = ?) and flag = ?) as a", idCard.Channel, idCard.Flag)
+	db = db.Select("a.id, id_name, a.id_number, flag, IFNULL(use_count, 0) as use_count, b.id as usage_id, channel")
+	db = db.Joins("left JOIN shuyou_id_card_usage as b on b.id_idCard = a.id")
+	db.Count(&total)
+	db = db.Order("use_count").Limit(limit).Offset(randomOffset)
+	err = db.Find(&unionIdCardList).Error
+	if err != nil {
+		return nil, err
+	}
+	fmt.Println(unionIdCardList)
+	//没有非这个渠道的记录
+	if total == 0 {
+		dbFail := global.GVA_DB.Table("shuyou_id_card as a")
+		dbFail = dbFail.Select("a.id, id_name, a.id_number, flag, IFNULL(use_count, 0) as use_count, b.id as usage_id, channel")
+		dbFail = dbFail.Joins("left JOIN shuyou_id_card_usage as b on b.id_idCard = a.id")
+		dbFail = dbFail.Where("channel = ? and flag = ?", idCard.Channel, idCard.Flag)
+		dbFail = dbFail.Order("use_count").Limit(limit)
+		err = dbFail.Find(&unionIdCardList).Error
+		fmt.Println("---------没查到----------")
+		fmt.Println(unionIdCardList)
+		//1是创建,2是更新
+		status = 2
+	} else {
+		//1是创建,2是更新
+		status = 1
+	}
+	for i, unionInfo := range unionIdCardList {
+		//将idCard内容赋予idCardList
+		idCardList[i] = unionInfo.IdCard
+		if status == 1 {
+			err = s.CreateIdCardUsage(unionInfo, idCard.Channel)
+		} else if status == 2 {
+			err = s.UpdateIdCardUsage(unionInfo)
+		}
+		if err != nil {
+			return nil, err
+		}
+	}
+	return idCardList, err
+}
+
+//更改身份证使用表
+//func (s *IdCardService) ChangeIdCardUsage(unionInfo card.UnionIdCard, channel string) (err error){
+//	var usageEntity card.IdCardUsage
+//	if unionInfo.UseCount == 0 {
+//		usageEntity = card.IdCardUsage{
+//			IdIdCard: unionInfo.Id,
+//			IdNumber: unionInfo.IdNumber,
+//			Channel: channel,
+//			UseCount: 1,
+//		}
+//		err = global.GVA_DB.Model(&card.IdCardUsage{}).Create(&usageEntity).Error
+//	} else {
+//		usageEntity = card.IdCardUsage{
+//			UseCount: unionInfo.UseCount + 1,
+//		}
+//		err = global.GVA_DB.Model(&card.IdCardUsage{}).Updates(&usageEntity).Error
+//	}
+//	return err
+//}
+
+//添加身份证使用记录信息
+func (s *IdCardService) CreateIdCardUsage(unionInfo card.UnionIdCard, channel string) (err error) {
+	var usageEntity = card.IdCardUsage{
+		IdIdCard: unionInfo.Id,
+		IdNumber: unionInfo.IdNumber,
+		Channel:  channel,
+		UseCount: 1,
+	}
+	return global.GVA_DB.Model(&card.IdCardUsage{}).Omit("createTime", "updateTime").Create(&usageEntity).Error
+}
+
+//更新身份证使用记录信息
+func (s *IdCardService) UpdateIdCardUsage(unionInfo card.UnionIdCard) (err error) {
+	useCount := unionInfo.UseCount + 1
+	//更新记录
+	return global.GVA_DB.Model(&card.IdCardUsage{}).Where("id = ? ", unionInfo.UsageId).Update("use_count", useCount).Error
+}
+
+//判断是更新记录还是创建记录, 1是创建,2是更新
+//func(s *IdCardService)	judgeOperate(unionInfo card.UnionIdCard, channel string) (status int, err error){
+//	//查找此channel和此id_number账号是否存在
+//	var total int64
+//	err = global.GVA_DB.Model(&card.IdCardUsage{}).Where("channel = ? and id_idCard = ?", channel, unionInfo.Id).Count(&total).Error
+//	fmt.Println(total)
+//	if total == 0 {
+//		status = 1
+//	} else {
+//		status = 2
+//	}
+//	return status, err
+//}

+ 2 - 0
service/enter.go

@@ -1,6 +1,7 @@
 package service
 
 import (
+	"log-server/service/card"
 	"log-server/service/dataStatistics"
 	"log-server/service/example"
 	"log-server/service/fileManager"
@@ -20,6 +21,7 @@ type ServiceGroup struct {
 	RentComputerServiceGroup   rentComputer.ServiceGroup
 	DataStatisticsServiceGroup dataStatistics.ServiceGroup
 	FileManagerServiceGroup    fileManager.ServiceGroup
+	CardServiceGroup		   card.ServiceGroup
 }
 
 var ServiceGroupApp = new(ServiceGroup)

+ 36 - 4
service/log/log_ip.go

@@ -7,6 +7,7 @@ import (
 	"log-server/global"
 	"log-server/model/log"
 	"log-server/model/log/request"
+	"strconv"
 	"time"
 )
 
@@ -78,7 +79,7 @@ func (s *ServiceIpLog) GetIpLogList(api log.IpLogRequest, info request.PageInfo,
 }
 
 //根据gameId获取ip
-func (s *ServiceIpLog) GetGameIpList(api log.IpLogRequest, info request.PageInfo, order string, desc bool) (apiList []log.GameIpResponse, total int64, err error) {
+func (s *ServiceIpLog) GetGameIpList(api log.GameIpRequest, 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{})
@@ -89,19 +90,30 @@ func (s *ServiceIpLog) GetGameIpList(api log.IpLogRequest, info request.PageInfo
 		startDate = api.Date[0]
 		endDate = api.Date[1]
 	}
+
+	//筛选负责人
+	if api.User != "" {
+		db = db.Where("user = ?", api.User)
+	}
+
+	//筛选日期
 	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)
+		//查找总ip上报次数
 		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 {
+		//查找总ip上报次数
 		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.Where("ip_log.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.Select("ip_log.create_date,ip_log.game_id,late.count as count_total, task_name, user,  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")
-
+	//拼接game_task表获取任务名称和负责人名称
+	db = db.Joins("left join game_task as gt on gt.task_id = ip_log.game_id")
 	db = db.Group("ip_log.game_id, ip_log.create_date")
 	//db.Select("count(*)").Count(&countTotal)
 	//db.Select("count(distinct(ip))").Count(&countDistinctIp)
@@ -140,6 +152,14 @@ func (s *ServiceIpLog) GetGameIpList(api log.IpLogRequest, info request.PageInfo
 	//遍历更改日期格式
 	for i, _ := range apiList {
 		apiList[i].CreateDate = apiList[i].CreateDate[:10]
+		err = global.GVA_DB.Model(&log.IpLog{}).Select("COUNT(1) as max_count").Where("game_id = ? and create_date = ? and status = 2", apiList[i].GameId, apiList[i].CreateDate).Group("ip").Order("max_count desc").Limit(1).Find(&apiList[i]).Error
+		global.GVA_DB.Model(&log.IpLog{}).Select("id,ip,count(*) ").Where("game_id = ? and create_date = ? and status = 2", apiList[i].GameId, apiList[i].CreateDate).Group("ip").Having("count(*) > 4").Count(&apiList[i].ExceedThree)
+		//获取平均重复率和ip重复率 并保留小数点后两位
+		countDistinctIp := float64(apiList[i].CountDistinctIp)
+		successIp := float64(apiList[i].SuccessIp)
+		taskCount := float64(apiList[i].TaskCount)
+		apiList[i].IpRepetitionRate, _ =  strconv.ParseFloat(fmt.Sprintf("%.2f", (countDistinctIp/ successIp) *100), 64)
+		apiList[i].AverageIpRepetitionRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (countDistinctIp / taskCount) *100), 64)
 	}
 	return apiList, total, err
 }
@@ -168,19 +188,31 @@ func (s *ServiceIpLog) GameIpListExcel(infoList []log.GameIpResponse, filePath s
 	excel := excelize.NewFile()
 	excel.SetSheetRow("Sheet1", "A1", &[]string{
 		"游戏id",
+		"负责人",
+		"任务名称",
 		"上报ip次数",
 		"任务完成",
+		"最大ip数",
+		"异常ip个数",
 		"成功ip次数",
 		"ip个数",
+		"ip重复率",
+		"平均重复率",
 		"日期"})
 	for i, statisticsLog := range infoList {
 		axis := fmt.Sprintf("A%d", i+2)
 		excel.SetSheetRow("Sheet1", axis, &[]interface{}{
 			statisticsLog.GameId,
+			statisticsLog.User,
+			statisticsLog.TaskName,
 			statisticsLog.CountTotal,
 			statisticsLog.TaskCount,
+			statisticsLog.MaxCount,
+			statisticsLog.ExceedThree,
 			statisticsLog.SuccessIp,
 			statisticsLog.CountDistinctIp,
+			statisticsLog.IpRepetitionRate,
+			statisticsLog.AverageIpRepetitionRate,
 			statisticsLog.CreateDate[:10],
 		})
 	}