uchat

package
v0.0.0-...-b925956 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2019 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReceiveMQMemberList          = "uchat.member.list"           //用户列表
	ReceiveMQMemberJoin          = "uchat.member.join"           //用户入群
	ReceiveMQMemberQuit          = "uchat.member.quit"           //用户群群
	ReceiveMQMemberMessageSum    = "uchat.member.message.sum"    //用户发言总数
	ReceiveMQRobotChatList       = "uchat.robot.chat.list"       //设备所开群列表
	ReceiveMQRobotJoinChat       = "uchat.robot.chat.join"       //设备开群信息
	ReceiveMQRobotPrivateMessage = "uchat.robot.message.private" //设备私聊
	ReceiveMQChatKeyword         = "uchat.chat.keyword"          //群关键字
	ReceiveMQChatCreate          = "uchat.chat.create"           //建群
	ReceiveMQChatMessage         = "uchat.chat.message"          //群聊天记录
	ReceiveMQChatRedpack         = "uchat.chat.redpack"          //群红包记录
)

小U机器回调队列配置

View Source
var (
	DefaultChatRoomHeadImageBackgroundColor color.RGBA = color.RGBA{222, 222, 222, 0}
	DefaultChatRoomHeadSizeUnit             int        = 132
	DefaultChatRoomHeadPadding              int        = 12
)
View Source
var (
	DefaultMemberJoinWelcome      string        = ""
	DefaultMemberJoinSendInterval time.Duration = 60 * time.Second
	HashID                        *hashids.HashID
	UseWorkTemplate               bool = false
)
View Source
var (
	AllowMultiTemplatesCmdType []string = []string{
		"shop.custom.keyword.reply",
	}
)
View Source
var Shorten *shorten.T

Functions

func AllowKeysInterfaceMarshal

func AllowKeysInterfaceMarshal(input interface{}, keys []string) ([]byte, error)

func ApplyChatRoomTemplate

func ApplyChatRoomTemplate(db *gorm.DB, myId, subId, workTemplateId string, chatRoomList []string) (data interface{}, err error)

func CheckCmdUseWechatMini

func CheckCmdUseWechatMini(m *models.MyCmd) bool

func CountWorkTemplateChatRoom

func CountWorkTemplateChatRoom(db *gorm.DB, myId, subId, cmdType string) error

func CreateWorkTemplate

func CreateWorkTemplate(db *gorm.DB, myId, subId, name, cmdType, cmdValue, cmdParams, cmdReply string, status int8) (ret *models.WorkTemplate, err error)

func EventChatRoomCreate

func EventChatRoomCreate(v *models.RobotChatRoom, publisher *rmqtool.PublisherTool) error

func FetchAlimamaSearchPid

func FetchAlimamaSearchPid(myId, subId string, db *gorm.DB) (string, error)

获取淘宝联盟广告位pid

func FetchChatRoomCustomKeywordReplyTemplate

func FetchChatRoomCustomKeywordReplyTemplate(db *gorm.DB, chatRoomSerialNo, msg string, org map[string]interface{}) ([]map[string]interface{}, error)

获取商家自定义关键词回复模板

func FetchChatRoomIntelligentChatTemplate

func FetchChatRoomIntelligentChatTemplate(db *gorm.DB, chatRoomSerialNo string, msgDate time.Time) (*models.WorkTemplate, error)

func FetchChatRoomMemberJoinMessage

func FetchChatRoomMemberJoinMessage(charRoomSerialNo string, db *gorm.DB) string

获取入群欢迎通知

func FetchChatRoomMemberJoinMessageTemplate

func FetchChatRoomMemberJoinMessageTemplate(db *gorm.DB, chatRoomSerialNo string) (string, time.Duration)

func FetchTuikeasySearchDomain

func FetchTuikeasySearchDomain(myId, subId string, db *gorm.DB) (string, error)

获取淘宝联盟广告位pid

func FetchTulingResult

func FetchTulingResult(key, secret string, context map[string]interface{}, chat_room_serial_no string, db, managerDB *gorm.DB) ([]map[string]string, error)

func FixUchatJsonBinary

func FixUchatJsonBinary(b []byte) []byte

小U的回调有时候会有换行符 \n,导致json decode失败,此方法兼容这个问题

func FixWechatMiniGroupContext

func FixWechatMiniGroupContext(text, webviewUrl string) string

func FixWechatMiniGroupMessageQueue

func FixWechatMiniGroupMessageQueue(chatRoomSerialNo, text, webviewUrl, img string) *models.MessageQueue

func GenerateTuikeasyProductCouponSearchByChatRoomSerialNo

func GenerateTuikeasyProductCouponSearchByChatRoomSerialNo(chat_room_serial_no string, db *gorm.DB, managerDB *gorm.DB) (string, error)

func GenerateTuikeasyProductSearchContent

func GenerateTuikeasyProductSearchContent(myId, domain, content string, db *gorm.DB) (string, error)

func GenerateTuikeasyProductSearchContentByKeyword

func GenerateTuikeasyProductSearchContentByKeyword(chat_room_serial_no, key string, db *gorm.DB, managerDB *gorm.DB) (string, error)

func GenerateTuikeasyProductSearchTextUrl

func GenerateTuikeasyProductSearchTextUrl(myId, domain, content string, db *gorm.DB) (*models.MyCmd, string, string, error)

func GenerateTuikeasyProductSearchTextUrlByKeyword

func GenerateTuikeasyProductSearchTextUrlByKeyword(chat_room_serial_no, key string, db *gorm.DB, managerDB *gorm.DB) (string, string, error)

func GenerateTuikeasyProductSearchUrl

func GenerateTuikeasyProductSearchUrl(domain, key string) string

func GetChatRoomHeadImage

func GetChatRoomHeadImage(db *gorm.DB, chatRoomSerialNo string, limit int) (io.Reader, error)

func GetChatRoomTemplate

func GetChatRoomTemplate(db *gorm.DB, myId, subId, workTemplateId string) (list *[]models.ChatRoomWorkTemplate, err error)

func GetChatRoomTemplates

func GetChatRoomTemplates(db *gorm.DB, chat_room_serial_no string) (data interface{}, err error)

func GetChatRoomValidTemplate

func GetChatRoomValidTemplate(db *gorm.DB, chat_room_serial_no, cmd_type string) (data *models.WorkTemplate, err error)

func GetChatRoomValidTemplates

func GetChatRoomValidTemplates(db *gorm.DB, chat_room_serial_no, cmd_type string) (data []models.WorkTemplate, err error)

func GetCmdType

func GetCmdType(db *gorm.DB, typeFlag string) (ret *models.CmdType, err error)

func GetWorkTemplate

func GetWorkTemplate(db *gorm.DB, workTemplateId string) (ret interface{}, err error)

func InitHashIds

func InitHashIds(salt string, minLen int)

初始化hashids

func ListCmdType

func ListCmdType(db *gorm.DB) (list *[]models.CmdType, err error)

func ListWorkTemplate

func ListWorkTemplate(db *gorm.DB, myId, subId, cmdType string) (list *[]models.WorkTemplate, err error)

func SendAlimamCouponSearch

func SendAlimamCouponSearch(myId, pid, chatRoomSerialNo, content string, db *gorm.DB) error

获取淘宝联盟优惠信息

func SendAlimamProductSearch

func SendAlimamProductSearch(myId, pid, chatRoomSerialNo, content string, db *gorm.DB) error

获取淘宝联盟产品搜索信息

func SendChatRoomMemberTextMessage

func SendChatRoomMemberTextMessage(charRoomSerialNo, wxSerialNo, msg string, db, managerDB *gorm.DB) error

发送群内信息

func SendShopCustomSearch

func SendShopCustomSearch(myId, subId, chatRoomSerialNo, content string, db *gorm.DB) error

func SendTuikeasyCouponSearch

func SendTuikeasyCouponSearch(myId, domain, chatRoomSerialNo, content string, db *gorm.DB) error

func SendTuikeasyProductSearch

func SendTuikeasyProductSearch(myId, domain, chatRoomSerialNo, content string, db *gorm.DB) error

func SetDefaultWorkTemplate

func SetDefaultWorkTemplate(db *gorm.DB, myId, subId, workTemplateId string) (ret *models.WorkTemplate, err error)

func ShortUrl

func ShortUrl(link string) string

生成新浪短链接

func SyncChatKeywordCallback

func SyncChatKeywordCallback(b []byte, db *gorm.DB, managerDB *gorm.DB, tool *utils.ReceiveTool, chatBotClient *chatbot.Client) error

func SyncChatMessageCallback

func SyncChatMessageCallback(b []byte, db *gorm.DB, managerDB *gorm.DB, tool *utils.ReceiveTool) error

同步群成员时时消息回调 支持重复调用

func SyncChatOverCallback

func SyncChatOverCallback(b []byte, client *uchatlib.UchatClient) error

func SyncChatQrCodeCallback

func SyncChatQrCodeCallback(b []byte, db *gorm.DB) error

func SyncChatRoomCreateCallback

func SyncChatRoomCreateCallback(b []byte, client *uchatlib.UchatClient, db *gorm.DB, publisher *rmqtool.PublisherTool) error

同步开群通知回调 支持重复调用

func SyncChatRoomMembers

func SyncChatRoomMembers(chatRoomSerialNo string, client *uchatlib.UchatClient) error

同步群会员信息 支持重复调用

func SyncChatRoomMembersCallback

func SyncChatRoomMembersCallback(b []byte, db *gorm.DB) error

群会员信息回调 支持重复调用

func SyncChatRoomStatus

func SyncChatRoomStatus(chatRoomSerialNo string, client *uchatlib.UchatClient, db *gorm.DB) error

同步群状态 支持重复调用

func SyncMemberJoinCallback

func SyncMemberJoinCallback(b []byte, db *gorm.DB, managerDB *gorm.DB) error

同步群成员入群通知回调 支持重复调用

func SyncMemberMessageSumCallback

func SyncMemberMessageSumCallback(b []byte, db *gorm.DB) error

同步群成员发言数量回调 支持重复调用

func SyncMemberQuitCallback

func SyncMemberQuitCallback(b []byte, db *gorm.DB) error

同步群成员退群通知回调 支持重复调用

func SyncRobotChatJoinCallback

func SyncRobotChatJoinCallback(b []byte, db *gorm.DB) error

func SyncRobotChatRooms

func SyncRobotChatRooms(RobotSerialNo string, client *uchatlib.UchatClient, db *gorm.DB) error

同步设备开群信息 支持重复调用

func SyncRobotChatRoomsCallback

func SyncRobotChatRoomsCallback(b []byte, db *gorm.DB) error

同步设备开群信息回调 支持重复调用

func SyncRobotFriendAddCallback

func SyncRobotFriendAddCallback(b []byte, db *gorm.DB) error

func SyncRobots

func SyncRobots(client *uchatlib.UchatClient, db *gorm.DB) error

同步设备列表 支持重复调用

func UpdateChatRoomHeadImage

func UpdateChatRoomHeadImage(db *gorm.DB, chatRoomSerialNo string) (*models.ChatRoom, error)

func UpdateWorkTemplate

func UpdateWorkTemplate(db *gorm.DB, workTemplateId, name string, cmdValue, cmdParams, cmdReply *goutils.NullString, status int8) (ret *models.WorkTemplate, err error)

func UploadQiuniu

func UploadQiuniu(filename string, data []byte) (storage.PutRet, error)

Types

type ChatRoomHeadImage

type ChatRoomHeadImage struct {
	// contains filtered or unexported fields
}

func NewChatRoomHeadImage

func NewChatRoomHeadImage(db *gorm.DB, chatRoomSerialNo string) (*ChatRoomHeadImage, error)

func (*ChatRoomHeadImage) Generate

func (c *ChatRoomHeadImage) Generate(limit int) (io.Reader, error)

type ChatRoomMembersList

type ChatRoomMembersList struct {
	ChatRoomUserData []map[string]string
}

type CustomKeywordReplyTemplateParams

type CustomKeywordReplyTemplateParams struct {
	Keywords  []CustomKeywordReplyTemplateParamsKeyword `json:"keywords"`
	ReplyType string                                    `json:"reply_type"`
}

type CustomKeywordReplyTemplateParamsKeyword

type CustomKeywordReplyTemplateParamsKeyword struct {
	Filter  string `json:"filter"`
	Keyword string `json:"keyword"`
}

type HeadImage

type HeadImage struct {
	// contains filtered or unexported fields
}

微信头像生成

func NewHeadImage

func NewHeadImage() *HeadImage

func (*HeadImage) AddImage

func (c *HeadImage) AddImage(imgUrl string) error

添加一个头像

func (*HeadImage) JPEG

func (c *HeadImage) JPEG() (io.Reader, error)

生成

func (*HeadImage) SetImages

func (c *HeadImage) SetImages(images []string, limit int) error

设备头像

func (*HeadImage) SetSize

func (c *HeadImage) SetSize(size int)

设置画布大小

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL