model

package
v0.0.0-...-1ea22bd Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

*

  • Project Name:wechat-robot
  • File Name:txairobot.go
  • Package Name:model
  • Date:2019年07月16日 14:19
  • Function:
  • Copyright (c) 2019, Jason.Wang All Rights Reserved.

Index

Constants

View Source
const (
	// DevelopmentMode 开发模式
	DevelopmentMode = "development"

	// TestMode 测试模式
	TestMode = "test"

	// ProductionMode 产品模式
	ProductionMode = "production"
)

Variables

View Source
var DB *gorm.DB

DB 数据库连接

View Source
var RedisPool *redis.Pool

RedisPool Redis连接池

Functions

func EventReceived

func EventReceived(msg *message.MixMessage) *message.Reply

func QykRecevie

func QykRecevie(msg *message.MixMessage) *message.Reply

func Recevie

func Recevie(msg *message.MixMessage) *message.Reply

func SendMessageV2

func SendMessageV2(fromUserName string, content string) string

func SendTxAiMessage

func SendTxAiMessage(fromUserName string, content string) (data string)

发送数据

func TxAiRecevie

func TxAiRecevie(msg *message.MixMessage) *message.Reply

Types

type AiRequest

type AiRequest struct {
	AppId     float64 `json:"app_id"`
	TimeStamp int64   `json:"time_stamp"`
	NonceStr  string  `json:"nonce_str"`
	Sign      string  `json:"sign"`
	Session   string  `json:"session"`
	Question  string  `json:"question"`
}

type AiResponse

type AiResponse struct {
	Ret  int64          `json:"ret"`
	Msg  string         `json:"msg"`
	Data AiResponseData `json:"data"`
}

type AiResponseData

type AiResponseData struct {
	Session string `json:"session"`
	Answer  string `json:"answer"`
}

type Map

type Map map[string]string

func (Map) MarshalXML

func (m Map) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML marshals the map to XML, with each key in the map being a tag and it's corresponding value being it's contents.

func (*Map) UnmarshalXML

func (m *Map) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML unmarshals the XML into a map of string to strings, creating a key in the map for each tag and setting it's value to the tags contents.

The fact this function is on the pointer of Map is important, so that if m is nil it can be initialized, which is often the case if m is nested in another xml structurel. This is also why the first thing done on the first line is initialize it.

type QyRobot

type QyRobot struct {
	Content string `json:"content"`
	// contains filtered or unexported fields
}

青云客的数据结构

type Robot

type Robot struct {
	Text string `json:"text"`
	// contains filtered or unexported fields
}

机器人回复的数据的json绑定对象

type Wechat

type Wechat struct {
	ID          uint32 `json:"id"`
	UserID      uint32 `json:"userId"`
	AppID       string `json:"appId"`
	AppSecret   string `json:"appSecret"`
	Token       string `json:"token"`
	EncodingKey string `json:"encodingKey"`
	Remark      string `json:"remark"`
	Robot       uint32 `json:"robot"`
}

Jump to

Keyboard shortcuts

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