This commit is contained in:
邹宗楠
2022-05-25 16:44:01 +08:00
parent 8e8d03c5fa
commit 8b1f8c79d6
5 changed files with 325 additions and 26 deletions

View File

@@ -10,7 +10,12 @@ const (
WeChatBaseApi = "https://qyapi.weixin.qq.com" // 企业微信基础访问链接
// api接口
GetToken = "cgi-bin/gettoken" // 获取token
GetToken = "cgi-bin/gettoken" // 获取token
CreateAppChat = "cgi-bin/appchat/create" // 创建会话群聊
GetAllDepartmentListById = "cgi-bin/department/list" // 获取所有的部门
CreateBoosToJxStaff = "cgi-bin/user/create" // 将京西老板创建为企业员工
GetDepartmentUserDetail = "cgi-bin/user/list" // 获取部门用户详细情况
GetUserByMobileUrl = "cgi-bin/user/getuserid" // 通过手机号获取用户id
)
// 注册请求api
@@ -24,9 +29,73 @@ type API struct {
config *platformapi.APIConfig
}
// 公共错误码
type PublicCode struct {
ErrCode int `json:"errcode"` // 错误码
ErrMsg string `json:"errmsg"` // 错误消息
// 创建群聊
type CreateAppChatParamReq struct {
UserList []string `json:"userlist"` // 成员列表(至少两个)
Name string `json:"name"` // 群聊名最多50个utf8字符超过将截断
Owner string `json:"owner"` // 群主id
ChatId string `json:"chatid"` // 群聊的唯一标志,不能与已有的群重复
}
// 获取所有的部门
type Department struct {
ID int `json:"id"` // id
Name string `json:"name"` // 名称
ParentId int `json:"parentid"` // 父部门id
Order int `json:"order"` // 排序
DepartmentLeader []string `json:"department_leader"` // 部门负责人的UserID第三方仅通讯录应用可获取
}
type GetAllDepartmentListRes struct {
ErrCode int `json:"errcode"`
ErrMsg string `json:"errmsg"`
Department []*Department `json:"department"`
}
// 错误消息
type Err struct {
ErrCode int `json:"errcode"`
ErrMsg string `json:"errmsg"`
ChatId string `json:"chatid"` // 群聊的唯一标志,不能与已有的群重复
}
// 获取部门全部用户详细信息
type GetEnterpriseStaffInfoRes struct {
ErrCode int `json:"errcode"`
ErrMsg string `json:"errmsg"`
UserList []*UserList `json:"userlist"`
}
type UserList struct {
Userid string `json:"userid"`
Name string `json:"name"`
Department []int `json:"department"`
Position string `json:"position"`
Mobile string `json:"mobile"`
Gender string `json:"gender"`
Email string `json:"email"`
Avatar string `json:"avatar"`
Status int `json:"status"`
Enable int `json:"enable"`
IsLeader int `json:"isleader"`
ExtAttr Extattr `json:"extattr"`
HideMobile int `json:"hide_mobile"`
Telephone string `json:"telephone"`
Order []int `json:"order"`
ExternalProfile ExternalProfile `json:"external_profile"`
MainDepartment int `json:"main_department"`
QrCode string `json:"qr_code"`
Alias string `json:"alias"`
IsLeaderInDept []int `json:"is_leader_in_dept"`
Address string `json:"address"`
ThumbAvatar string `json:"thumb_avatar"`
DirectLeader []string `json:"direct_leader"`
BizMail string `json:"biz_mail"`
}
// 手机号获取用户信息
type GetUserByMobileRes struct {
ErrCode int `json:"errcode"`
ErrMsg string `json:"errmsg"`
UserId string `json:"userid"`
}