mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-23 13:42:25 +08:00
统一错误处理
This commit is contained in:
@@ -79,11 +79,9 @@ func (basic *Basic) CheckNickName(nickname string) (*CheckNickNameResp, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result := &CheckNickNameResp{}
|
res := &CheckNickNameResp{}
|
||||||
if err := util.DecodeWithError(data, result, "wxverify/checkwxverifynickname"); err != nil {
|
err = util.DecodeWithError(data, res, "CheckNickName")
|
||||||
return nil, err
|
return res, err
|
||||||
}
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetNickNameResp 设置小程序名称结果
|
// SetNickNameResp 设置小程序名称结果
|
||||||
@@ -124,11 +122,9 @@ func (basic *Basic) SetNickNameFull(param *SetNickNameParam) (*SetNickNameResp,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result := &SetNickNameResp{}
|
res := &SetNickNameResp{}
|
||||||
if err := util.DecodeWithError(data, result, "setnickname"); err != nil {
|
err = util.DecodeWithError(data, res, "SetNickName")
|
||||||
return nil, err
|
return res, err
|
||||||
}
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSignatureResp 小程序功能介绍修改结果
|
// SetSignatureResp 小程序功能介绍修改结果
|
||||||
@@ -150,7 +146,7 @@ func (basic *Basic) SetSignature(signature string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return util.DecodeWithError(data, &SetSignatureResp{}, "account/modifysignature")
|
return util.DecodeWithError(data, &SetSignatureResp{}, "SetSignature")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSearchStatusResp 查询小程序当前是否可被搜索
|
// GetSearchStatusResp 查询小程序当前是否可被搜索
|
||||||
@@ -171,11 +167,9 @@ func (basic *Basic) GetSearchStatus(signature string) (*GetSearchStatusResp, err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result := &GetSearchStatusResp{}
|
res := &GetSearchStatusResp{}
|
||||||
if err := util.DecodeWithError(data, result, "getwxasearchstatus"); err != nil {
|
err = util.DecodeWithError(data, res, "GetSearchStatus")
|
||||||
return nil, err
|
return res, err
|
||||||
}
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSearchStatusResp 小程序是否可被搜索修改结果
|
// SetSearchStatusResp 小程序是否可被搜索修改结果
|
||||||
@@ -198,7 +192,7 @@ func (basic *Basic) SetSearchStatus(status int) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return util.DecodeWithError(data, &SetSearchStatusResp{}, "changewxasearchstatus")
|
return util.DecodeWithError(data, &SetSearchStatusResp{}, "SetSearchStatus")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHeadImageResp 小程序头像修改结果
|
// SetHeadImageResp 小程序头像修改结果
|
||||||
@@ -239,5 +233,5 @@ func (basic *Basic) SetHeadImageFull(param *SetHeadImageParam) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return util.DecodeWithError(data, &SetHeadImageResp{}, "account/modifyheadimage")
|
return util.DecodeWithError(data, &SetHeadImageResp{}, "account/setheadimage")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user