【仿真创建销毁消息处理、编辑角色逻辑】

This commit is contained in:
weizhihong 2023-08-31 10:17:38 +08:00
parent 35e2933a44
commit 399daa147f
3 changed files with 6 additions and 10 deletions

View File

@ -6,6 +6,7 @@ import (
"go.uber.org/zap"
grpc "google.golang.org/grpc"
"joylink.club/bj-rtsts-server/config"
"joylink.club/bj-rtsts-server/dto"
)
// Centrifugo 实时消息传递客户端
@ -15,7 +16,7 @@ var client CentrifugoApiClient
func InitClient() {
conn, err := grpc.Dial(config.Config.Messaging.Centrifugo.Address, grpc.WithInsecure())
if err != nil {
panic(err)
panic(dto.ErrorDto{Code: dto.DataOperationError, Message: err.Error()})
}
client = NewCentrifugoApiClient(conn)
}

View File

@ -48,11 +48,9 @@ func (t *MemoryChangeServer) onTick() []TopicMsg {
for _, v := range simArr {
allSim[v.SimulationId] = true
if t.simulationMap[v.SimulationId] == nil {
addArr = append(addArr, &state.SimulationStatus{
SimulationId: v.SimulationId,
MapId: v.MapId,
ProjectId: v.ProjectId,
})
status := &state.SimulationStatus{SimulationId: v.SimulationId, MapId: v.MapId, ProjectId: v.ProjectId}
t.simulationMap[v.SimulationId] = status
addArr = append(addArr, status)
}
}
// 已经移除的仿真
@ -67,7 +65,7 @@ func (t *MemoryChangeServer) onTick() []TopicMsg {
msg := &state.MemoryDataStatus{AddSimulations: addArr, RemoveSimulations: delArr}
b, err := proto.Marshal(msg)
if err != nil {
panic(err)
panic(dto.ErrorDto{Code: dto.ArgumentParseError, Message: err.Error()})
}
return []TopicMsg{{channalName: t.getChannelName(), data: b}}
}

View File

@ -87,9 +87,6 @@ func UpdateAuthRole(rid int32, info *dto.AuthRoleReqDto) bool {
if err != nil {
panic(dto.ErrorDto{Code: dto.DataOperationError, Message: err.Error()})
}
if dto.IsSystemRole(role.Weight) {
panic(dto.ErrorDto{Code: dto.DataOperationError, Message: "系统角色不可编辑"})
}
role.Name = info.Name
// 更新名称
dbquery.AuthRole.Updates(role)