models

package
v0.0.0-...-90eb40b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMessage

func AddMessage(message *Message)

func AddProduct

func AddProduct(product *Product)

func AddSSHHost

func AddSSHHost(s *SshHost) error

func AddSshResult

func AddSshResult(s *SshResult) error

func AddUser

func AddUser(user *User)

func Connect

func Connect(h *SshHost) (*ssh.Session, error)

func DelMessage

func DelMessage(message *Message)

func DeleteProduct

func DeleteProduct(product *Product)

func DeleteSshHost

func DeleteSshHost(s *SshHost)

func GbkToUtf8

func GbkToUtf8(str []byte) (b []byte, err error)

transform GBK bytes to UTF-8 bytes

func LogMessage

func LogMessage(message *Message)

func RegisterDatabase

func RegisterDatabase()

Types

type AppMsg

type AppMsg struct {
	ToUser  string   `json:"touser,omitempty"`
	ToParty string   `json:"toparty,omitempty"`
	ToTag   string   `json:"totag,omitempty"`
	Toall   string   `json:"toall,omitempty"`
	MsgType string   `json:"msgtype,omitempty"`
	Agentid int      `json:"agentid,omitempty"`
	Text    *Content `json:"text,omitempty"`
	Safe    int      `json:"safe,omitempty"`
}

微信提交内容结构体

type Content

type Content struct {
	Content string `json:"content"`
}

type Message

type Message struct {
	Id   int       `json:"id"`
	User string    `json:"user"`
	Msg  string    `json:"msg" orm:"size(500)"`
	Time time.Time `json:"time"`
}

func GetAllMessage

func GetAllMessage() []*Message

func GetAllMessageByUsername

func GetAllMessageByUsername(username string) []*Message

type Product

type Product struct {
	Id       int
	Name     string
	Type     string
	Platform string
	Url      string
	Price    float32
	Time     time.Time
}

func GetAllProduct

func GetAllProduct() []*Product

func NewProduct

func NewProduct(n string, t string, pf string, url string, p float32) *Product

type QyInfo

type QyInfo struct {
	Corpid     string `json:"corpid"`
	Corpsecret string `json:"corpsecret"`
	Agentid    int    `json:"agentid"`
}

type QyToken

type QyToken struct {
	Errcode      int    `json:"errcode"`
	Errmsg       string `json:"errmsg"`
	Access_token string `json:"access_token"`
	Expries_in   int    `json:"expires_in"`
	Agentid      int    `json:"agentid"`
}

企业微信的令牌返回结构体

func GetQyToken

func GetQyToken(info *QyInfo) (token *QyToken)

type QywebchatRet

type QywebchatRet struct {
	Errcode     int    `json:"errcode"`
	Errmsg      string `json:"errmsg"`
	InvalidUser string `json:"invaliduser"`
}

func SendData

func SendData(msg *AppMsg, token *QyToken) (ret *QywebchatRet)

func SendToUser

func SendToUser(user string, msg string, token *QyToken) (ret *QywebchatRet)

type QywechatUser

type QywechatUser struct {
	Userid string `json:"userid"`
	Name   string `json:"name"`
}

type QywechatUserlist

type QywechatUserlist struct {
	UserList []*QywechatUser `json:"userlist"`
}

func GetAllWXUser

func GetAllWXUser(token *QyToken) (Qy *QywechatUserlist)

type Sales

type Sales struct {
	Catalog []string `json:"catalog"`
	Count   []int    `json:"count"`
}

func NewSales

func NewSales(catalog []string, count []int) (sales *Sales)

type SshHost

type SshHost struct {
	Id       int
	Host     string `orm:"size(32)"`
	Port     int
	Username string `orm:"size(32)"`
	Password string `orm:"size(64)"`
}

func GetAllSshHost

func GetAllSshHost() []*SshHost

func GetSshHost

func GetSshHost(id int) *SshHost

func NewSshHost

func NewSshHost(h, u, p string, port int) *SshHost

type SshResult

type SshResult struct {
	Id      int
	Host    string
	Success string
	Type    string
	Content string
	Result  string
	Time    time.Time
}

func ExecCommands

func ExecCommands(host *SshHost, session *ssh.Session, cmdlist []string) (ret *SshResult)

func GetAllSshResult

func GetAllSshResult() []*SshResult

type Stock

type Stock struct {
	Id      string  `json:"id"`
	Name    string  `json:"name"`
	Start   float32 `json:"start"`
	Current float32 `json:"current"`
	Top     float32 `json:"top"`
	Down    float32 `json:"down"`
	Time    string  `json:"time"`
}

func ConverToStock

func ConverToStock(list []string) (stock *Stock, err error)

func GetStockMsg

func GetStockMsg(stockid string) (stock *Stock, err error)

type User

type User struct {
	Id   int
	Name string `orm:"size(100)"`
	Pass string `orm:"size(100)"`
}

Model Struct

func GetAllUser

func GetAllUser() []*User

func GetUserByName

func GetUserByName(name string) (user *User)

Jump to

Keyboard shortcuts

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