From a6eb2eedc3b2e63f05de494202445a2abdb6eca2 Mon Sep 17 00:00:00 2001 From: huangx Date: Tue, 11 Aug 2020 09:46:59 +0800 Subject: [PATCH] check errcode in ListUserOpenIDs (#312) Co-authored-by: huangxiang --- officialaccount/user/user.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/officialaccount/user/user.go b/officialaccount/user/user.go index 7d890c3..d802019 100644 --- a/officialaccount/user/user.go +++ b/officialaccount/user/user.go @@ -52,6 +52,8 @@ type Info struct { // OpenidList 用户列表 type OpenidList struct { + util.CommonError + Total int `json:"total"` Count int `json:"count"` Data struct { @@ -124,13 +126,14 @@ func (user *User) ListUserOpenIDs(nextOpenid ...string) (*OpenidList, error) { return nil, err } - userlist := new(OpenidList) - err = json.Unmarshal(response, userlist) + userlist := OpenidList{} + + err = util.DecodeWithError(response, &userlist, "ListUserOpenIDs") if err != nil { return nil, err } - return userlist, nil + return &userlist, nil } // ListAllUserOpenIDs 返回所有用户OpenID列表