Skip to content

Commit

Permalink
Update port_service.go
Browse files Browse the repository at this point in the history
  • Loading branch information
natokay committed Nov 5, 2021
1 parent 482a4b2 commit d7d4667
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions service/port_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ func (s *PortService) ValidatePort(portId int64, value string, level int32) map[
ret["state"] = true
if level == 1 { //端口号验证
if portNum, err := strconv.Atoi(value); err == nil && portNum > 0 && portNum < 65535 {
if pid, err := support.PortCheckup(portNum); err != nil || pid != -1 {
if port := s.Mapper.PortGetById(portId); port != nil && port.PortNum != portNum {
pid, err := support.PortCheckup(portNum)
if err != nil || pid != -1 {
port := s.Mapper.PortGetById(portId)
if port != nil && port.PortNum != portNum {
return ret
}
}
ret["state"] = s.Mapper.PortExist(portId, value)
ret["state"] = pid != -1 || s.Mapper.PortExist(portId, value)
}
}
if level == 2 { //域名验证
Expand Down

0 comments on commit d7d4667

Please sign in to comment.