Skip to content

Commit 9bfebc8

Browse files
authored
fix(work): fix DepartmentGet with commonError is invalid or not struct (#728)
fix DepartmentGet with commonError is invalid or not struct
1 parent 4f6cbc3 commit 9bfebc8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

work/addresslist/department.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ type (
5858
ParentID int `json:"parentid"` // 父部门id。根部门为1
5959
Order int `json:"order"` // 在父部门中的次序值。order值大的排序靠前
6060
}
61+
// DepartmentGetResponse 获取单个部门详情
62+
DepartmentGetResponse struct {
63+
util.CommonError
64+
Department Department `json:"department"`
65+
}
6166
)
6267

6368
// DepartmentCreate 创建部门
@@ -138,9 +143,9 @@ func (r *Client) DepartmentGet(departmentID int) (*Department, error) {
138143
if response, err = util.HTTPGet(fmt.Sprintf(departmentGetURL, accessToken, departmentID)); err != nil {
139144
return nil, err
140145
}
141-
result := &Department{}
146+
result := &DepartmentGetResponse{}
142147
if err = util.DecodeWithError(response, result, "DepartmentGet"); err != nil {
143148
return nil, err
144149
}
145-
return result, nil
150+
return &result.Department, nil
146151
}

0 commit comments

Comments
 (0)