Bläddra i källkod

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

# Conflicts:
#	initialize/router.go
倚楼听风雨 3 år sedan
förälder
incheckning
4fea851f9e

+ 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)

+ 2 - 2
api/v1/task/enter.go

@@ -4,10 +4,10 @@ import "log-server/service"
 
 type GroupTask struct {
 	GameTaskApi
-	UploadFileApi
+	TaskConfApi
 }
 
 var (
 	taskService = service.ServiceGroupApp.TaskServiceGroup.GameTask
-	uploadFileService = service.ServiceGroupApp.TaskServiceGroup.UploadFileService
+	taskConfService = service.ServiceGroupApp.TaskServiceGroup.TaskConfService
 )

+ 23 - 0
api/v1/task/game_task.go

@@ -67,6 +67,29 @@ func (s *GameTaskApi) GetGameTaskList(c *gin.Context) {
 	}
 }
 
+//获取启用状态的任务
+func (s *GameTaskApi) GetUsedGameTaskList(c *gin.Context) {
+	var paramsInfo request.GetGameTaskListRequest
+	_ = c.ShouldBindJSON(&paramsInfo)
+	if err := utils.Verify(paramsInfo.PageInfo, utils.PageInfoVerify); err != nil {
+		response.FailWithMessage(err.Error(), c)
+		return
+	}
+	if list, option, total, err := taskService.GetUsedGameTaskInfoList(paramsInfo.GameTask, paramsInfo.PageInfo, paramsInfo.OrderKey, paramsInfo.Desc); err != nil {
+		global.GVA_LOG.Error("获取失败!", zap.Error(err))
+		response.FailWithMessage("获取失败"+err.Error(), c)
+	} else {
+		response.OkWithDetailed(taskResponse.GameTaskPageResult{
+			List:       list,
+			OptionList: option,
+			Total:      total,
+			Page:       paramsInfo.Page,
+			PageSize:   paramsInfo.PageSize,
+		}, "获取成功", c)
+	}
+}
+
+
 // @Tags gameTask
 // @Summary 根据id获取游戏任务信息
 // @Security ApiKeyAuth

+ 29 - 9
api/v1/task/upload_file.go

@@ -12,11 +12,11 @@ import (
 	"strconv"
 )
 
-type UploadFileApi struct {
+type TaskConfApi struct {
 
 }
 
-func (b *UploadFileApi) UploadFile(c *gin.Context) {
+func (b *TaskConfApi) UploadFile(c *gin.Context) {
 
 	_, header, err := c.Request.FormFile("file")
 	if err != nil {
@@ -36,7 +36,7 @@ func (b *UploadFileApi) UploadFile(c *gin.Context) {
 	}
 	var fileRes taskRes.UploadFileResponse
 	taskId, _ := strconv.Atoi(taskID)
-	fileRes, err = uploadFileService.UploadFile(taskId, user,  header) // 文件上传后拿到文件路径
+	fileRes, err = taskConfService.UploadFile(taskId, user,  header) // 文件上传后拿到文件路径
 	if err != nil {
 		global.GVA_LOG.Error("修改数据库链接失败!", zap.Error(err))
 		response.FailWithMessage("修改数据库链接失败", c)
@@ -45,7 +45,7 @@ func (b *UploadFileApi) UploadFile(c *gin.Context) {
 	response.OkWithDetailed(taskRes.InfoResponse{fileRes}, "上传成功", c)
 }
 
-func (b *UploadFileApi) DownloadFile(c *gin.Context) {
+func (b *TaskConfApi) DownloadFile(c *gin.Context) {
 	taskIdStr := c.Query("taskId")
 	md5String := c.Query("md5String")
 	if taskIdStr == "" {
@@ -53,7 +53,7 @@ func (b *UploadFileApi) DownloadFile(c *gin.Context) {
 		return
 	}
 	taskId, _ := strconv.Atoi(taskIdStr)
-	downloadFile, err := uploadFileService.DownloadFile(taskId, md5String)
+	downloadFile, err := taskConfService.DownloadFile(taskId, md5String)
 	if err != nil {
 		global.GVA_LOG.Error("查询失败!", zap.Error(err))
 		response.FailWithMessage("查询失败,无对应脚本", c)
@@ -65,7 +65,7 @@ func (b *UploadFileApi) DownloadFile(c *gin.Context) {
 
 
 //获取所有游戏脚本列表
-func (b *UploadFileApi) GetScriptList(c *gin.Context)  {
+func (b *TaskConfApi) GetScriptList(c *gin.Context)  {
 	//获取前端传值并校验
 	var pageInfo task.SearchAccountTypeParams
 	_ = c.ShouldBindJSON(&pageInfo)
@@ -74,7 +74,7 @@ func (b *UploadFileApi) GetScriptList(c *gin.Context)  {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if list, total, err := uploadFileService.GetScriptList(pageInfo.GameScriptResponse, pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil{
+	if list, total, err := taskConfService.GetScriptList(pageInfo.GameScriptResponse, pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil{
 		global.GVA_LOG.Error("获取失败!", zap.Error(err))
 		response.FailWithMessage("获取失败", c)
 	} else {
@@ -88,7 +88,7 @@ func (b *UploadFileApi) GetScriptList(c *gin.Context)  {
 }
 
 //更改脚本状态
-func (b *UploadFileApi) StatusChange(c *gin.Context) {
+func (b *TaskConfApi) StatusChange(c *gin.Context) {
 	var paramsInfo request.UpdateScriptStatusRequest
 	_ = c.ShouldBindJSON(&paramsInfo)
 	if paramsInfo.State == 0 {
@@ -99,10 +99,30 @@ func (b *UploadFileApi) StatusChange(c *gin.Context) {
 		response.FailWithMessage("Id不能为空", c)
 		return
 	}
-	if err := uploadFileService.UpdateScriptStatus(paramsInfo); err != nil {
+	if err := taskConfService.UpdateScriptStatus(paramsInfo); err != nil {
 		global.GVA_LOG.Error("修改失败!", zap.Error(err))
 		response.FailWithMessage(err.Error(), c)
 	} else {
 		response.OkWithMessage("修改成功", c)
 	}
+}
+
+//编辑加付费提醒额度
+func (b *TaskConfApi) AddFeeNotice(c *gin.Context) {
+	var taskConf task.TaskConf
+	_ = c.ShouldBindJSON(&taskConf)
+	if taskConf.TaskId == 0 {
+		response.FailWithMessage("Id不能为空", c)
+		return
+	}
+	if err := utils.Verify(taskConf, utils.TaskConfVerify); err != nil {
+		response.FailWithMessage(err.Error(), c)
+		return
+	}
+	if err := taskConfService.JudgeOperate(taskConf); err != nil {
+		global.GVA_LOG.Error("编辑失败!", zap.Error(err))
+		response.FailWithMessage(err.Error(), c)
+	} else {
+		response.OkWithMessage("编辑成功", c)
+	}
 }

+ 2 - 1
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
@@ -67,7 +68,7 @@ func Routers() *gin.Engine {
 		typeManageRouter.InitResponsiblePersonRouter(PublicGroup) //负责人路由
 		typeManageRouter.InitAccountTypeRouter(PublicGroup)       //账号类型路由
 		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

+ 34 - 0
model/task/game_task.go

@@ -34,6 +34,40 @@ type GameTask struct {
 	StopTime        time.Time `json:"stop_time"`
 }
 
+//添加加付费提醒字段
+type GameTaskUnion struct {
+	Id              uint      `json:"id"`
+	TaskId          int       `json:"task_id"`
+	TaskName        string    `json:"task_name"`
+	User            string    `json:"user"`
+	AddFeeNotice    int       `json:"add_fee_notice"`
+	NewRetained     string    `json:"new_retained"`
+	GameName        string    `json:"game_name"`
+	GameId          int       `json:"game_id"`
+	Date            time.Time `json:"date"`
+	GamePortId      int       `json:"game_port_id"`
+	AccountType     int       `json:"account_type"`
+	LoginMethod     int       `json:"login_method"`
+	TxChannel       string    `json:"tx_channel"`
+	TxGameId        string    `json:"tx_game_id"`
+	MzChannel       string    `json:"mz_channel"`
+	MzGameId        string    `json:"mz_game_id"`
+	GameIdXmy       string    `json:"game_id_xmy"`
+	NewTarget       int       `json:"new_target"`
+	NewTargetH      int       `json:"new_target_h"`
+	PayTarget       int       `json:"pay_target"`
+	RetainedTarget  int       `json:"retained_target"`
+	RetainedTargetH int       `json:"retained_target_h"`
+	PayPrice        int       `json:"pay_price"`
+	ControlTaskId   int       `json:"control_task_id"`
+	CreateTime      time.Time `json:"create_time"` // 创建时间
+	UpdateTime      time.Time `json:"update_time"` // 更新时间
+	Status          int       `json:"status"`      // 状态-1关闭,1开启
+	IsDel           int       `json:"is_del"`      // 是否删除-1删除,1正常
+	DeleteTime      time.Time `json:"delete_time"`
+	StopTime        time.Time `json:"stop_time"`
+}
+
 func (GameTask) TableName() string {
 	return "game_task"
 }

+ 6 - 0
model/task/request/game_task.go

@@ -77,6 +77,8 @@ type GameTargetCompleteRequest struct {
 	IsComplete       int      `json:"is_complete"`
 	Date             []string `json:"date"`
 	GamePortId       int      `json:"game_port_id"`
+	Aupr             int      `json:"aupr"`
+	TotalAmount      float64      `json:"total_amount"`
 }
 
 type GetGameTaskTargetByIdRequest struct {
@@ -99,6 +101,10 @@ type UpdateGameTaskTargetRequest struct {
 	FreeMethod           int        `json:"free_method"`
 	IsUploadWt           int        `json:"is_upload_wt"`
 	IsUploadXjf          int        `json:"is_upload_xjf"`
+
+	//添加字段
+	Aupr        int `json:"aupr"`
+	TotalAmount float64 `json:"total_amount"`
 }
 
 type CardInfo struct {

+ 25 - 0
model/task/response/game_task.go

@@ -23,6 +23,29 @@ type GetGameTaskListReply struct {
 	StopTime        string `json:"stop_time"`
 }
 
+//增加加付费提醒字段
+type GetGameTaskListUnionReply struct {
+	TaskId          int    `json:"task_id"`
+	TaskName        string `json:"task_name"`
+	User            string `json:"user"`
+	GameName        string `json:"game_name"`
+	Date            string `json:"date"`
+	AddFeeNotice    int    `json:"add_fee_notice"`
+	GamePort        string `json:"game_port"`
+	AccountType     string `json:"account_type"`
+	LoginMethod     string `json:"login_method"`
+	NewTarget       int    `json:"new_target"`
+	PayTarget       int    `json:"pay_target"`
+	NewTargetH      int    `json:"new_target_h"`
+	RetainedTarget  int    `json:"retained_target"`
+	RetainedTargetH int    `json:"retained_target_h"`
+	PayPrice        int    `json:"pay_price"`
+	Status          int    `json:"status"`      // 状态-1关闭,1开启
+	CreateTime      string `json:"create_time"` // 创建时间
+	UpdateTime      string `json:"update_time"` // 更新时间
+	StopTime        string `json:"stop_time"`
+}
+
 type GetGameTargetComplete struct {
 	Id                   uint   `json:"id"`
 	TaskId               int    `json:"task_id"`
@@ -45,6 +68,8 @@ type GetGameTargetComplete struct {
 	HandPayComplete      int    `json:"hand_pay_complete"`
 	HandAmountTotal      int    `json:"hand_amount_total"`
 	GameIdXmy            string `json:"game_id_xmy"`
+	Aupr                 int    `json:"aupr"`
+	TotalAmount          float64    `json:"total_amount"`
 }
 
 type GameTargetStatistics struct {

+ 12 - 0
model/task/task_conf.go

@@ -0,0 +1,12 @@
+package task
+
+type TaskConf struct {
+	Id           int    `json:"id"`
+	TaskId       int    `json:"task_id"`
+	User         string `json:"user"`
+	AddFeeNotice int    `json:"add_fee_notice"`
+}
+
+func (TaskConf) TableName() string {
+	return "task_conf"
+}

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)

+ 2 - 0
router/task/game_task.go

@@ -14,6 +14,7 @@ func (e *GameTaskRouter) InitGameTaskRouter(Router *gin.RouterGroup) {
 	GameTaskApi := v1.ApiGroupApp.GroupTask.GameTaskApi
 	{
 		GameTaskRouter.POST("getGameTaskList", GameTaskApi.GetGameTaskList)
+		GameTaskRouter.POST("getUsedGameTaskList", GameTaskApi.GetUsedGameTaskList)		//获取启用状态的任务
 		GameTaskRouter.POST("getGameTaskById", GameTaskApi.GetGameTaskById)
 		GameTaskRouter.POST("getGameTaskTargetList", GameTaskApi.GetGameTaskTargetList)
 		GameTaskRouter.POST("getGameTaskTargetById", GameTaskApi.GetGameTaskTargetById)
@@ -25,6 +26,7 @@ func (e *GameTaskRouter) InitGameTaskRouter(Router *gin.RouterGroup) {
 		GameTaskRouter.POST("getGameTxTaskList", GameTaskApi.GetGameTxTaskList)
 		GameTaskRouter.POST("getFeeAccountList", GameTaskApi.GetFeeAccountList)
 		GameTaskRouter.POST("taskTargetExport", GameTaskApi.TaskTargetExport)
+
 	}
 	GameTaskRouter1 := Router.Group("gameTask").Use(middleware.OperationRecord())
 	{

+ 23 - 0
router/task/task_conf.go

@@ -0,0 +1,23 @@
+package task
+
+import (
+	"github.com/gin-gonic/gin"
+	v1 "log-server/api/v1"
+)
+
+type UploadFileRouter struct {
+
+}
+
+func (e *UploadFileRouter) InitUploadFileRouter(Router *gin.RouterGroup) {
+	GameTaskRouter := Router.Group("gameTask")
+	TaskConfApi := v1.ApiGroupApp.GroupTask.TaskConfApi
+	{
+		GameTaskRouter.POST("addFileUpdate", TaskConfApi.UploadFile)
+		GameTaskRouter.GET("downloadFile", TaskConfApi.DownloadFile)
+		GameTaskRouter.POST("getScriptList", TaskConfApi.GetScriptList)
+		GameTaskRouter.POST("statusChange", TaskConfApi.StatusChange)
+		GameTaskRouter.POST("addFeeNotice", TaskConfApi.AddFeeNotice)
+
+	}
+}

+ 0 - 22
router/task/upload_file.go

@@ -1,22 +0,0 @@
-package task
-
-import (
-	"github.com/gin-gonic/gin"
-	v1 "log-server/api/v1"
-)
-
-type UploadFileRouter struct {
-
-}
-
-func (e *UploadFileRouter) InitUploadFileRouter(Router *gin.RouterGroup) {
-	GameTaskRouter := Router.Group("gameTask")
-	UploadFileApi := v1.ApiGroupApp.GroupTask.UploadFileApi
-	{
-		GameTaskRouter.POST("addFileUpdate", UploadFileApi.UploadFile)
-		GameTaskRouter.GET("downloadFile", UploadFileApi.DownloadFile)
-		GameTaskRouter.POST("getScriptList", UploadFileApi.GetScriptList)
-		GameTaskRouter.POST("statusChange", UploadFileApi.StatusChange)
-
-	}
-}

+ 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],
 		})
 	}

+ 1 - 1
service/task/enter.go

@@ -2,5 +2,5 @@ package task
 
 type ServiceGroup struct {
 	GameTask
-	UploadFileService
+	TaskConfService
 }

+ 103 - 3
service/task/game_task.go

@@ -318,6 +318,104 @@ func (apiService *GameTask) GetGameTaskInfoList(api task.GameTask, info request.
 	return apisReply, option, total, err
 }
 
+//获取启用状态的任务
+func (apiService *GameTask) GetUsedGameTaskInfoList(api task.GameTask, info request.PageInfo, order string, desc bool) (list interface{}, options interface{}, total int64, err error) {
+	limit := info.PageSize
+	offset := info.PageSize * (info.Page - 1)
+	db := global.GVA_DB.Model(&task.GameTask{})
+	var apiList []task.GameTaskUnion
+	db = db.Select("game_task.*, task_conf.add_fee_notice")
+	db = db.Joins("left join task_conf on task_conf.task_id = game_task.task_id")
+	db = db.Where("is_del = ?", -1)
+	if api.TaskName != "" {
+		db = db.Where("task_name LIKE ?", "%"+api.TaskName+"%")
+	}
+
+	if api.User != "" {
+		db = db.Where("game_task.user LIKE ?", "%"+api.User+"%")
+	}
+
+	if api.Status != 0 {
+		db = db.Where("status = ?", api.Status)
+	}
+
+	if api.TaskId != 0 {
+		db = db.Where("task_id = ?", api.TaskId)
+	}
+
+	//获取启用状态的任务
+	db = db.Where("status = 1")
+	err = db.Count(&total).Error
+
+	//查找厂商名称,登录类型名称、账号类型名称
+	option := task.Option{}
+	global.GVA_DB.Table("game_channel").Select("id", "channel_name").Find(&option.GamePortOptions)
+	global.GVA_DB.Table("login_type").Select("id", "login_name").Find(&option.LoginTypeOptions)
+	global.GVA_DB.Table("account_type").Select("id", "type_name").Find(&option.AccountTypeOptions)
+	global.GVA_DB.Table("game_list").Select("id", "game_name").Find(&option.GameListOptions)
+	//fmt.Println(option)
+
+	if err != nil {
+		return apiList, option, total, err
+	} else {
+		db = db.Limit(limit).Offset(offset)
+		if order != "" {
+			var OrderStr string
+			// 设置有效排序key 防止sql注入
+			// 感谢 Tom4t0 提交漏洞信息
+			orderMap := make(map[string]bool, 4)
+			orderMap["id"] = true
+			orderMap["task_name"] = true
+			orderMap["user"] = true
+			if orderMap[order] {
+				if desc {
+					OrderStr = order + " desc"
+				} else {
+					OrderStr = order
+				}
+			} else { // didn't matched any order key in `orderMap`
+				err = fmt.Errorf("非法的排序字段: %v", order)
+				return apiList, option, total, err
+			}
+
+			err = db.Order(OrderStr).Find(&apiList).Error
+		} else {
+			err = db.Order("id desc").Find(&apiList).Error
+		}
+	}
+	var apisReply []*response.GetGameTaskListUnionReply
+	if len(apiList) != 0 {
+		for _, apiInfo := range apiList {
+			var apiReply = new(response.GetGameTaskListUnionReply)
+			apiReply.Status = apiInfo.Status
+			apiReply.TaskId = apiInfo.TaskId
+			apiReply.TaskName = apiInfo.TaskName
+			apiReply.AddFeeNotice = apiInfo.AddFeeNotice
+			apiReply.GamePort = GamePort[apiInfo.GamePortId]
+			apiReply.AccountType = AccountType[apiInfo.AccountType]
+			apiReply.LoginMethod = LoginMethod[apiInfo.LoginMethod]
+			apiReply.CreateTime = apiInfo.CreateTime.Format("2006-01-02 15:04:05")
+			apiReply.User = apiInfo.User
+			apiReply.Date = apiInfo.Date.Format("2006-01-02")
+			apiReply.GameName = apiInfo.GameName
+			apiReply.UpdateTime = apiInfo.UpdateTime.Format("2006-01-02 15:04:05")
+			apiReply.NewTarget = apiInfo.NewTarget
+			apiReply.PayTarget = apiInfo.PayTarget
+			apiReply.RetainedTarget = apiInfo.RetainedTarget
+			apiReply.PayPrice = apiInfo.PayPrice
+			apiReply.RetainedTargetH = apiInfo.RetainedTargetH
+			apiReply.NewTargetH = apiInfo.NewTargetH
+			apiReply.StopTime = apiInfo.StopTime.Format("2006-01-02 15:04:05")
+			if apiInfo.Status == 1 {
+				apiReply.StopTime = ""
+			}
+			apisReply = append(apisReply, apiReply)
+		}
+
+	}
+	return apisReply, option, total, err
+}
+
 //@author: [piexlmax](https://github.com/piexlmax)
 //@function: GetGameTaskById
 //@description: 根据id获取GameTask
@@ -523,7 +621,7 @@ func (apiService *GameTask) GetGameTaskTargetInfoList(api request.GameTargetComp
 	db := global.GVA_DB.Table("game_target_complete gtc")
 	db = db.Select("gtc.id,gtc.task_id,gt.task_name,gt.game_id_xmy,gtc.new_target,gt.login_method,gt.user,gtc.pay_target,gtc.retained_target," +
 		"gtc.new_complete,gtc.pay_complete,gtc.retained_complete,gtc.create_date,gtc.amount,gtc.game_rate,gtc.is_complete,gtc.hand_new_complete," +
-		"gtc.hand_retained_complete,gtc.hand_pay_complete,gtc.hand_amount_total")
+		"gtc.hand_retained_complete,gtc.hand_pay_complete,gtc.hand_amount_total, gtc.aupr, gtc.total_amount")
 	db = db.Joins("left join game_task gt on gt.task_id = gtc.task_id")
 	//db = db.Where("gtc.create_date = ?", api.CreateDate)
 	db = db.Where("create_date >= ? and create_date <= ?", startDate, endDate)
@@ -652,7 +750,7 @@ func (s *GameTask) QQCardUsedLogUploadXjf(gameId int, account string, money int)
 func (c *GameTask) GetGameTaskTargetById(id int, date string) (api response.GetGameTargetComplete, err error) {
 	db := global.GVA_DB.Table("game_target_complete gtc")
 	db = db.Select("gtc.task_id,gt.task_name,gtc.new_target,gt.login_method,gt.user,gtc.pay_target,gtc.retained_target," +
-		"gtc.new_complete,gtc.pay_complete,gtc.retained_complete,gtc.create_date,gtc.amount,gtc.game_rate,gtc.is_complete")
+		"gtc.new_complete,gtc.pay_complete,gtc.retained_complete,gtc.create_date,gtc.amount,gtc.game_rate,gtc.is_complete, gtc.aupr, gtc.total_amount")
 	db = db.Joins("left join game_task gt on gt.task_id = gtc.task_id")
 	db = db.Where("gtc.task_id = ?", id)
 	db = db.Where("gtc.create_date = ?", date)
@@ -683,6 +781,8 @@ func (s *GameTask) UpdateGameTaskTarget(requestData request.UpdateGameTaskTarget
 		"hand_retained_complete": requestData.HandRetainedComplete + gameTask.HandRetainedComplete,
 		"hand_pay_complete":      requestData.HandPayComplete + gameTask.HandPayComplete,
 		"hand_amount_total":      requestData.HandAmountTotal + gameTask.HandAmountTotal,
+		"aupr":                   requestData.Aupr,
+		"total_amount":           requestData.TotalAmount,
 	}
 	date := time.Now().Format("2006-01-02")
 	err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
@@ -782,7 +882,7 @@ func (s *GameTask) UpdateGameTaskTarget(requestData request.UpdateGameTaskTarget
 			msg += "**" + taskData.User + "**"
 			msg += "\n"
 			msg += taskData.TaskName + ", 付费目标改为" + strconv.Itoa(requestData.PayTarget)
-			url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5ccfb180-c062-48b5-ae18-0c96f7c19f0b"
+			url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5ccfb180-c062-48b5-ae18-0c96f7c19f0b111"
 			var sendData SendMsg
 			sendData.MsgType = "markdown"
 			sendData.Markdown.Content = msg

+ 21 - 8
service/task/upload_file.go

@@ -26,16 +26,16 @@ import (
 	"time"
 )
 
-type UploadFileService struct {
+type TaskConfService struct {
 
 }
 
-func (e *UploadFileService) Upload(file response.UploadFileResponse) error {
+func (e *TaskConfService) Upload(file response.UploadFileResponse) error {
 	return global.GVA_DB.Table("upload_file").Create(&file).Error
 }
 
 //更改的上传文件函数
-func (e *UploadFileService) UploadFileFunc(file *multipart.FileHeader, taskId string) (string, string, string, error) {
+func (e *TaskConfService) UploadFileFunc(file *multipart.FileHeader, taskId string) (string, string, string, error) {
 	// 读取文件后缀
 	ext := path.Ext(file.Filename)
 	// 读取文件名并加密
@@ -90,7 +90,7 @@ func (e *UploadFileService) UploadFileFunc(file *multipart.FileHeader, taskId st
 	return key, filename, md5String, nil
 }
 
-func (e *UploadFileService) UploadFileToQiNiu(fileName string, taskId string, file *multipart.FileHeader) ( error) {
+func (e *TaskConfService) UploadFileToQiNiu(fileName string, taskId string, file *multipart.FileHeader) ( error) {
 	accessKey := "B81Gsvry2StqKVE3txS-7v9GBBfqykC9zhebmxnW"
 	secretKey := "YEZJuYcdeF7vRvzffxpopAVR-jMPZg9pZ-4IKTVW"
 	mac := qbox.NewMac(accessKey, secretKey)
@@ -141,7 +141,7 @@ func (e *UploadFileService) UploadFileToQiNiu(fileName string, taskId string, fi
 }
 
 //上传文件
-func (e *UploadFileService) UploadFile(taskId int, user string, header *multipart.FileHeader) (file response.UploadFileResponse, err error) {
+func (e *TaskConfService) UploadFile(taskId int, user string, header *multipart.FileHeader) (file response.UploadFileResponse, err error) {
 	//查询数据库记录数
 	var count int64
 	//获取最后一条记录
@@ -184,7 +184,7 @@ func (e *UploadFileService) UploadFile(taskId int, user string, header *multipar
 }
 
 //下载文件
-func (e *UploadFileService) DownloadFile(taskId int, md5String string) (info response.DownloadFile, err error) {
+func (e *TaskConfService) DownloadFile(taskId int, md5String string) (info response.DownloadFile, err error) {
 	var file response.UploadFileResponse
 	//改由存储至数据库的时候拼接前缀
 	//var prefix string = global.GVA_CONFIG.PrefixUrl.PrefixLocal
@@ -219,7 +219,7 @@ func (e *UploadFileService) DownloadFile(taskId int, md5String string) (info res
 }
 
 //条件查询脚本列表
-func (e *UploadFileService) GetScriptList(script task.GameScriptResponse, info request.PageInfo, order string, desc bool) (list interface{}, total int64, err error) {
+func (e *TaskConfService) GetScriptList(script task.GameScriptResponse, info request.PageInfo, order string, desc bool) (list interface{}, total int64, err error) {
 	//获取分页数据
 	limit := info.PageSize
 	offset := (info.Page - 1) * info.PageSize
@@ -271,11 +271,24 @@ func (e *UploadFileService) GetScriptList(script task.GameScriptResponse, info r
 }
 
 //更改脚本状态
-func (e *UploadFileService) UpdateScriptStatus(c taskReq.UpdateScriptStatusRequest) (err error) {
+func (e *TaskConfService) UpdateScriptStatus(c taskReq.UpdateScriptStatusRequest) (err error) {
 	err = global.GVA_DB.Table("upload_file").Where("id = ?", c.Id).Error
 	if errors.Is(err, gorm.ErrRecordNotFound) {
 		return errors.New("请传入正确的Id")
 	}
 	err = global.GVA_DB.Table("upload_file").Where("id = ?", c.Id).Update("state", c.State).Error
 	return err
+}
+
+//更改推送标准
+func (e *TaskConfService) JudgeOperate(taskConf task.TaskConf) (err error) {
+	//查找数据库中是否有这条记录
+	var entity task.TaskConf
+	err = global.GVA_DB.Model(&task.TaskConf{}).Where("task_id = ?", taskConf.TaskId).First(&entity).Error
+	//如果没有,创建
+	if errors.Is(err, gorm.ErrRecordNotFound) {
+		return global.GVA_DB.Model(&task.TaskConf{}).Create(&taskConf).Error
+	}
+	//如果有,更新
+	return global.GVA_DB.Model(&task.TaskConf{}).Where("task_id = ?", taskConf.TaskId).Omit("task_id", "user").Updates(&taskConf).Error
 }

+ 1 - 0
utils/verify.go

@@ -29,4 +29,5 @@ var (
 	GameTaskVerify          = Rules{"TaskId": {NotEmpty()}, "TaskName": {NotEmpty()}, "User": {NotEmpty()}, "NewRetained": {NotEmpty()}, "GamePortId": {NotEmpty()}}
 	TaskIdVerify            = Rules{"TaskId": {NotEmpty()}}
 	UpdateTargetVerify      = Rules{"TaskId": {NotEmpty()}, "CreateDate": {NotEmpty()}}
+	TaskConfVerify          = Rules{"User": {NotEmpty()}}
 )