Commit f4037ae784eeff8fa16ea094fef2ead918cae263
Committed by
lanrion
1 parent
6bd96972
Exists in
master
Lester feature department (#25)
* 管理素材API bug修改 * 部门创建的时候可以指定id 不指定则自动生成
Showing
2 changed files
with
4 additions
and
2 deletions
Show diff stats
README.md
... | ... | @@ -81,7 +81,7 @@ group_client = QyWechatApi::Client.new(corpid, corpsecret, options) |
81 | 81 | ## 部门 |
82 | 82 | |
83 | 83 | ```ruby |
84 | -group_client.department.create(name, parent_id, order=nil) | |
84 | +group_client.department.create(name, parent_id, order=nil, id=nil) | |
85 | 85 | group_client.department.update(id, name, parent_id, order=nil) |
86 | 86 | group_client.department.delete(id) |
87 | 87 | group_client.department.list | ... | ... |
lib/qy_wechat_api/api/department.rb
... | ... | @@ -7,10 +7,12 @@ module QyWechatApi |
7 | 7 | # name 是 部门名称。长度限制为1~64个字符 |
8 | 8 | # parentid 是 父亲部门id。根部门id为1 |
9 | 9 | # order 否 在父部门中的次序。从1开始,数字越大排序越靠后 |
10 | - def create(name, parent_id, order=nil) | |
10 | + # id 否 部门id,整型。指定时必须大于1,不指定时则自动生成 | |
11 | + def create(name, parent_id, order=nil, id=nil) | |
11 | 12 | payload = {name: name} |
12 | 13 | payload[:parentid] = parent_id |
13 | 14 | payload[:order] = order if not order.nil? |
15 | + payload[:id] = id if id.is_a?( Integer ) && id > 1 | |
14 | 16 | http_post("create", payload) |
15 | 17 | end |
16 | 18 | ... | ... |