mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-04 12:52:27 +08:00
fix(work): fix DepartmentGet with commonError is invalid or not struct (#728)
fix DepartmentGet with commonError is invalid or not struct
This commit is contained in:
@@ -58,6 +58,11 @@ type (
|
|||||||
ParentID int `json:"parentid"` // 父部门id。根部门为1
|
ParentID int `json:"parentid"` // 父部门id。根部门为1
|
||||||
Order int `json:"order"` // 在父部门中的次序值。order值大的排序靠前
|
Order int `json:"order"` // 在父部门中的次序值。order值大的排序靠前
|
||||||
}
|
}
|
||||||
|
// DepartmentGetResponse 获取单个部门详情
|
||||||
|
DepartmentGetResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
Department Department `json:"department"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// DepartmentCreate 创建部门
|
// DepartmentCreate 创建部门
|
||||||
@@ -138,9 +143,9 @@ func (r *Client) DepartmentGet(departmentID int) (*Department, error) {
|
|||||||
if response, err = util.HTTPGet(fmt.Sprintf(departmentGetURL, accessToken, departmentID)); err != nil {
|
if response, err = util.HTTPGet(fmt.Sprintf(departmentGetURL, accessToken, departmentID)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
result := &Department{}
|
result := &DepartmentGetResponse{}
|
||||||
if err = util.DecodeWithError(response, result, "DepartmentGet"); err != nil {
|
if err = util.DecodeWithError(response, result, "DepartmentGet"); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return result, nil
|
return &result.Department, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user