代码拉取完成,页面将自动刷新
package service
import (
"gitee.com/h79/gothird/weixin/work/access"
"gitee.com/h79/goutils/common/stringutil"
)
type PreAuthCode struct {
Code string `json:"pre_auth_code"`
ExpiresIn int64 `json:"expires_in"`
}
type DealerCorpInfo struct {
CorpId string `json:"corpid"`
CorpName string `json:"corp_name"`
}
type AuthCorpInfo struct {
CorpId string `json:"corpid"`
CorpName string `json:"corp_name"`
CorpType string `json:"corp_type"`
CorpSquareLogoUrl string `json:"corp_square_logo_url"`
CorpUserMax int `json:"corp_user_max"`
CorpFullName string `json:"corp_full_name"`
VerifiedEndTime int64 `json:"verified_end_time"`
SubjectType int `json:"subject_type"`
CorpWxqrcode string `json:"corp_wxqrcode"`
CorpScale string `json:"corp_scale"`
CorpIndustry string `json:"corp_industry"`
CorpSubIndustry string `json:"corp_sub_industry"`
}
// Privilege
// Level 1:通讯录基本信息只读
// 3:通讯录全部信息读写
// 4:单个基本信息只读
type Privilege struct {
Level int `json:"level"`
AllowParty []int64 `json:"allow_party"`
AllowUser []string `json:"allow_user"`
AllowTag []int64 `json:"allow_tag"`
ExtraParty []int64 `json:"extra_party"`
ExtraUser []string `json:"extra_user"`
ExtraTag []int64 `json:"extra_tag"`
}
type SharedFrom struct {
CorpId string `json:"corpid"`
ShareType int `json:"share_type"`
}
type Agent struct {
AgentId int64 `json:"agentid"`
Name string `json:"name"`
RoundLogoUrl string `json:"round_logo_url"`
SquareLogoUrl string `json:"square_logo_url"`
Appid int64 `json:"appid"` //旧的多应用套件中的对应应用id,新开发者请忽略
AuthMode int `json:"auth_mode,omitempty"`
IsCustomizedApp bool `json:"is_customized_app,omitempty"`
AuthFromThirdApp bool `json:"auth_from_thirdapp,omitempty"`
Privilege Privilege `json:"privilege,omitempty"`
SharedFrom SharedFrom `json:"shared_from"`
}
type AuthInfo struct {
Agent []Agent `json:"agent"`
}
type AuthUserInfo struct {
Userid string `json:"userid"`
OpenUserid string `json:"open_userid"`
Name string `json:"name"`
Avatar string `json:"avatar"`
}
type RegisterCodeInfo struct {
RegisterCode string `json:"register_code"`
TemplateId string `json:"template_id"`
State string `json:"state"`
}
// 不同于自建应用开发模式,secret由企业管理员登录管理端获取,代开发的自建应用secret获取方式如下:
//(1)企业管理员扫代开发模版授权码时,授权完成后会推送授权成功通知到应用代开发模版回调url。
//(2)收到回调后,开发者通过获取企业永久授权码接口获取到的permanent_code,即为代开发应用的secret。
//(注意:此种情况获取企业永久授权码接口会多返回is_customized_app字段,且值为true,表示是代开发模版授权,另外接口不返回access_token字段)。
type Permanent struct {
access.PermanentAccessToken
PermanentInfo
}
type PermanentInfo struct {
PermanentCode string `json:"permanent_code"`
DealerCorpInfo DealerCorpInfo `json:"dealer_corp_info"`
AuthCorpInfo AuthCorpInfo `json:"auth_corp_info"`
AuthInfo AuthInfo `json:"auth_info"`
AuthUserInfo AuthUserInfo `json:"auth_user_info"`
RegisterCodeInfo RegisterCodeInfo `json:"register_code_info"`
State string `json:"state"`
}
// IsCustomizedApp 是否为代开发自建应用,另外接口不返回access_token字段
// 授权的应用信息,注意是一个数组,但仅旧的多应用套件授权时会返回多个agent,对新的单应用授权,永远只返回一个agent
func (p PermanentInfo) IsCustomizedApp() bool {
if len(p.AuthInfo.Agent) <= 0 {
return false
}
return p.AuthInfo.Agent[0].IsCustomizedApp
}
func (p PermanentInfo) AgentId() string {
if len(p.AuthInfo.Agent) <= 0 {
return ""
}
return stringutil.Int64ToString(p.AuthInfo.Agent[0].AgentId)
}
func (p PermanentInfo) AgentName() string {
if len(p.AuthInfo.Agent) == 0 {
return ""
}
return p.AuthInfo.Agent[0].Name
}
func (p PermanentInfo) Agent() Agent {
if len(p.AuthInfo.Agent) == 0 {
return Agent{}
}
return p.AuthInfo.Agent[0]
}
type AdminInfo struct {
Userid string `json:"userid"`
OpenUserid string `json:"open_userid,omitempty"`
AuthType int `json:"auth_type"`
}
type AdminList struct {
Admins []AdminInfo `json:"admin"`
}
type QRCodeReq struct {
SuiteId string `json:"suite_id"` //第三方应用id
State string `json:"state"` //state值,用于区分不同的安装渠道,可以填写a-zA-Z0-9,长度不可超过32个字节,默认为空。扫应用带参二维码授权安装后,获取企业永久授权码接口会返回该state值
Appid int64 `json:"appid,omitempty"`
Style int `json:"style"` //二维码样式选项,默认为不带说明外框小尺寸。0:带说明外框的二维码,适合于实体物料,1:带说明外框的二维码,适合于屏幕类,2:不带说明外框(小尺寸),3:不带说明外框(中尺寸),4:不带说明外框(大尺寸)。具体样式与服务商管理端获取到的应用二维码样式一一对应,参见下文二维码样式说明
ResultType int `json:"result_type"` //结果返回方式,默认为返回二维码图片buffer。1:二维码图片buffer,2:二维码图片url
}
type CustomizedAuthUrl struct {
QrcodeUrl string `json:"qrcode_url"`
ExpiresIn int `json:"expires_in"`
}
type UserInfo3rd struct {
CorpId string `json:"corpid"`
Userid string `json:"userid"`
UserTicket string `json:"user_ticket"`
ExpiresIn int64 `json:"expires_in"`
OpenUserid string `json:"open_userid"`
}
type UserDetail3rd struct {
CorpId string `json:"corpid"`
Userid string `json:"userid"`
Name string `json:"name"`
Gender string `json:"gender"`
Avatar string `json:"avatar"`
QrCode string `json:"qr_code"`
}
type LoginInfo struct {
Usertype int `json:"usertype"`
UserInfo AuthUserInfo `json:"user_info"`
CorpInfo AuthCorpInfo `json:"corp_info"`
Agent []LoginAgent `json:"agent"`
AuthInfo LoginAuthInfo `json:"auth_info"`
}
type LoginAgent struct {
AgentId int64 `json:"agentid"`
AuthType int `json:"auth_type"`
}
type LoginDepartment struct {
Id int64 `json:"id"`
Writable bool `json:"writable"`
}
type LoginAuthInfo struct {
Department []LoginDepartment `json:"department"`
}
// 回调接口
// https://developer.work.weixin.qq.com/document/path/90613
const (
KItCreateAuth = "create_auth"
KItChangeAuth = "change_auth"
KItCancelAuth = "cancel_auth"
KItChangeContact = "change_contact"
KItShareAgentChange = "share_agent_change"
KItResetPermanentCode = "reset_permanent_code"
)
// SuiteTicketNotify 推送suite_ticket
type SuiteTicketNotify struct {
SuiteId string `json:"SuiteId" xml:"SuiteId"`
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
SuiteTicket string `json:"SuiteTicketNotify" xml:"SuiteTicketNotify"`
}
// AuthNotify 授权通知事件
// InfoType = create_auth, change_auth, cancel_auth
type AuthNotify struct {
SuiteId string `json:"SuiteId" xml:"SuiteId"`
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
AuthCode string `json:"AuthCode" xml:"AuthCode"`
State string `json:"State" xml:"State"`
}
// 成员通知事件
// InfoType = change_contact, ChangeType= create_user, update_user,delete_user
const (
KCtCreateUser = "create_user"
KCtUpdateUser = "update_user"
KCtDeleteUser = "delete_user"
)
type ContactNotify struct {
SuiteId string `json:"SuiteId" xml:"SuiteId"`
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
UserID string `json:"UserID" xml:"UserID"`
OpenUserID string `json:"OpenUserID" xml:"OpenUserID"`
Name string `json:"Name" xml:"Name"`
Mobile string `json:"Mobile" xml:"Mobile"`
Position string `json:"Position" xml:"Position"`
BizMail string `json:"BizMail" xml:"BizMail"`
Email string `json:"Email" xml:"Email"`
Avatar string `json:"Avatar" xml:"Avatar"`
Alias string `json:"Alias" xml:"Alias"`
Telephone string `json:"Telephone" xml:"Telephone"`
Gender int `json:"Gender" xml:"Gender"`
MainDepartment int64 `json:"MainDepartment" xml:"MainDepartment"`
Department []int64 `json:"Department" xml:"Department"`
IsLeaderInDept []int `json:"IsLeaderInDept" xml:"IsLeaderInDept"`
DirectLeader []string `json:"DirectLeader" xml:"DirectLeader"`
ExtAttribute []ExtAttribute `json:"ExtAttr" xml:"ExtAttr"`
}
type ExtAttribute struct {
Name string `json:"Name" xml:"Name"`
Type int `json:"Type" xml:"Type"`
}
// 部门通知事件
// InfoType = change_contact, ChangeType = create_party, update_party, delete_party
const (
KCtCreateParty = "create_party"
KCtUpdateParty = "update_party"
KCtDeleteParty = "delete_party"
)
// DepartmentNotify 部门通知事件内容
type DepartmentNotify struct {
SuiteId string `json:"SuiteId" xml:"SuiteId"`
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
Name string `json:"Name" xml:"Name"`
Id int64 `json:"Id" xml:"Id"`
ParentId int64 `json:"ParentId" xml:"ParentId"`
Order int `json:"Order" xml:"Order"`
}
// 成员 标签通知事件
// 回调设置在授权应用可见范围内的标签的变更事件。由第三方应用调用接口触发的标签变更事件不回调给该应用本身。
// InfoType = change_contact, ChangeType = update_tag
const (
KCtUpdateTag = "update_tag"
)
type ContactTagNotify struct {
SuiteId string `json:"SuiteId" xml:"SuiteId"`
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
TagId int64 `json:"TagId" json:"TagId"`
AddUserItems []string `json:"AddUserItems" xml:"AddUserItems"`
DelUserItems []string `json:"DelUserItems" xml:"DelUserItems"`
AddPartyItems []int64 `json:"AddPartyItems" xml:"AddPartyItems"`
DelPartyItems []int64 `json:"DelPartyItems" xml:"DelPartyItems"`
}
const (
KLICUnlicensed = "unlicensed_notify" //接口许可失效通知
KLICPaySuccess = "license_pay_success"
)
// OrderSuccessNotify 订单支付成功
// InfoType = license_pay_success
type OrderSuccessNotify struct {
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
ServiceCorpId string `json:"ServiceCorpId" xml:"ServiceCorpId"`
OrderId string `json:"OrderId" xml:"OrderId"`
BuyerUserId string `json:"BuyerUserId" xml:"BuyerUserId"`
}
const (
KLICRefund = "license_refund"
)
// OrderRefundNotify 退款结果通知
// InfoType = license_refund
type OrderRefundNotify struct {
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
ServiceCorpId string `json:"ServiceCorpId" xml:"ServiceCorpId"`
OrderId string `json:"OrderId" xml:"OrderId"`
OrderStatus int `json:"OrderStatus" xml:"OrderStatus"`
}
const (
KLICAutoActive = "auto_activate"
)
// ActiveNotify 自动激活回调通知
// InfoType = auto_activate
type ActiveNotify struct {
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
ServiceCorpId string `json:"ServiceCorpId" xml:"ServiceCorpId"`
Scene string `json:"Scene" xml:"Scene"`
AccountList []AccountList `json:"AccountList" xml:"AccountList"`
}
type AccountList struct {
ActiveCode string `json:"ActiveCode" xml:"ActiveCode"`
UserId string `json:"UserId" xml:"UserId"`
PreviousActiveCode string `json:"PreviousActiveCode" xml:"PreviousActiveCode"`
ExpireTime int64 `json:"ExpireTime" xml:"ExpireTime"`
Type int `json:"Type" xml:"Type"`
PreviousStatus int `json:"PreviousStatus" xml:"PreviousStatus"`
}
// 客户事件通知
const (
KECChangeExternalContact = "change_external_contact"
//ChangeType 值
KECAddExternalContact = "add_external_contact" //添加企业客户事件
KECEditExternalContact = "edit_external_contact" //编辑企业客户事件
KECAddHalfExternalContact = "add_half_external_contact" //外部联系人免验证添加成员事件
KECDeleteExternalContact = "del_external_contact" //删除企业客户事件
KECDeleteFollowUser = "del_follow_user" //删除跟进成员事件
KECTransferFail = "transfer_fail" //客户接替失败事件
)
type ExternalContactNotify struct {
SuiteId string `json:"SuiteId" xml:"SuiteId"`
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
UserID string `json:"UserID" xml:"UserID"`
ExternalUserID string `json:"ExternalUserID" xml:"ExternalUserID"`
State string `json:"State" xml:"State"` //添加此用户的「联系我」方式配置的state参数,可用于识别添加此用户的渠道
WelcomeCode string `json:"WelcomeCode" xml:"WelcomeCode"`
FailReason string `json:"FailReason" xml:"FailReason"` //transfer_fail
}
//客户群变更事件
const (
KECChangeExternalChat = "change_external_chat"
KECCreate = "create"
KECUpdate = "update"
KECDismiss = "dismiss"
KECDelete = "delete"
KECShuffle = "shuffle" //重排 for tag
)
type ExternalChatNotify struct {
SuiteId string `json:"SuiteId" xml:"SuiteId"`
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
ChatId string `json:"ChatId" xml:"ChatId"`
UpdateDetail string `json:"UpdateDetail" xml:"UpdateDetail"`
JoinScene string `json:"JoinScene" xml:"JoinScene"`
QuitScene string `json:"QuitScene" xml:"QuitScene"`
MemChangeCnt string `json:"MemChangeCnt" xml:"MemChangeCnt"`
}
//UpdateDetail 变更详情。目前有以下几种:
//add_member : 成员入群
//del_member : 成员退群
//change_owner : 群主变更
//change_name : 群名变更
//change_notice : 群公告变更
//JoinScene 当是成员入群时有值。表示成员的入群方式
//0 - 由成员邀请入群(包括直接邀请入群和通过邀请链接入群)
//3 - 通过扫描群二维码入群
//QuitScene 当是成员退群时有值。表示成员的退群方式
//0 - 自己退群
//1 - 群主/群管理员移出
//MemChangeCnt 当是成员入群或退群时有值。表示成员变更数量
// 企业客户标签事件
const (
KECChangeExternalTag = "change_external_tag"
)
type ExternalTagNotify struct {
SuiteId string `json:"SuiteId" xml:"SuiteId"`
AuthCorpId string `json:"AuthCorpId" xml:"AuthCorpId"`
Id string `json:"Id" xml:"Id"`
TagType string `json:"TagType" xml:"TagType"`
}
type SessionInfo struct {
AuthType int `json:"auth_type"`
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。