Documentation ¶
Index ¶
- Variables
- func ApplyChatRoomKicking(relationSerialNo, robotSerialNo, wxUserSerialNo, comment string, ...) error
- func ApplyChatRoomQrCode(chatRoomSerialNo string, client *UchatClient) error
- func ApplyRobotAddUser(robotSerialNo, userWexinId string, client *UchatClient) error
- func GetInt32(v map[string]interface{}, key string) int32
- func GetKey(v map[string]interface{}, key string) interface{}
- func GetString(v map[string]interface{}, key string) string
- func SetChatRoomCloseGetMessage(chatRoomSerialNo string, client *UchatClient) error
- func SetChatRoomOpenGetMessage(chatRoomSerialNo string, client *UchatClient) error
- func SetChatRoomOver(chatRoomSerialNo, comment string, client *UchatClient) error
- func SetTimeZone(zone string) error
- type UchatClient
- func (c *UchatClient) Action(action string, ctx interface{}) ([]byte, error)
- func (c *UchatClient) AddNewChatRooms(ctx map[string]string) error
- func (c *UchatClient) ApplyCodeList(ctx map[string]string) ([]map[string]string, error)
- func (c *UchatClient) ChatRoomAdminChange(ctx map[string]string) error
- func (c *UchatClient) ChatRoomCloseGetMessages(ctx map[string]string) error
- func (c *UchatClient) ChatRoomInfoModify(ctx map[string]string) error
- func (c *UchatClient) ChatRoomKicking(ctx map[string]interface{}) error
- func (c *UchatClient) ChatRoomList(ctx map[string]string) ([]map[string]string, error)
- func (c *UchatClient) ChatRoomOpenGetMessages(ctx map[string]string) error
- func (c *UchatClient) ChatRoomOver(ctx map[string]string) error
- func (c *UchatClient) ChatRoomRobotNickNameModify(ctx map[string]string) error
- func (c *UchatClient) ChatRoomStatus(ctx map[string]string) (map[string]interface{}, error)
- func (c *UchatClient) ChatRoomUserInfo(ctx map[string]string) error
- func (c *UchatClient) ChatRoomUserMatch(ctx map[string]string) ([]map[string]string, error)
- func (c *UchatClient) ChatRoomWelcomeMsgConfig(ctx map[string]string) error
- func (c *UchatClient) Do(req *http.Request) (*http.Response, error)
- func (c *UchatClient) GetQrCode(ctx map[string]string) error
- func (c *UchatClient) MerchantCmd(ctx map[string]interface{}) error
- func (c *UchatClient) MerchantSendMessages(ctx map[string]interface{}) error
- func (c *UchatClient) PullRobotInChatRoomOpenChatRoom(ctx map[string]string) ([]map[string]string, error)
- func (c *UchatClient) RobotAddUser(ctx map[string]string) error
- func (c *UchatClient) RobotGroupInsert(ctx map[string]string) (string, error)
- func (c *UchatClient) RobotGroupOpenChatRoom(ctx map[string]string) error
- func (c *UchatClient) RobotInfoModify(ctx map[string]string) error
- func (c *UchatClient) RobotList() ([]map[string]interface{}, error)
- func (c *UchatClient) Scan(resp *http.Response, err error) ([]byte, error)
- func (c *UchatClient) ScanGlobalResultList(key string, data []byte, err error) ([]map[string]string, error)
- func (c *UchatClient) ScanGlobalResultListV2(key string, data []byte, err error) ([]map[string]interface{}, error)
- func (c *UchatClient) SendMessage(ctx map[string]interface{}) error
- func (c *UchatClient) SendPrivateChatMessages(ctx map[string]interface{}) error
- func (c *UchatClient) Sign(strCtx string) string
- type UchatClientGlobalResultList
- type UchatClientResult
- type UchatKeyword
- type UchatMemberJoin
- type UchatMemberQuit
- type UchatMessage
- type UchatRobotChatJoin
Constants ¶
This section is empty.
Variables ¶
var ( //UchatApiPrefix string = "http://skyagent.shequnguanjia.com/Merchant.asmx" //接口地址 UchatApiPrefix string = "https://skyagent.evmai.cn:8081/Merchant.asmx" //接口地址 UchatTimeZone string = "Asia/Shanghai" //时区设置 UchatTimeLocation *time.Location //当前时区 DefaultTransportInsecureSkipVerify bool = true DefaultTransportDisableCompression bool = true )
Functions ¶
func ApplyChatRoomKicking ¶
func ApplyChatRoomKicking(relationSerialNo, robotSerialNo, wxUserSerialNo, comment string, client *UchatClient) error
func ApplyChatRoomQrCode ¶
func ApplyChatRoomQrCode(chatRoomSerialNo string, client *UchatClient) error
func ApplyRobotAddUser ¶
func ApplyRobotAddUser(robotSerialNo, userWexinId string, client *UchatClient) error
func SetChatRoomCloseGetMessage ¶
func SetChatRoomCloseGetMessage(chatRoomSerialNo string, client *UchatClient) error
群内时时消息关闭设置
func SetChatRoomOpenGetMessage ¶
func SetChatRoomOpenGetMessage(chatRoomSerialNo string, client *UchatClient) error
群内时时消息开启设置
func SetChatRoomOver ¶
func SetChatRoomOver(chatRoomSerialNo, comment string, client *UchatClient) error
关群调用
Types ¶
type UchatClient ¶
type UchatClient struct { ApiPrefix string //API MarchantNo string //商户号 MarchantSecret string //商户密钥 Error error //最后一次错误 DefaultTimeout time.Duration //默认请求超时 }
小U机器客户端
func NewClient ¶
func NewClient(marchantNo, marchantSecret string) *UchatClient
初始化一个新的实例 client := NewClient("marchantNo", "secret") OR: uchatlib.DefaultTimeout = 30 * time.Second client := NewClient("marchantNo", "secret")
func (*UchatClient) Action ¶
func (c *UchatClient) Action(action string, ctx interface{}) ([]byte, error)
发送动作 b, err := client.Action("RobotList", nil) OR: ctx := make(map[string]string, 0) ctx["vcRobotSerialNo"] = "xxxxx" b, err := client.Action("ChatRoomList", ctx)
func (*UchatClient) AddNewChatRooms ¶
func (c *UchatClient) AddNewChatRooms(ctx map[string]string) error
批量建群开群接口 商家通过在建群宝首页上注册一个账户,之后会获得一个UserID,商家需要将建群宝的UserID填写好,去调用“批量建群开群接口”。可以进行建群并开群。
func (*UchatClient) ApplyCodeList ¶
获取机器人验证码接口 商家可通过该接口获取机器人的信息以及开群验证码,通过扫码添加好友后开群。(注:机器人只有以扫码方式申请添加好友才会自动通过,以其他方式添加好友则不会通过。)
func (*UchatClient) ChatRoomAdminChange ¶
func (c *UchatClient) ChatRoomAdminChange(ctx map[string]string) error
转让群主接口 当机器人为群主时,可以通过调用这个接口,将群主转让给指定的群成员。
func (*UchatClient) ChatRoomCloseGetMessages ¶
func (c *UchatClient) ChatRoomCloseGetMessages(ctx map[string]string) error
关闭群内实时消息 商家可通过“关闭群内实时消息接口”关闭对群内实时聊天信息的抓取,关闭后,群内聊天信息不再发送给商家。
func (*UchatClient) ChatRoomInfoModify ¶
func (c *UchatClient) ChatRoomInfoModify(ctx map[string]string) error
修改群资料接口 当调用这个接口的时候,我们可以通过机器人来对群设置群名称、群公告和群聊邀请确认开关。注意点:除修改群名称时100人以下的群不需要机器人是群主外,其他情况都需要机器人是群主。
func (*UchatClient) ChatRoomKicking ¶
func (c *UchatClient) ChatRoomKicking(ctx map[string]interface{}) error
群内踢人接口 当机器人为群主时,群内有群成员因为特殊原因需要被请出群外时,商家调用这个接口,然后机器人会主动帮忙踢出这个人。
func (*UchatClient) ChatRoomList ¶
查询机器人已开通群接口 商家可通过该接口查询机器人已开通的群,包含群名称、群编号、群主编号等。
func (*UchatClient) ChatRoomOpenGetMessages ¶
func (c *UchatClient) ChatRoomOpenGetMessages(ctx map[string]string) error
开启群内实时消息 商家可通过“开启群内实时消息”的接口选择需要实时抓取聊天信息的群。
func (*UchatClient) ChatRoomOver ¶
func (c *UchatClient) ChatRoomOver(ctx map[string]string) error
群注销接口 当需要注销已经开通了的群时,商家可直接调用群注销接口注销,群注销后,机器人会退出群聊,同时相应的机器人可开群的权限增加一个。
func (*UchatClient) ChatRoomRobotNickNameModify ¶
func (c *UchatClient) ChatRoomRobotNickNameModify(ctx map[string]string) error
修改群内机器人昵称接口 可以通过修改群内机器人昵称对群内机器人的昵称进行修改。
func (*UchatClient) ChatRoomStatus ¶
func (c *UchatClient) ChatRoomStatus(ctx map[string]string) (map[string]interface{}, error)
查询群状态接口 商家通过机器人提供的“查询群状态的接口”可以实时的知道所需要知道群的状态和机器人状态,也就是目前群是否还存在,机器人是否还工作。
func (*UchatClient) ChatRoomUserInfo ¶
func (c *UchatClient) ChatRoomUserInfo(ctx map[string]string) error
获取群成员信息 商家可以通过机器人所提供的“群成员信息接口”可以了解到群成员信息列表。
func (*UchatClient) ChatRoomUserMatch ¶
群成员匹配 商家可以通过机器人所提供的“群成员匹配接口”与自身的会员系统打通,对群成员进行管理。
func (*UchatClient) ChatRoomWelcomeMsgConfig ¶
func (c *UchatClient) ChatRoomWelcomeMsgConfig(ctx map[string]string) error
入群欢迎语接口 当群内有新成员加加入的时候,APP会自动发送入群欢迎语。当商户设置入群欢迎语以后,设置的信息会作为群信息同步到APP。
func (*UchatClient) MerchantCmd ¶
func (c *UchatClient) MerchantCmd(ctx map[string]interface{}) error
群内关键字设置接口 商家通过该接口设置关键字,当群内有成员发送的消息触发了关键词时,会通过【群内关键字触发消息回调接口】将发言成员信息与发言内容通知给商家。
func (*UchatClient) MerchantSendMessages ¶
func (c *UchatClient) MerchantSendMessages(ctx map[string]interface{}) error
群内消息发送接口 通过机器人在群内发送信息,可支持直接群发,@all群发和@单个人或多人群发。
func (*UchatClient) PullRobotInChatRoomOpenChatRoom ¶
func (c *UchatClient) PullRobotInChatRoomOpenChatRoom(ctx map[string]string) ([]map[string]string, error)
批量开群接口 商家通过调用批量开群接口直接开群。
func (*UchatClient) RobotAddUser ¶
func (c *UchatClient) RobotAddUser(ctx map[string]string) error
机器人添加用户好友 商家可以通过机器人所提供的“机器人添加用户好友接口”去让更多的用户去能够添加机器人为好友,方便于群外的私聊信息的发送与朋友圈的推送。
func (*UchatClient) RobotGroupInsert ¶
func (c *UchatClient) RobotGroupInsert(ctx map[string]string) (string, error)
机器人设置分组 将多个机器人设置为一组,用于多号。
func (*UchatClient) RobotGroupOpenChatRoom ¶
func (c *UchatClient) RobotGroupOpenChatRoom(ctx map[string]string) error
机器人组开群接口 商家通过调用机器人组开群接口开群,并将其他两个机器人拉入群中,用于多号。
func (*UchatClient) RobotInfoModify ¶
func (c *UchatClient) RobotInfoModify(ctx map[string]string) error
机器人信息编辑接口 商家通过机器人信息编辑接口可以对所拥有的机器人进行信息编辑,比如头像、昵称、个人签名等。
func (*UchatClient) RobotList ¶
func (c *UchatClient) RobotList() ([]map[string]interface{}, error)
获取机器人列表接口 可通过该接口获取所购买的机器人列表,包含机器人编号,头像、昵称、状态、已开通群数等。
func (*UchatClient) ScanGlobalResultList ¶
func (c *UchatClient) ScanGlobalResultList(key string, data []byte, err error) ([]map[string]string, error)
审查全局返回结果
func (*UchatClient) ScanGlobalResultListV2 ¶
func (c *UchatClient) ScanGlobalResultListV2(key string, data []byte, err error) ([]map[string]interface{}, error)
审查全局返回结果
func (*UchatClient) SendMessage ¶
func (c *UchatClient) SendMessage(ctx map[string]interface{}) error
todo delete
群推送消息
func (*UchatClient) SendPrivateChatMessages ¶
func (c *UchatClient) SendPrivateChatMessages(ctx map[string]interface{}) error
* 私聊接口
type UchatClientResult ¶
type UchatClientResult struct { Result interface{} `json:"nResult"` //1为成功, -1为失败 Error string `json:"vcResult"` //文字描述 Data interface{} `json:"Data"` //返回结果 }
小U机器接口返回格式
type UchatKeyword ¶
type UchatKeyword struct { MerchantNo string LogSerialNo string ChatRoomSerialNo string FromWxUserSerialNo string ToWxUserSerialNo string Content string ExtraData interface{} //补充数据,并非接口返回 }
keyword model
func ConvertUchatKeyword ¶
func ConvertUchatKeyword(b []byte) ([]*UchatKeyword, error)
type UchatMemberJoin ¶
type UchatMemberJoin struct { MerchantNo string ChatRoomSerialNo string WxUserSerialNo string FatherWxUserSerialNo string WxId string NickName string HeadImages string JoinChatRoomType int32 JoinDate time.Time ExtraData interface{} //补充数据,并非接口返回 }
MemberJoin model todo add more chatroom info
func ConvertUchatMemberJoin ¶
func ConvertUchatMemberJoin(b []byte) ([]*UchatMemberJoin, error)
type UchatMemberQuit ¶
type UchatMemberQuit struct { MerchantNo string ChatRoomSerialNo string WxUserSerialNo string WxId string NickName string QuitDate time.Time ExtraData interface{} //补充数据,并非接口返回 }
MemberQuit model
func ConvertUchatMemberQuit ¶
func ConvertUchatMemberQuit(b []byte) ([]*UchatMemberQuit, error)
type UchatMessage ¶
type UchatMessage struct { MerchantNo string // 商户号 MsgId string //【微信】消息ID LogSerialNo string // [开放平台]消息SN RobotSerialNo string // 设备号 RobotWxId string // 设备微信ID ChatRoomSerialNo string // 群号 ChatRoomId string // 群微信ID WxUserSerialNo string // 发送人号 WeixinId string // 发送人微信ID ToWxUserSerialNo string // 被@用户号 ToWeixinId string // 被@用户微信ID MsgTime time.Time // 发送时间 MsgType int32 // 消息类型 2001 文字 2002 图片 2003 语音 2004 视频 2005 链接 2006 名片 2007 动态表情 2013 小程序 Content string // 文字、图文链接、名片、小程序(会进行Base64编码);图片、语音、视频、动态表情(不经过Base64编码) VoiceTime int32 // 语音时长 AppId string // 私聊信息里有,未知 PlatformMsgType int32 // 区别用户发言还是机器人发言,10:普通人 12:机器人 IsHit int32 // 是否艾特所有人 (0 艾特群内所有人 1 艾特单个人或者不艾特人) ExtraData interface{} //补充数据,并非接口返回 }
func ConvertUchatMessage ¶
func ConvertUchatMessage(b []byte) ([]*UchatMessage, error)
type UchatRobotChatJoin ¶
type UchatRobotChatJoin struct { MerchantNo string LogSerialNo string RobotSerialNo string ChatRoomSerialNo string ChatRoomNickName string ChatRoomBase64NickName string WxUserSerialNo string WxUserNickName string WxUserBase64NickName string WxUserHeadImgUrl string JoinDate time.Time ExtraData interface{} //补充数据,并非接口返回 }
机器人入群model
func ConverUchatRobotChatJoin ¶
func ConverUchatRobotChatJoin(b []byte) ([]*UchatRobotChatJoin, error)