This commit is contained in:
likun 2025-08-21 17:37:09 +08:00
parent 4af43e609f
commit e7daf261fd
6 changed files with 49 additions and 27 deletions

View File

@ -6,6 +6,7 @@ import (
"admin/internal/consts"
"admin/internal/errcode"
"admin/internal/model/dto"
"gorm.io/gorm"
)
@ -89,7 +90,7 @@ func (svc *AccountService) GetWhiteListAll(projectId int) ([]*dto.WhiteListInfo,
for _, sc := range scList {
list = append(list, &dto.WhiteListInfo{
WType: "support",
Value: sc.Account,
Value: sc.Account + "-" + sc.Channel,
})
}
}

View File

@ -6,6 +6,7 @@ import (
"admin/internal/model/dto"
"admin/lib/httpclient"
"admin/lib/xlog"
"encoding/json"
"math"
"net/url"
"strconv"
@ -98,7 +99,19 @@ func (items *Items) ChangeRoleItem(projectInfo *entity.Project, serverId, roleId
rsp := make(map[string]any)
err := httpclient.Request(alisrvAddr+"/gm", "get", params, &rsp)
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

View File

@ -25,9 +25,9 @@ func (hook *SupportAccountHook) Create(projectInfo *entity.Project, resource str
params := &url.Values{}
params.Add("cmd_data", "OpWhitelist")
params.Add("type", "support")
params.Add("value", info.Account)
params.Add("value", info.Account+"-"+info.Channel)
params.Add("op", "add")
params.Add("sc_channel", info.Channel)
//params.Add("sc_channel", info.Channel)
//params.Add("server", info.ServerConfID)
// 所有区服

View File

@ -70,7 +70,7 @@ func genCdnServerListContent(projectEt *entity.Project, serverList, noticeList [
serverInfo.Properties[4].Value = "0"
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"
serverId, _ := strconv.Atoi(serverDbInfo.ServerConfID)
@ -117,7 +117,7 @@ func getCdnServerArea(serverId int) string {
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 {
return consts.CdnServerStatus_Maintain
}

View File

@ -1,3 +1,3 @@
VITE_APP_ENV = 'development'
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'

View File

@ -68,9 +68,7 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
var field = fieldsDescInfoData[i]
// dialogObjectForm.value[field.key] = ''
if (field.required === true) {
rules.value[field.key] = [{required: true, message: field.name + "不能为空", trigger: "blur"}]
}
if (field.type === "items") {
dialogObjectForm.value[field.key] = []
@ -79,6 +77,31 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
itemsValue.push("(" + item.desc + "," + item.id.toString() + "," + item.num.toString() + ")")
})
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) {
rules.value[field.key] = [{
required: true,
@ -93,20 +116,7 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
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 !== "") {
field.value1 = ""
field.value2 = ""
@ -123,7 +133,7 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
}
}
if (!find) {
if (whereFieldsDescInfo.value.length == 0) {
if (whereFieldsDescInfo.value.length === 0) {
field.isFirstWhereDesc = true
} else {
field.isFirstWhereDesc = false
@ -131,17 +141,15 @@ const handleServerRowData = (fieldsDescInfoData, rowData) => {
whereFieldsDescInfo.value.push(field)
}
}
}
return rowData
}
})
const handleServerRowsData = (fieldsDescInfoData, rowsData) => {
let newRowsData = []
rowsData.forEach((rowData) => {
const newRowData = handleServerRowData(fieldsDescInfoData, rowData)
// console.log("new data:", newRowData)
newRowsData.push(newRowData)
})
// console.log("rules:", rules.value)
return newRowsData
}