Skip to content

Commit

Permalink
fix(work): fix DepartmentGet with commonError is invalid or not struct (
Browse files Browse the repository at this point in the history
#728)

fix DepartmentGet with commonError is invalid or not struct
  • Loading branch information
Lumiaqian authored Sep 25, 2023
1 parent 4f6cbc3 commit 9bfebc8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions work/addresslist/department.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ type (
ParentID int `json:"parentid"` // 父部门id。根部门为1
Order int `json:"order"` // 在父部门中的次序值。order值大的排序靠前
}
// DepartmentGetResponse 获取单个部门详情
DepartmentGetResponse struct {
util.CommonError
Department Department `json:"department"`
}
)

// DepartmentCreate 创建部门
Expand Down Expand Up @@ -138,9 +143,9 @@ func (r *Client) DepartmentGet(departmentID int) (*Department, error) {
if response, err = util.HTTPGet(fmt.Sprintf(departmentGetURL, accessToken, departmentID)); err != nil {
return nil, err
}
result := &Department{}
result := &DepartmentGetResponse{}
if err = util.DecodeWithError(response, result, "DepartmentGet"); err != nil {
return nil, err
}
return result, nil
return &result.Department, nil
}

0 comments on commit 9bfebc8

Please sign in to comment.