diff --git a/push/getui.go b/push/getui.go index cc6e2a1..018ad19 100644 --- a/push/getui.go +++ b/push/getui.go @@ -11,6 +11,10 @@ import ( "time" ) +var ( + PushErrorCidNotExist = errors.New("cid not exist") +) + type GetuiConfig struct { AppId string AppKey string @@ -92,7 +96,7 @@ func (g *Getui) Token() string { reqBody, _ := json.Marshal(params) rspBody, err := util.HttpPostJson(reqUrl, nil, reqBody) if err != nil { - fmt.Println(string(reqBody)) + log.Errorf("http post [%s] error :%s", string(reqBody), err.Error()) return "" } @@ -198,7 +202,7 @@ func (g *Getui) GetUserStatus(cid string) (*GetuiStatus, error) { return nil, err } if _, ok := result[cid]; !ok { - return nil, errors.New("not cid exist") + return nil, PushErrorCidNotExist } status := new(GetuiStatus) @@ -226,7 +230,7 @@ func (g *Getui) GetUserDetail(cid string) (*GetuiDetail, error) { } validCids := cast.ToStringMap(result["validCids"]) if _, ok := validCids[cid]; !ok { - return nil, errors.New("not cid exist") + return nil, PushErrorCidNotExist } cidDetail := cast.ToStringMap(validCids[cid])