fix: issues

This commit is contained in:
Rogee
2024-12-08 13:31:39 +08:00
parent 25df094481
commit d44e8e1121
8 changed files with 111 additions and 41 deletions

View File

@@ -1,16 +1,16 @@
package wechat
type Response struct {
ErrCode int `json:"errcode"`
ErrMsg int `json:"errmsg"`
ErrDescribe int `json:"-"`
type ErrorResponse struct {
ErrCode int `json:"errcode,omitempty"`
ErrMsg string `json:"errmsg,omitempty"`
}
func (r *Response) Error() error {
return translateError(r.ErrCode)
func (r *ErrorResponse) Error() error {
return translateError(r.ErrCode, r.ErrMsg)
}
type AccessTokenResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"` // seconds
ErrorResponse
AccessToken string `json:"access_token,omitempty"`
ExpiresIn int `json:"expires_in,omitempty"` // seconds
}