From 9bfebc8a27f79b00a39b362a84e6cf08a96a9c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E6=99=B6?= Date: Mon, 25 Sep 2023 14:15:33 +0800 Subject: [PATCH] fix(work): fix DepartmentGet with commonError is invalid or not struct (#728) fix DepartmentGet with commonError is invalid or not struct --- work/addresslist/department.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/work/addresslist/department.go b/work/addresslist/department.go index 7423bba..dc773dc 100644 --- a/work/addresslist/department.go +++ b/work/addresslist/department.go @@ -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 创建部门 @@ -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 }