|
|
@@ -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(¶msInfo)
|
|
|
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)
|
|
|
+ }
|
|
|
}
|