Skip to content

Commit

Permalink
接入接口调用许可相关sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
zsmhub committed May 24, 2022
1 parent 30ab3ad commit 7a1938f
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 7 deletions.
6 changes: 3 additions & 3 deletions apis/接口调用许可-下单续期帐号.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type ReqCreateRenewOrderJobLicense struct {
Type int `json:"type"`
// Userid 续期企业的成员userid。只支持加密的userid,必填
Userid string `json:"userid"`
} `json:"account_list"` // 必填,续期的帐号列表,每次最多1000个。同一个jobid最多关联1000000个基础账号跟1000000个互通账号
} `json:"account_list"` // 续期的帐号列表,每次最多1000个。同一个jobid最多关联1000000个基础账号跟1000000个互通账号,必填
// Corpid 企业id,只支持加密的corpid,必填
Corpid string `json:"corpid"`
// Jobid 任务id,若不传则默认创建一个新任务。若指定第一次调用后拿到jobid,可以通过该接口将jobid关联多个userid
Expand Down Expand Up @@ -82,9 +82,9 @@ func (c *ApiClient) ExecCreateRenewOrderJobLicense(req ReqCreateRenewOrderJobLic

type ReqSubmitOrderJobLicense struct {
AccountDuration struct {
// Months 购买的月数,每个月按照31天计算。最多购买36个月。(灰度期间4.11-4.24,最多续期一个月,同一个用户同一个类型激活码灰度期间只能续期一次)。(若企业为服务商测试企业,每一个激活码最多续期一次),必填
// Months 购买的月数,每个月按照31天计算。最多购买36个月。(若企业为服务商测试企业,每次续期只能续期1个月),必填
Months int `json:"months"`
} `json:"account_duration"` // ,必填账号购买时长
} `json:"account_duration"` // 账号购买时长,必填
// BuyerUserid 下单人。服务商企业内成员userid。该userid必须登录过企业微信,并且企业微信已绑定微信,必填
BuyerUserid string `json:"buyer_userid"`
// Jobid 任务id,必填
Expand Down
6 changes: 3 additions & 3 deletions apis/接口调用许可-下单购买帐号.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import (

type ReqCreateNewOrderLicense struct {
AccountCount struct {
// BaseCount 基础帐号个数,最多1000000个
// BaseCount 基础帐号个数,最多1000000个。(若企业为服务商测试企业,最多购买1000个)
BaseCount int `json:"base_count,omitempty"`
// ExternalContactCount 互通帐号个数,最多1000000个
// ExternalContactCount 互通帐号个数,最多1000000个。(若企业为服务商测试企业,最多购买1000个)
ExternalContactCount int `json:"external_contact_count,omitempty"`
} `json:"account_count"` // 账号个数详情,基础账号跟互通账号不能同时为0,必填
AccountDuration struct {
// Months 购买的月数,每个月按照31天计算。最多购买36个月(灰度期间4.11-4.24,最多购买一个月,必填
// Months 购买的月数,每个月按照31天计算。最多购买36个月。(若企业为服务商测试企业,最多购买1个月),必填
Months int `json:"months"`
} `json:"account_duration"` // 帐号购买时长,必填
// BuyerUserid 下单人。服务商企业内成员userid。该userid必须登录过企业微信,并且企业微信已绑定微信。最终也支持由其他人支付,必填
Expand Down
1 change: 1 addition & 0 deletions apis/接口调用许可-获取成员的激活详情.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type RespGetActiveInfoByUserLicense struct {
// Userid 帐号绑定激活的成员userid。返回加密的userid
Userid string `json:"userid"`
} `json:"active_info_list"` // 帐号列表,同一个userid最多有两个帐号:一个基础帐号与一个互通帐号
// ActiveStatus 帐号激活状态。0:未激活、 1:已激活
ActiveStatus int `json:"active_status"`
CommonResp
}
Expand Down
2 changes: 1 addition & 1 deletion apis/接口调用许可-获取订单列表.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// 文档:https://developer.work.weixin.qq.com/document/path/95647#获取订单列表

type ReqListOrderLicense struct {
// Corpid 企业id,只支持加密的corpid
// Corpid 企业id,只支持加密的corpid。若指定corpid且corpid为服务商测试企业,则返回的订单列表为测试订单列表。否则只返回正式订单列表
Corpid string `json:"corpid,omitempty"`
// Cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
Cursor string `json:"cursor,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions callbacks/callback_constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const EventTypeChangeAppAdmin EventType = "change_app_admin"
// 客服消息类型
const EventTypeKefuMsgOrEvent EventType = "kf_msg_or_event"

// 接口许可失效通知
const EventTypeUnlicensedNotify EventType = "unlicensed_notify"

// 推送suite_ticket
const InfoTypeSuiteTicket EventType = "suite_ticket"

Expand Down
56 changes: 56 additions & 0 deletions callbacks/event接口许可失效通知.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package callbacks

import "encoding/xml"

// 自动生成的回调结构,按需修改, 生成方式: make callback doc=微信文档地址url
// 文档: https://developer.work.weixin.qq.com/document/path/95716#接口许可失效通知

func init() {
// 添加可解析的回调事件
supportCallback(EventUnlicensedNotify{})
}

type EventUnlicensedNotify struct {
XMLName xml.Name `xml:"xml"`
Text string `xml:",chardata"`
ToUserName struct {
Text string `xml:",chardata"`
} `xml:"ToUserName"`
FromUserName struct {
Text string `xml:",chardata"`
} `xml:"FromUserName"`
CreateTime struct {
Text string `xml:",chardata"`
} `xml:"CreateTime"`
MsgType struct {
Text string `xml:",chardata"`
} `xml:"MsgType"`
Event struct {
Text string `xml:",chardata"`
} `xml:"Event"`
AgentID struct {
Text string `xml:",chardata"`
} `xml:"AgentID"`
}

func (EventUnlicensedNotify) GetMessageType() string {
return "event"
}

func (EventUnlicensedNotify) GetEventType() string {
return "unlicensed_notify"
}

func (EventUnlicensedNotify) GetChangeType() string {
return ""
}

func (m EventUnlicensedNotify) GetTypeKey() string {
return m.GetMessageType() + ":" + m.GetEventType() + ":" + m.GetChangeType()
}

func (EventUnlicensedNotify) ParseFromXml(data []byte) (CallBackExtraInfoInterface, error) {
var temp EventUnlicensedNotify
err := xml.Unmarshal(data, &temp)
return temp, err
}

0 comments on commit 7a1938f

Please sign in to comment.