优化
This commit is contained in:
		
							parent
							
								
									037950a599
								
							
						
					
					
						commit
						5c2af96ac2
					
				@ -9,6 +9,7 @@ import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"sort"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"text/template"
 | 
			
		||||
	"time"
 | 
			
		||||
@ -32,6 +33,7 @@ type CdnServerNoticeInfo struct {
 | 
			
		||||
	NoticeList    []*CdnNoticeInfo
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// todo 根据项目获取不同的cdn推送内容
 | 
			
		||||
func genCdnServerListContent(projectEt *entity.Project, serverList, noticeList []*entity.CommonResource) (string, error) {
 | 
			
		||||
	info := &CdnServerNoticeInfo{}
 | 
			
		||||
	hook, _ := projects.GetProjectResourceHook(projectEt, consts.ResourcesName_Server).(projects.IServerInfoHook)
 | 
			
		||||
@ -71,7 +73,8 @@ func genCdnServerListContent(projectEt *entity.Project, serverList, noticeList [
 | 
			
		||||
		serverInfo.Properties[5].Value = fmt.Sprintf("%v", getCdnServerStatus(serverDbInfo))
 | 
			
		||||
 | 
			
		||||
		serverInfo.Properties[6].Key = "area"
 | 
			
		||||
		serverInfo.Properties[6].Value = "1区"
 | 
			
		||||
		serverId, _ := strconv.Atoi(serverDbInfo.ServerConfID)
 | 
			
		||||
		serverInfo.Properties[6].Value = getCdnServerArea(serverId)
 | 
			
		||||
 | 
			
		||||
		serverInfo.Properties[7].Key = "type"
 | 
			
		||||
		serverInfo.Properties[7].Value = "1"
 | 
			
		||||
@ -109,6 +112,11 @@ func genCdnServerListContent(projectEt *entity.Project, serverList, noticeList [
 | 
			
		||||
	return bytesBuffer.String(), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getCdnServerArea(serverId int) string {
 | 
			
		||||
	// 神魔大陆每4个服对应一个区,从20001开始
 | 
			
		||||
	return fmt.Sprintf("%v区", (serverId-20001)/4+1)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getCdnServerStatus(server *model.Server) int {
 | 
			
		||||
	if server.IsServerDown {
 | 
			
		||||
		return consts.CdnServerStatus_Maintain
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								admin/uniugm.db
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								admin/uniugm.db
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user