Skip to content

Commit 21659cc

Browse files
committed
Merge branch 'release/v0.1.1'
2 parents 1d9460d + 98bc4d0 commit 21659cc

File tree

20 files changed

+143
-67
lines changed

20 files changed

+143
-67
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ branches:
1515
cache:
1616
- $GOPATH/pkg/dep
1717
before_install:
18-
- if [[ "$TRAVIS_GO_VERSION" != "1.13.x" ]]; then go get -u -v github.com/golang/dep/cmd/dep ; fi
18+
- export GO111MODULE=on
1919
- go get -u -v honnef.co/go/tools/cmd/staticcheck
2020
install:
21-
- if [[ "$TRAVIS_GO_VERSION" != "1.13.x" ]]; then dep ensure -v ; fi
2221
- go install -v ./...
2322
script:
2423
- ./ci/run-lint.sh

Gopkg.toml

Lines changed: 0 additions & 46 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ in at least 2 of Qiniu's internal systems.
7474
- [ ] 删除成员
7575
- [ ] 批量删除成员
7676
- [ ] 获取部门成员
77-
- [ ] 获取部门成员详情
77+
- [x] 获取部门成员详情
7878
- [ ] userid与openid互换
7979
- [ ] 二次验证
8080
- [ ] 邀请成员

apis.md.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package commands
2+
3+
import (
4+
"errors"
5+
"fmt"
6+
"strconv"
7+
8+
"gopkg.in/urfave/cli.v2"
9+
)
10+
11+
func cmdUserListByDept(c *cli.Context) error {
12+
cfg := mustGetConfig(c)
13+
haveID := c.Args().Len() > 0
14+
if !haveID {
15+
return errors.New("no department ID given")
16+
}
17+
18+
deptIDStr := c.Args().Get(0)
19+
deptID, err := strconv.ParseInt(deptIDStr, 10, 64)
20+
if err != nil {
21+
fmt.Printf("invalid department ID: %+v\n", err)
22+
return err
23+
}
24+
25+
app := cfg.MakeWorkwxApp()
26+
// TODO: failed requests currently panics
27+
// TODO: fetchChild
28+
info, err := app.ListUsersByDeptID(deptID, false)
29+
30+
if err != nil {
31+
fmt.Printf("error = %+v\n", err)
32+
} else {
33+
fmt.Printf("users in dept ID %d:\n\n", deptID)
34+
for _, user := range info {
35+
fmt.Printf(" %+v\n", user)
36+
}
37+
}
38+
39+
return err
40+
}

cmd/workwxctl/commands/decl.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ func InitApp() *cli.App {
4242
Usage: "读取成员",
4343
Action: cmdUserGet,
4444
},
45+
{
46+
Name: "user-list-by-dept",
47+
Usage: "获取部门成员详情",
48+
Action: cmdUserListByDept,
49+
},
4550
{
4651
Name: "dept-list",
4752
Usage: "获取部门列表",

dept_info.md.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/apis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Name|Request Type|Response Type|Access Token|URL|Doc
1818
`execUserDelete`|TODO|TODO|+|`GET /cgi/bin/user/delete`|[删除成员](https://work.weixin.qq.com/api/doc#90000/90135/90198)
1919
`execUserBatchDelete`|TODO|TODO|+|`POST /cgi/bin/user/batchdelete`|[批量删除成员](https://work.weixin.qq.com/api/doc#90000/90135/90199)
2020
`execUserSimpleList`|TODO|TODO|+|`GET /cgi-bin/user/simplelist`|[获取部门成员](https://work.weixin.qq.com/api/doc#90000/90135/90200)
21-
`execUserList`|TODO|TODO|+|`GET /cgi-bin/user/list`|[获取部门成员详情](https://work.weixin.qq.com/api/doc#90000/90135/90201)
21+
`execUserList`|`reqUserList`|`respUserList`|+|`GET /cgi-bin/user/list`|[获取部门成员详情](https://work.weixin.qq.com/api/doc#90000/90135/90201)
2222
`execUserConvertToOpenID`|TODO|TODO|+|`POST /cgi-bin/user/convert_to_openid`|[userid与openid互换](https://work.weixin.qq.com/api/doc#90000/90135/90202)
2323
`execUserAuthSucc`|TODO|TODO|+|`GET /cgi-bin/user/authsucc`|[二次验证](https://work.weixin.qq.com/api/doc#90000/90135/90203)
2424
`execUserBatchInvite`|TODO|TODO|+|`POST /cgi-bin/batch/invite`|[邀请成员](https://work.weixin.qq.com/api/doc#90000/90135/90975)

docs/dept_info.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ Name|JSON|Type|Doc
88
:---|:---|:---|:--
99
`ID`|`id`|`int64`|部门 ID
1010
`Name`|`name`|`string`|部门名称
11-
`ParentID`|`parent_id`|`int64`|父亲部门id。根部门为1
11+
`ParentID`|`parentid`|`int64`|父亲部门id。根部门为1
1212
`Order`|`order`|`uint32`|在父部门中的次序值。order值大的排序靠前。值范围是[0, 2^32)

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ go 1.12
44

55
require (
66
github.com/cenkalti/backoff v2.2.1+incompatible
7+
github.com/russross/blackfriday v2.0.0+incompatible
8+
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
9+
github.com/smartystreets/goconvey v1.6.4
710
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80
811
gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8
912
)

0 commit comments

Comments
 (0)