Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	service/task/game_task.go
wangbin лет назад: 3
Родитель
Сommit
30dc5bd547

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

@@ -4,10 +4,10 @@ import "log-server/service"
 
 
 type GroupTask struct {
 type GroupTask struct {
 	GameTaskApi
 	GameTaskApi
-	UploadFileApi
+	TaskConfApi
 }
 }
 
 
 var (
 var (
 	taskService = service.ServiceGroupApp.TaskServiceGroup.GameTask
 	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
 // @Tags gameTask
 // @Summary 根据id获取游戏任务信息
 // @Summary 根据id获取游戏任务信息
 // @Security ApiKeyAuth
 // @Security ApiKeyAuth

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

@@ -12,11 +12,11 @@ import (
 	"strconv"
 	"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")
 	_, header, err := c.Request.FormFile("file")
 	if err != nil {
 	if err != nil {
@@ -36,7 +36,7 @@ func (b *UploadFileApi) UploadFile(c *gin.Context) {
 	}
 	}
 	var fileRes taskRes.UploadFileResponse
 	var fileRes taskRes.UploadFileResponse
 	taskId, _ := strconv.Atoi(taskID)
 	taskId, _ := strconv.Atoi(taskID)
-	fileRes, err = uploadFileService.UploadFile(taskId, user,  header) // 文件上传后拿到文件路径
+	fileRes, err = taskConfService.UploadFile(taskId, user,  header) // 文件上传后拿到文件路径
 	if err != nil {
 	if err != nil {
 		global.GVA_LOG.Error("修改数据库链接失败!", zap.Error(err))
 		global.GVA_LOG.Error("修改数据库链接失败!", zap.Error(err))
 		response.FailWithMessage("修改数据库链接失败", c)
 		response.FailWithMessage("修改数据库链接失败", c)
@@ -45,7 +45,7 @@ func (b *UploadFileApi) UploadFile(c *gin.Context) {
 	response.OkWithDetailed(taskRes.InfoResponse{fileRes}, "上传成功", c)
 	response.OkWithDetailed(taskRes.InfoResponse{fileRes}, "上传成功", c)
 }
 }
 
 
-func (b *UploadFileApi) DownloadFile(c *gin.Context) {
+func (b *TaskConfApi) DownloadFile(c *gin.Context) {
 	taskIdStr := c.Query("taskId")
 	taskIdStr := c.Query("taskId")
 	md5String := c.Query("md5String")
 	md5String := c.Query("md5String")
 	if taskIdStr == "" {
 	if taskIdStr == "" {
@@ -53,7 +53,7 @@ func (b *UploadFileApi) DownloadFile(c *gin.Context) {
 		return
 		return
 	}
 	}
 	taskId, _ := strconv.Atoi(taskIdStr)
 	taskId, _ := strconv.Atoi(taskIdStr)
-	downloadFile, err := uploadFileService.DownloadFile(taskId, md5String)
+	downloadFile, err := taskConfService.DownloadFile(taskId, md5String)
 	if err != nil {
 	if err != nil {
 		global.GVA_LOG.Error("查询失败!", zap.Error(err))
 		global.GVA_LOG.Error("查询失败!", zap.Error(err))
 		response.FailWithMessage("查询失败,无对应脚本", c)
 		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
 	var pageInfo task.SearchAccountTypeParams
 	_ = c.ShouldBindJSON(&pageInfo)
 	_ = c.ShouldBindJSON(&pageInfo)
@@ -74,7 +74,7 @@ func (b *UploadFileApi) GetScriptList(c *gin.Context)  {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		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))
 		global.GVA_LOG.Error("获取失败!", zap.Error(err))
 		response.FailWithMessage("获取失败", c)
 		response.FailWithMessage("获取失败", c)
 	} else {
 	} 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
 	var paramsInfo request.UpdateScriptStatusRequest
 	_ = c.ShouldBindJSON(&paramsInfo)
 	_ = c.ShouldBindJSON(&paramsInfo)
 	if paramsInfo.State == 0 {
 	if paramsInfo.State == 0 {
@@ -99,10 +99,30 @@ func (b *UploadFileApi) StatusChange(c *gin.Context) {
 		response.FailWithMessage("Id不能为空", c)
 		response.FailWithMessage("Id不能为空", c)
 		return
 		return
 	}
 	}
-	if err := uploadFileService.UpdateScriptStatus(paramsInfo); err != nil {
+	if err := taskConfService.UpdateScriptStatus(paramsInfo); err != nil {
 		global.GVA_LOG.Error("修改失败!", zap.Error(err))
 		global.GVA_LOG.Error("修改失败!", zap.Error(err))
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 	} else {
 	} else {
 		response.OkWithMessage("修改成功", c)
 		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)
+	}
 }
 }

+ 34 - 0
model/task/game_task.go

@@ -34,6 +34,40 @@ type GameTask struct {
 	StopTime        time.Time `json:"stop_time"`
 	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 {
 func (GameTask) TableName() string {
 	return "game_task"
 	return "game_task"
 }
 }

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

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

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

@@ -23,6 +23,29 @@ type GetGameTaskListReply struct {
 	StopTime        string `json:"stop_time"`
 	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 {
 type GetGameTargetComplete struct {
 	Id                   uint   `json:"id"`
 	Id                   uint   `json:"id"`
 	TaskId               int    `json:"task_id"`
 	TaskId               int    `json:"task_id"`
@@ -45,6 +68,8 @@ type GetGameTargetComplete struct {
 	HandPayComplete      int    `json:"hand_pay_complete"`
 	HandPayComplete      int    `json:"hand_pay_complete"`
 	HandAmountTotal      int    `json:"hand_amount_total"`
 	HandAmountTotal      int    `json:"hand_amount_total"`
 	GameIdXmy            string `json:"game_id_xmy"`
 	GameIdXmy            string `json:"game_id_xmy"`
+	Aupr                 int    `json:"aupr"`
+	TotalAmount          float64    `json:"total_amount"`
 }
 }
 
 
 type GameTargetStatistics struct {
 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


+ 2 - 0
router/task/game_task.go

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

+ 1 - 1
service/task/enter.go

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

+ 99 - 2
service/task/game_task.go

@@ -318,6 +318,104 @@ func (apiService *GameTask) GetGameTaskInfoList(api task.GameTask, info request.
 	return apisReply, option, total, err
 	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)
 //@author: [piexlmax](https://github.com/piexlmax)
 //@function: GetGameTaskById
 //@function: GetGameTaskById
 //@description: 根据id获取GameTask
 //@description: 根据id获取GameTask
@@ -782,8 +880,7 @@ func (s *GameTask) UpdateGameTaskTarget(requestData request.UpdateGameTaskTarget
 			msg += "**" + taskData.User + "**"
 			msg += "**" + taskData.User + "**"
 			msg += "\n"
 			msg += "\n"
 			msg += taskData.TaskName + ", 付费目标改为" + strconv.Itoa(requestData.PayTarget)
 			msg += taskData.TaskName + ", 付费目标改为" + strconv.Itoa(requestData.PayTarget)
-			//url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5ccfb180-c062-48b5-ae18-0c96f7c19f0b"
-			url := global.GVA_CONFIG.SendUrl.SendUrlOne
+			url := "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5ccfb180-c062-48b5-ae18-0c96f7c19f0b"
 			var sendData SendMsg
 			var sendData SendMsg
 			sendData.MsgType = "markdown"
 			sendData.MsgType = "markdown"
 			sendData.Markdown.Content = msg
 			sendData.Markdown.Content = msg

+ 21 - 8
service/task/upload_file.go

@@ -26,16 +26,16 @@ import (
 	"time"
 	"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
 	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)
 	ext := path.Ext(file.Filename)
 	// 读取文件名并加密
 	// 读取文件名并加密
@@ -90,7 +90,7 @@ func (e *UploadFileService) UploadFileFunc(file *multipart.FileHeader, taskId st
 	return key, filename, md5String, nil
 	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"
 	accessKey := "B81Gsvry2StqKVE3txS-7v9GBBfqykC9zhebmxnW"
 	secretKey := "YEZJuYcdeF7vRvzffxpopAVR-jMPZg9pZ-4IKTVW"
 	secretKey := "YEZJuYcdeF7vRvzffxpopAVR-jMPZg9pZ-4IKTVW"
 	mac := qbox.NewMac(accessKey, secretKey)
 	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
 	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 file response.UploadFileResponse
 	//改由存储至数据库的时候拼接前缀
 	//改由存储至数据库的时候拼接前缀
 	//var prefix string = global.GVA_CONFIG.PrefixUrl.PrefixLocal
 	//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
 	limit := info.PageSize
 	offset := (info.Page - 1) * 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
 	err = global.GVA_DB.Table("upload_file").Where("id = ?", c.Id).Error
 	if errors.Is(err, gorm.ErrRecordNotFound) {
 	if errors.Is(err, gorm.ErrRecordNotFound) {
 		return errors.New("请传入正确的Id")
 		return errors.New("请传入正确的Id")
 	}
 	}
 	err = global.GVA_DB.Table("upload_file").Where("id = ?", c.Id).Update("state", c.State).Error
 	err = global.GVA_DB.Table("upload_file").Where("id = ?", c.Id).Update("state", c.State).Error
 	return err
 	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()}}
 	GameTaskVerify          = Rules{"TaskId": {NotEmpty()}, "TaskName": {NotEmpty()}, "User": {NotEmpty()}, "NewRetained": {NotEmpty()}, "GamePortId": {NotEmpty()}}
 	TaskIdVerify            = Rules{"TaskId": {NotEmpty()}}
 	TaskIdVerify            = Rules{"TaskId": {NotEmpty()}}
 	UpdateTargetVerify      = Rules{"TaskId": {NotEmpty()}, "CreateDate": {NotEmpty()}}
 	UpdateTargetVerify      = Rules{"TaskId": {NotEmpty()}, "CreateDate": {NotEmpty()}}
+	TaskConfVerify          = Rules{"User": {NotEmpty()}}
 )
 )