controllers

package
v0.0.0-...-02b4230 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

*

*
* @author liangjf
* @create on 2020/6/3
* @version 1.0

*

*
* @author liangjf
* @create on 2020/6/2
* @version 1.0

*

*
* @author liangjf
* @create on 2020/7/1
* @version 1.0

Index

Constants

This section is empty.

Variables

View Source
var (
	SuccessMsg = "ok"

	ErrPushMsg                   = Errno{Code: New(100), Msg: "推送失败"}
	ErrPushMsgTagEmpty           = Errno{Code: New(101), Msg: "缺失推送应用tag"}
	ErrPushMsgBodyUUIDEmpty      = Errno{Code: New(102), Msg: "缺失推送uuid"}
	ErrPushMsgBodyTypeEmpty      = Errno{Code: New(103), Msg: "缺失推送类型"}
	ErrPushMsgBodyContentEmpty   = Errno{Code: New(104), Msg: "缺失推送内容"}
	ErrPushMsgBodyExpireTimeOver = Errno{Code: New(105), Msg: "超过最大过期时间"}

	ErrSignToken       = Errno{Code: New(150), Msg: "生成token失败"}
	ErrUserNotFound    = Errno{Code: New(151), Msg: "用户不存在/密码错误"}
	ErrSaveToken2Redis = Errno{Code: New(152), Msg: "生成token失败"}
	ErrGatewayEmpty    = Errno{Code: New(153), Msg: "网关列表空"}
)

Functions

func New

func New(e int) int

func PushMsg

func PushMsg(c *gin.Context)

PushMsg 接收推送消息, 写入消息队列, logic消费消息转发给网关客户端

func Token

func Token(c *gin.Context)

Token 用户登录前获取token, 用于后续的推送凭证

Types

type Errno

type Errno struct {
	Code int
	Msg  string
}

func (Errno) Error

func (e Errno) Error() string

type Result

type Result struct {
	Code int         `json:"Code"`
	Data interface{} `json:"Data,omitempty"`
	Msg  string      `json:"Msg"`
}

-----------------------------------------//

func (*Result) Failure

func (r *Result) Failure(c *gin.Context, err error)

func (*Result) Success

func (r *Result) Success(c *gin.Context, data interface{})

type TokenReq

type TokenReq struct {
	UUID     string `json:"uuid"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type TokenResp

type TokenResp struct {
	Token       string `json:"token"`
	GatewayAddr string `json:"gatewayAddr"`
}

Jump to

Keyboard shortcuts

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