修复字符串分割bug
This commit is contained in:
parent
fe4654e9e1
commit
c5b0fe3bb5
3 changed files with 5 additions and 5 deletions
|
@ -17,7 +17,7 @@ func main() {
|
|||
// 去除末尾的换行符
|
||||
// raw_msg = strings.TrimRight(raw_msg, "\r\n")
|
||||
|
||||
parms := strings.Split(raw_msg, " ")
|
||||
parms := strings.Fields(raw_msg)
|
||||
|
||||
worker := workers.NewWorker(parms, "11", "111", "111", "222", raw_msg)
|
||||
fmt.Println("Test:", worker.CheckPermission())
|
||||
|
|
|
@ -23,7 +23,7 @@ func Router(data map[string]interface{}) {
|
|||
mid := data["message_id"].(float64)
|
||||
raw_msg := data["raw_message"].(string)[1:]
|
||||
|
||||
parms := strings.Split(raw_msg, " ")
|
||||
parms := strings.Fields(raw_msg)
|
||||
|
||||
worker := workers.NewWorker(parms, fmt.Sprintf("%d", int(uid)), fmt.Sprintf("%d", int(gid)), role, fmt.Sprintf("%d", int(mid)), raw_msg)
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ func (a *Ip) GetMsg() string {
|
|||
// 去除换行符
|
||||
raw_msg := strings.TrimRight(a.RawMsg, "\n")
|
||||
fmt.Println("raw_msg:", raw_msg)
|
||||
parms := strings.Split(raw_msg, " ")
|
||||
url := "https://api.ip.sb/geoip/" + parms[0]
|
||||
parms := strings.Fields(raw_msg)
|
||||
url := "https://api.ip.sb/geoip/" + parms[1]
|
||||
|
||||
// fmt.Println("url: ", url)
|
||||
|
||||
|
@ -50,7 +50,7 @@ func (a *Ip) GetMsg() string {
|
|||
return err.Error()
|
||||
}
|
||||
// 输出响应数据
|
||||
// fmt.Println("data: ", data)
|
||||
fmt.Println("data: ", data)
|
||||
if _, ok := data["code"].(float64); ok {
|
||||
code := data["code"].(float64)
|
||||
if code == 401 {
|
||||
|
|
Loading…
Reference in a new issue