fix some
This commit is contained in:
		
							parent
							
								
									4af43e609f
								
							
						
					
					
						commit
						e7daf261fd
					
				@ -6,6 +6,7 @@ import (
 | 
				
			|||||||
	"admin/internal/consts"
 | 
						"admin/internal/consts"
 | 
				
			||||||
	"admin/internal/errcode"
 | 
						"admin/internal/errcode"
 | 
				
			||||||
	"admin/internal/model/dto"
 | 
						"admin/internal/model/dto"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"gorm.io/gorm"
 | 
						"gorm.io/gorm"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -89,7 +90,7 @@ func (svc *AccountService) GetWhiteListAll(projectId int) ([]*dto.WhiteListInfo,
 | 
				
			|||||||
		for _, sc := range scList {
 | 
							for _, sc := range scList {
 | 
				
			||||||
			list = append(list, &dto.WhiteListInfo{
 | 
								list = append(list, &dto.WhiteListInfo{
 | 
				
			||||||
				WType: "support",
 | 
									WType: "support",
 | 
				
			||||||
				Value: sc.Account,
 | 
									Value: sc.Account + "-" + sc.Channel,
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,7 @@ import (
 | 
				
			|||||||
	"admin/internal/model/dto"
 | 
						"admin/internal/model/dto"
 | 
				
			||||||
	"admin/lib/httpclient"
 | 
						"admin/lib/httpclient"
 | 
				
			||||||
	"admin/lib/xlog"
 | 
						"admin/lib/xlog"
 | 
				
			||||||
 | 
						"encoding/json"
 | 
				
			||||||
	"math"
 | 
						"math"
 | 
				
			||||||
	"net/url"
 | 
						"net/url"
 | 
				
			||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
@ -98,7 +99,19 @@ func (items *Items) ChangeRoleItem(projectInfo *entity.Project, serverId, roleId
 | 
				
			|||||||
	rsp := make(map[string]any)
 | 
						rsp := make(map[string]any)
 | 
				
			||||||
	err := httpclient.Request(alisrvAddr+"/gm", "get", params, &rsp)
 | 
						err := httpclient.Request(alisrvAddr+"/gm", "get", params, &rsp)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rBin, _ := json.Marshal(&rsp)
 | 
				
			||||||
 | 
						xlog.Debugf("rsp:%v", string(rBin))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						codeI, find := rsp["code"]
 | 
				
			||||||
 | 
						if find {
 | 
				
			||||||
 | 
							code := codeI.(float64)
 | 
				
			||||||
 | 
							if code != 0 {
 | 
				
			||||||
 | 
								msg := rsp["msg"].(string)
 | 
				
			||||||
 | 
								return errcode.New(errcode.ParamsInvalid, "游戏服返回:%v", msg)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
 | 
				
			|||||||
@ -25,9 +25,9 @@ func (hook *SupportAccountHook) Create(projectInfo *entity.Project, resource str
 | 
				
			|||||||
	params := &url.Values{}
 | 
						params := &url.Values{}
 | 
				
			||||||
	params.Add("cmd_data", "OpWhitelist")
 | 
						params.Add("cmd_data", "OpWhitelist")
 | 
				
			||||||
	params.Add("type", "support")
 | 
						params.Add("type", "support")
 | 
				
			||||||
	params.Add("value", info.Account)
 | 
						params.Add("value", info.Account+"-"+info.Channel)
 | 
				
			||||||
	params.Add("op", "add")
 | 
						params.Add("op", "add")
 | 
				
			||||||
	params.Add("sc_channel", info.Channel)
 | 
						//params.Add("sc_channel", info.Channel)
 | 
				
			||||||
	//params.Add("server", info.ServerConfID)
 | 
						//params.Add("server", info.ServerConfID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 所有区服
 | 
						// 所有区服
 | 
				
			||||||
 | 
				
			|||||||
@ -70,7 +70,7 @@ func genCdnServerListContent(projectEt *entity.Project, serverList, noticeList [
 | 
				
			|||||||
		serverInfo.Properties[4].Value = "0"
 | 
							serverInfo.Properties[4].Value = "0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		serverInfo.Properties[5].Key = "status"
 | 
							serverInfo.Properties[5].Key = "status"
 | 
				
			||||||
		serverInfo.Properties[5].Value = fmt.Sprintf("%v", getCdnServerStatus(serverDbInfo))
 | 
							serverInfo.Properties[5].Value = fmt.Sprintf("%v", getCdnServerStatus(serverDbInfo, serverList))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		serverInfo.Properties[6].Key = "area"
 | 
							serverInfo.Properties[6].Key = "area"
 | 
				
			||||||
		serverId, _ := strconv.Atoi(serverDbInfo.ServerConfID)
 | 
							serverId, _ := strconv.Atoi(serverDbInfo.ServerConfID)
 | 
				
			||||||
@ -117,7 +117,7 @@ func getCdnServerArea(serverId int) string {
 | 
				
			|||||||
	return fmt.Sprintf("%v区", (serverId-20001)/4+1)
 | 
						return fmt.Sprintf("%v区", (serverId-20001)/4+1)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func getCdnServerStatus(server *model.Server) int {
 | 
					func getCdnServerStatus(server *model.Server, serverList []*entity.CommonResource) int {
 | 
				
			||||||
	if server.IsServerDown {
 | 
						if server.IsServerDown {
 | 
				
			||||||
		return consts.CdnServerStatus_Maintain
 | 
							return consts.CdnServerStatus_Maintain
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,3 @@
 | 
				
			|||||||
VITE_APP_ENV = 'development'
 | 
					VITE_APP_ENV = 'development'
 | 
				
			||||||
VITE_APP_BASE_API = '/api'
 | 
					VITE_APP_BASE_API = '/api'
 | 
				
			||||||
VITE_APP_BASE_URL = 'http://192.168.78.128:8080/api'
 | 
					VITE_APP_BASE_URL = 'http://192.168.9.205:8080/api'
 | 
				
			||||||
@ -68,9 +68,7 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
 | 
				
			|||||||
    var field = fieldsDescInfoData[i]
 | 
					    var field = fieldsDescInfoData[i]
 | 
				
			||||||
    // dialogObjectForm.value[field.key] = ''
 | 
					    // dialogObjectForm.value[field.key] = ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (field.required === true) {
 | 
					
 | 
				
			||||||
      rules.value[field.key] = [{required: true, message: field.name + "不能为空", trigger: "blur"}]
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (field.type === "items") {
 | 
					    if (field.type === "items") {
 | 
				
			||||||
      dialogObjectForm.value[field.key] = []
 | 
					      dialogObjectForm.value[field.key] = []
 | 
				
			||||||
@ -79,6 +77,31 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
 | 
				
			|||||||
        itemsValue.push("(" + item.desc + "," + item.id.toString() + "," + item.num.toString() + ")")
 | 
					        itemsValue.push("(" + item.desc + "," + item.id.toString() + "," + item.num.toString() + ")")
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      rowData.jsonValue = JSON.stringify(itemsValue)
 | 
					      rowData.jsonValue = JSON.stringify(itemsValue)
 | 
				
			||||||
 | 
					    } else if (field.big_column === true) {
 | 
				
			||||||
 | 
					      rowData.jsonValue = JSON.stringify(rowData[field.key])
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const tagStatusColorArray = ["plain", "primary", "success", "info", "warning", "danger"]
 | 
				
			||||||
 | 
					    if (field.type === "tagStatus") {
 | 
				
			||||||
 | 
					      for (let k = 0; k < field.choices.length; k++) {
 | 
				
			||||||
 | 
					        if (rowData[field.key] === field.choices[k].value) {
 | 
				
			||||||
 | 
					          rowData["tagValue" + field.key] = field.choices[k].desc
 | 
				
			||||||
 | 
					          rowData["tagColor" + field.key] = tagStatusColorArray[field.choices[k].type]
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return rowData
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const handleServerRowsData = (fieldsDescInfoData, rowsData) => {
 | 
				
			||||||
 | 
					  console.log("fields:", fieldsDescInfoData)
 | 
				
			||||||
 | 
					  console.log("rowsData:", rowsData)
 | 
				
			||||||
 | 
					  fieldsDescInfoData.forEach(field => {
 | 
				
			||||||
 | 
					    if (field.required === true) {
 | 
				
			||||||
 | 
					      rules.value[field.key] = [{required: true, message: field.name + "不能为空", trigger: "blur"}]
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (field.type === "items") {
 | 
				
			||||||
      if (field.required === true) {
 | 
					      if (field.required === true) {
 | 
				
			||||||
        rules.value[field.key] = [{
 | 
					        rules.value[field.key] = [{
 | 
				
			||||||
          required: true,
 | 
					          required: true,
 | 
				
			||||||
@ -93,20 +116,7 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
 | 
				
			|||||||
          trigger: ["blur", "change"],
 | 
					          trigger: ["blur", "change"],
 | 
				
			||||||
        }]
 | 
					        }]
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } else if (field.big_column === true) {
 | 
					 | 
				
			||||||
      rowData.jsonValue = JSON.stringify(rowData[field.key])
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    const tagStatusColorArray = ["plain", "primary", "success", "info", "warning", "danger"]
 | 
					 | 
				
			||||||
    if (field.type === "tagStatus") {
 | 
					 | 
				
			||||||
      for (let k = 0; k < field.choices.length; k++) {
 | 
					 | 
				
			||||||
        if (rowData[field.key] === field.choices[k].value) {
 | 
					 | 
				
			||||||
          rowData["tagValue" + field.key] = field.choices[k].desc
 | 
					 | 
				
			||||||
          rowData["tagColor" + field.key] = tagStatusColorArray[field.choices[k].type]
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (field.where !== "") {
 | 
					    if (field.where !== "") {
 | 
				
			||||||
      field.value1 = ""
 | 
					      field.value1 = ""
 | 
				
			||||||
      field.value2 = ""
 | 
					      field.value2 = ""
 | 
				
			||||||
@ -123,7 +133,7 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (!find) {
 | 
					      if (!find) {
 | 
				
			||||||
        if (whereFieldsDescInfo.value.length == 0) {
 | 
					        if (whereFieldsDescInfo.value.length === 0) {
 | 
				
			||||||
          field.isFirstWhereDesc = true
 | 
					          field.isFirstWhereDesc = true
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          field.isFirstWhereDesc = false
 | 
					          field.isFirstWhereDesc = false
 | 
				
			||||||
@ -131,17 +141,15 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
 | 
				
			|||||||
        whereFieldsDescInfo.value.push(field)
 | 
					        whereFieldsDescInfo.value.push(field)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  })
 | 
				
			||||||
  return rowData
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const handleServerRowsData = (fieldsDescInfoData, rowsData) => {
 | 
					 | 
				
			||||||
  let newRowsData = []
 | 
					  let newRowsData = []
 | 
				
			||||||
  rowsData.forEach((rowData) => {
 | 
					  rowsData.forEach((rowData) => {
 | 
				
			||||||
    const newRowData = handleServerRowData(fieldsDescInfoData, rowData)
 | 
					    const newRowData = handleServerRowData(fieldsDescInfoData, rowData)
 | 
				
			||||||
    // console.log("new data:", newRowData)
 | 
					    // console.log("new data:", newRowData)
 | 
				
			||||||
    newRowsData.push(newRowData)
 | 
					    newRowsData.push(newRowData)
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					  // console.log("rules:", rules.value)
 | 
				
			||||||
  return newRowsData
 | 
					  return newRowsData
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user