invalidCids

This commit is contained in:
jiangyong27 2024-05-09 21:31:47 +08:00
parent ac11b506af
commit 792925151d
1 changed files with 7 additions and 3 deletions

View File

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