Skip to content

Commit

Permalink
修复数字转换问题
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdgyc committed Jul 4, 2024
1 parent 00bbbf4 commit 726ae20
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/dbdata/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,13 @@ func SetGroup(g *Group) error {
}
if regexp.MustCompile(`^\d{1,5}-\d{1,5}$`).MatchString(p) {
rp := strings.Split(p, "-")
portfrom, err := strconv.Atoi(rp[0])
// portfrom, err := strconv.Atoi(rp[0])
portfrom, err := strconv.ParseUint(rp[0], 10, 16)
if err != nil {
return errors.New("端口:" + rp[0] + " 格式错误, " + err.Error())
}
portto, err := strconv.Atoi(rp[1])
// portto, err := strconv.Atoi(rp[1])
portto, err := strconv.ParseUint(rp[1], 10, 16)
if err != nil {
return errors.New("端口:" + rp[1] + " 格式错误, " + err.Error())
}
Expand All @@ -194,7 +196,7 @@ func SetGroup(g *Group) error {
}

} else {
port, err := strconv.Atoi(p)
port, err := strconv.ParseUint(p, 10, 16)
if err != nil {
return errors.New("端口:" + p + " 格式错误, " + err.Error())
}
Expand Down

0 comments on commit 726ae20

Please sign in to comment.