Explorar el Código

Merge remote-tracking branch 'origin/master'

wangbin hace 2 años
padre
commit
b10d433f14

+ 14 - 0
api/v1/fileManager/file_qiniu.go

@@ -109,3 +109,17 @@ func (v *ApiFileQiniu) UpdateMirrorPushPolicy(c *gin.Context) {
 		response.OkWithMessage("修改镜像更新策略成功", c)
 	}
 }
+
+// CheckIsExistMirror 查询所有游戏任务下是否有镜像
+func (v *ApiFileQiniu) CheckIsExistMirror(c *gin.Context) {
+
+	if list, err := ServiceFileQiniu.CheckIsExistMirror(); err != nil {
+		//global.GVA_LOG.Error("获取失败!", zap.Error(err))
+		response.FailWithMessage("获取失败", c)
+	} else {
+		//响应结果
+		response.OkWithDetailed(response.PageResult{
+			List: list,
+		}, "获取成功", c)
+	}
+}

+ 1 - 1
api/v1/task/task_conf.go

@@ -67,7 +67,7 @@ func (b *TaskConfApi) DownloadFile(c *gin.Context) {
 //获取所有游戏脚本列表
 func (b *TaskConfApi) GetScriptList(c *gin.Context)  {
 	//获取前端传值并校验
-	var pageInfo task.SearchAccountTypeParams
+	var pageInfo task.SearchGameScriptParams
 	_ = c.ShouldBindJSON(&pageInfo)
 	//页面信息校验
 	if err := utils.Verify(pageInfo.PageInfo, utils.PageInfoVerify); err != nil{

+ 10 - 10
initialize/timer.go

@@ -201,14 +201,14 @@ func Timer() {
 	//}
 
 	//一小时同步一次IP信息,播报是否有异常
-	_, err := global.GVA_Timer.AddTaskByFunc("SyncIPMessage", "0 0 * * * ? ", robotService.SyncIPMessage)
-	if err != nil {
-		fmt.Println("add SyncIPMessage timer error:", err)
-	}
-
-	//定时查看延迟更新的镜像是否到期
-	_, err = global.GVA_Timer.AddTaskByFunc("CheckPushTime", "35 0/2 * * * *", serviceFileQiniu.CheckPushTime)
-	if err != nil {
-		fmt.Println("add CheckPushTime timer error:", err)
-	}
+	//_, err := global.GVA_Timer.AddTaskByFunc("SyncIPMessage", "0 0 * * * ? ", robotService.SyncIPMessage)
+	//if err != nil {
+	//	fmt.Println("add SyncIPMessage timer error:", err)
+	//}
+	//
+	////定时查看延迟更新的镜像是否到期
+	//_, err = global.GVA_Timer.AddTaskByFunc("CheckPushTime", "35 0/2 * * * *", serviceFileQiniu.CheckPushTime)
+	//if err != nil {
+	//	fmt.Println("add CheckPushTime timer error:", err)
+	//}
 }

+ 2 - 1
model/task/game_task.go

@@ -34,13 +34,14 @@ 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"`
+	SimulatorType   int       `json:"simulator_type"`
 	NewRetained     string    `json:"new_retained"`
 	GameName        string    `json:"game_name"`
 	GameId          int       `json:"game_id"`

+ 4 - 3
model/task/response/game_task.go

@@ -25,7 +25,7 @@ type GetGameTaskListReply struct {
 	StopTime        string `json:"stop_time"`
 }
 
-//增加加付费提醒字段
+//增加加付费提醒字段和模拟器类型字段
 type GetGameTaskListUnionReply struct {
 	TaskId          int    `json:"task_id"`
 	TaskName        string `json:"task_name"`
@@ -33,6 +33,7 @@ type GetGameTaskListUnionReply struct {
 	GameName        string `json:"game_name"`
 	Date            string `json:"date"`
 	AddFeeNotice    int    `json:"add_fee_notice"`
+	SimulatorType   int    `json:"simulator_type"`
 	GamePort        string `json:"game_port"`
 	AccountType     string `json:"account_type"`
 	LoginMethod     string `json:"login_method"`
@@ -134,8 +135,8 @@ type XmyGameDataReply struct {
 
 //小绵羊数据列表
 type XmyGameList struct {
-	StartDay string          `json:"start_day"`
-	EndDay   string          `json:"end_day"`
+	StartDay string            `json:"start_day"`
+	EndDay   string            `json:"end_day"`
 	List     []XmyGameResponse `json:"list"`
 }
 

+ 1 - 1
model/task/search_script_params.go

@@ -3,7 +3,7 @@ package task
 import "log-server/model/common/request"
 
 // script分页条件查询及排序结构体
-type SearchAccountTypeParams struct {
+type SearchGameScriptParams struct {
 	GameScriptResponse
 	request.PageInfo
 	OrderKey string `json:"orderKey"` // 排序

+ 5 - 4
model/task/task_conf.go

@@ -5,10 +5,11 @@ import (
 )
 
 type TaskConf struct {
-	Id           int    `json:"id"`
-	TaskId       int    `json:"task_id"`
-	User         string `json:"user"`
-	AddFeeNotice int    `json:"add_fee_notice"`
+	Id            int    `json:"id"`
+	TaskId        int    `json:"task_id"`
+	User          string `json:"user"`
+	AddFeeNotice  int    `json:"add_fee_notice"`
+	SimulatorType int    `json:"simulator_type"`
 }
 
 func (TaskConf) TableName() string {

+ 1 - 0
router/fileManager/file_qiniu.go

@@ -20,5 +20,6 @@ func (e *FileQiniuRouter) InitFileQiniuRouter(Router *gin.RouterGroup) {
 		excelRouter.POST("renameQiniuFileAndRecord", api.RenameQiniuFileAndRecord)  //删除单个文件
 		excelRouter.GET("getMirrorDownloadByTaskId", api.GetMirrorDownloadByTaskId) //根据任务id获取最新镜像下载链接
 		excelRouter.POST("updateMirrorPushPolicy", api.UpdateMirrorPushPolicy)      //删除单个文件
+		excelRouter.POST("checkIsExistMirror", api.CheckIsExistMirror)              //查询未上传镜像的游戏任务
 	}
 }

+ 38 - 0
service/fileManager/file_qiniu.go

@@ -10,6 +10,7 @@ import (
 	"log-server/model/fileManager"
 	"log-server/model/fileManager/request"
 	"log-server/model/fileManager/response"
+	"log-server/model/task"
 	"strconv"
 	"strings"
 	"time"
@@ -76,6 +77,43 @@ func (s *ServiceFileQiniu) QueryFilesByParentId(parentId int) (interface{}, erro
 	return fileList, err
 }
 
+// CheckIsExistMirror 查询所有游戏任务下是否有镜像
+func (s *ServiceFileQiniu) CheckIsExistMirror() (interface{}, error) {
+	// 查询所有任务
+	var taskList []task.GameTask
+	db := global.GVA_DB.Model(&task.GameTask{}).Where("status = 1")
+	err := db.Order("user").Find(&taskList).Error
+	if err != nil {
+		return nil, err
+	}
+	// 查询所有镜像
+	var mirrorList []fileManager.FileQiniu
+	db2 := global.GVA_DB.Model(&fileManager.FileQiniu{}).Where(`file_name LIKE '%.ldbk' OR file_name LIKE '%.npbk'`)
+	err = db2.Order("id").Find(&mirrorList).Error
+	if err != nil {
+		return nil, err
+	}
+	var noMirrorList []task.GameTask
+	for _, gameTask := range taskList {
+		exist := false
+		for _, qiniu := range mirrorList {
+			if gameTask.TaskId == qiniu.TaskId {
+				exist = true
+				break
+			}
+		}
+		if exist == false {
+			noMirrorList = append(noMirrorList, gameTask)
+		}
+	}
+
+	//for _, gameTask := range noMirrorList {
+	//	global.GVA_LOG.Warn(gameTask.TaskName)
+	//}
+
+	return noMirrorList, err
+}
+
 // GetMirrorDownloadByTaskId 根据任务id获取最新镜像下载链接
 func (s *ServiceFileQiniu) GetMirrorDownloadByTaskId(taskId string) (interface{}, error) {
 	//SELECT * FROM file_qiniu WHERE task_id = 1000605 AND (file_type = 2 OR file_type = 4) AND push_policy = 1 ORDER BY file_version DESC LIMIT 1

+ 2 - 1
service/task/game_task.go

@@ -350,7 +350,7 @@ func (apiService *GameTask) GetUsedGameTaskInfoList(api task.GameTask, info requ
 	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.Select("game_task.*, task_conf.add_fee_notice, task_conf.simulator_type")
 	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 != "" {
@@ -415,6 +415,7 @@ func (apiService *GameTask) GetUsedGameTaskInfoList(api task.GameTask, info requ
 			var apiReply = new(response.GetGameTaskListUnionReply)
 			apiReply.Status = apiInfo.Status
 			apiReply.TaskId = apiInfo.TaskId
+			apiReply.SimulatorType = apiInfo.SimulatorType
 			apiReply.TaskName = apiInfo.TaskName
 			apiReply.AddFeeNotice = apiInfo.AddFeeNotice
 			apiReply.GamePort = gamePortMp[apiInfo.GamePortId].ChannelName

+ 1 - 1
service/task/task_conf.go

@@ -291,5 +291,5 @@ func (e *TaskConfService) JudgeOperate(taskConf task.TaskConf) (err error) {
 		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
+	return global.GVA_DB.Model(&task.TaskConf{}).Where("task_id = ?", taskConf.TaskId).Omit("task_id", "user").Updates(map[string]interface{}{"add_fee_notice": taskConf.AddFeeNotice, "simulator_type": taskConf.SimulatorType}).Error
 }

+ 8 - 0
uploads/.idea/.gitignore

@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 8 - 0
uploads/.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/uploads.iml" filepath="$PROJECT_DIR$/.idea/uploads.iml" />
+    </modules>
+  </component>
+</project>

+ 9 - 0
uploads/.idea/uploads.iml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="Go" enabled="true" />
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 6 - 0
uploads/.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
+  </component>
+</project>