model

package
v0.0.0-...-a2fbdec Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSignInTask

func AddSignInTask(openid, textOpenid string) error

func AddUserCoordinate

func AddUserCoordinate(openid, tag string, coordinate Coordinate) error

func EventClick

func EventClick(msg EventMsg) (interface{}, error)

func EventLocation

func EventLocation(msg EventMsg) (interface{}, error)

func EventScan

func EventScan(msg EventMsg) (interface{}, error)

func EventSubscribe

func EventSubscribe(msg EventMsg) (interface{}, error)

func EventUnSubscribe

func EventUnSubscribe(msg EventMsg) (interface{}, error)

func EventView

func EventView(msg EventMsg) (interface{}, error)

func GetRedisUserStatus

func GetRedisUserStatus(openid string) (int, error)

func GetSign

func GetSign(token, timestamp, nonce string) (signature string)

Sign 微信公众号 url 签名.

func GetSignature

func GetSignature(timestamp, nonce string) string

func GetUserCoordinates

func GetUserCoordinates(openid string) (map[string]Coordinate, error)

func MsgEvent

func MsgEvent(msg EventMsg) (interface{}, error)

func SetRedisUserStatus

func SetRedisUserStatus(openid string, status int) error

func SetUserCurCourse

func SetUserCurCourse(openid, courseName string, courseID int) error

func SetUserEmail

func SetUserEmail(openid, email string) error

func StartStuSignTask

func StartStuSignTask() error

func UpdateAccessToken

func UpdateAccessToken() error

Types

type Coordinate

type Coordinate struct {
	Lon float64 `bson:"lon" json:"lon"`
	Lat float64 `bson:"lat" json:"lat"`
}

func SetUserCurCoordinateByTag

func SetUserCurCoordinateByTag(openid, tag string) (Coordinate, error)

type EventFunc

type EventFunc func(EventMsg) (interface{}, error)

type EventMsg

type EventMsg struct {
	XMLName struct{} `xml:"xml" json:"-"`
	MsgHeader
	EventType string `xml:"Event" json:"Event"`

	MsgId        int64   `xml:"MsgId"        json:"MsgId"`
	Content      string  `xml:"Content"      json:"Content"`
	MediaId      string  `xml:"MediaId"      json:"MediaId"`
	PicURL       string  `xml:"PicUrl"       json:"PicUrl"`
	Format       string  `xml:"Format"       json:"Format"`
	Recognition  string  `xml:"Recognition"  json:"Recognition"`
	ThumbMediaId string  `xml:"ThumbMediaId" json:"ThumbMediaId"`
	LocationX    float64 `xml:"Location_X"   json:"Location_X"`
	LocationY    float64 `xml:"Location_Y"   json:"Location_Y"`
	Scale        int     `xml:"Scale"        json:"Scale"`
	Label        string  `xml:"Label"        json:"Label"`
	Title        string  `xml:"Title"        json:"Title"`
	Description  string  `xml:"Description"  json:"Description"`
	URL          string  `xml:"Url"          json:"Url"`
	EventKey     string  `xml:"EventKey"     json:"EventKey"`
	Ticket       string  `xml:"Ticket"       json:"Ticket"`
	Latitude     float64 `xml:"Latitude"     json:"Latitude"`
	Longitude    float64 `xml:"Longitude"    json:"Longitude"`
	Precision    float64 `xml:"Precision"    json:"Precision"`

	// menu
	MenuId       int64 `xml:"MenuId" json:"MenuId"`
	ScanCodeInfo *struct {
		ScanType   string `xml:"ScanType"   json:"ScanType"`
		ScanResult string `xml:"ScanResult" json:"ScanResult"`
	} `xml:"ScanCodeInfo,omitempty" json:"ScanCodeInfo,omitempty"`
	SendPicsInfo *struct {
		Count   int `xml:"Count" json:"Count"`
		PicList []struct {
			PicMd5Sum string `xml:"PicMd5Sum" json:"PicMd5Sum"`
		} `xml:"PicList>item,omitempty" json:"PicList,omitempty"`
	} `xml:"SendPicsInfo,omitempty" json:"SendPicsInfo,omitempty"`
	SendLocationInfo *struct {
		LocationX float64 `xml:"Location_X" json:"Location_X"`
		LocationY float64 `xml:"Location_Y" json:"Location_Y"`
		Scale     int     `xml:"Scale"      json:"Scale"`
		Label     string  `xml:"Label"      json:"Label"`
		PoiName   string  `xml:"Poiname"    json:"Poiname"`
	} `xml:"SendLocationInfo,omitempty" json:"SendLocationInfo,omitempty"`

	MsgID  int64  `xml:"MsgID"  json:"MsgID"`  // template, mass
	Status string `xml:"Status" json:"Status"` // template, mass
}

微信服务器推送过来的消息(事件)的合集.

type MsgHeader

type MsgHeader struct {
	ToUserName   string `xml:"ToUserName"   json:"ToUserName"`
	FromUserName string `xml:"FromUserName" json:"FromUserName"`
	CreateTime   int64  `xml:"CreateTime"   json:"CreateTime"`
	MsgType      string `xml:"MsgType"      json:"MsgType"`
}

微信服务器推送过来的消息(事件)的通用消息头.

type User

type User struct {
	ID     bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
	Openid string        `bson:"openid" json:"openid"`
	Email  string        `bson:"email" json:"email"`
	// redis 中存储当前选中坐标
	Coordinates map[string]Coordinate `bson:"coordinates" json:"coordinates"` // 标签 -> 坐标
}

redis 中暂存用户状态

type WZJCourse

type WZJCourse struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	Topic        string `json:"topic"`
	Code         string `json:"code"`
	College      string `json:"college"`
	Department   string `json:"department"`
	DiscussionID int    `json:"discussionId"`
	Selected     bool   `json:"selected"`
}

func ListWZJDiscussCourses

func ListWZJDiscussCourses(openid string) ([]WZJCourse, error)

type WechatTextRes

type WechatTextRes struct {
	XMLName      xml.Name `xml:"xml" json:"-"`
	ToUserName   string   `xml:"ToUserName"   json:"ToUserName"`
	FromUserName string   `xml:"FromUserName" json:"FromUserName"`
	CreateTime   int64    `xml:"CreateTime"   json:"CreateTime"`
	MsgType      string   `xml:"MsgType"      json:"MsgType"`
	Content      string   `xml:"Content" json:"Content"`
}

func GetDefaultTextMsg

func GetDefaultTextMsg(msg EventMsg) WechatTextRes

func GetWelcomeTextMsg

func GetWelcomeTextMsg(msg EventMsg) WechatTextRes

func NewResTextMsg

func NewResTextMsg(msg EventMsg) WechatTextRes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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