lib

package module
v0.0.0-...-c02f4f7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

README

lib

using for beego platform

Documentation

Index

Constants

View Source
const (
	// Standard length of uniuri string to achive ~95 bits of entropy.
	StdLen = 16
	// Length of uniurl string to achive ~119 bits of entropy, closest
	// to what can be losslessly converted to UUIDv4 (122 bits).
	UUIDLen = 20
)
View Source
const (
	// 客户端请求建立握手
	OP_HANDSHAKE       = int32(0)
	OP_HANDSHAKE_REPLY = int32(1)
	// 客户端发起心跳包
	OP_HEARTBEAT       = int32(2)
	OP_HEARTBEAT_REPLY = int32(3)
	// 断开连接
	OP_DISCONNECT       = int32(4)
	OP_DISCONNECT_REPLY = int32(5)
	// 客户端发起权限认证
	OP_AUTH       = int32(6)
	OP_AUTH_REPLY = int32(7)

	// 系统警告通知
	OP_SYS_WARNING_REPLY = int32(9)
	// 系统信息通知
	OP_SYS_INFO_REPLY = int32(11)
	// 系统资金变化通知
	OP_SYS_AMT_REPLY = int32(13)
	// 系统ODS行情推送
	OP_SYS_ODS_REPLY = int32(15)

	// 进入和退出房间
	OP_ROOM_IN        = int32(16)
	OP_ROOM_IN_REPLY  = int32(17)
	OP_ROOM_OUT       = int32(18)
	OP_ROOM_OUT_REPLY = int32(19)

	// 客户端给用户或者房间发消息
	OP_SEND_USER_MSG       = int32(20)
	OP_SEND_USER_MSG_REPLY = int32(21)
	OP_SEND_ROOM_MSG       = int32(22)
	OP_SEND_ROOM_MSG_REPLY = int32(23)

	// 用户A收到用户B的消息
	OP_RECV_USER_MSG_REPLY = int32(25)
	// 用户A收到房间001的消息
	OP_RECV_ROOM_MSG_REPLY = int32(27)

	// 系统订单结算通知
	OP_SYS_SETTLE_REPLY = int32(29)
	// 系统用户信息变化通知
	OP_SYS_USER_INFO_REPLY = int32(31)

	// 消息系统内部专用
	OP_RAW          = int32(255)
	OP_PROTO_READY  = int32(254)
	OP_PROTO_FINISH = int32(253)
)

Variables

View Source
var HttpGet = http.Get
View Source
var HttpPost = http.Post

Functions

func BaseImg

func BaseImg(datasource, url string) error

func CheckArgIdCard

func CheckArgIdCard(idCard string) bool

身份证验证

func CheckArgNotNull

func CheckArgNotNull(a ...interface{}) bool

参数非空校验

func CheckArgPhone

func CheckArgPhone(phone string) bool

字符串手机号校验

func CheckArgString

func CheckArgString(a ...string) bool

字符串防sql注入过滤,可以为空

func CheckArgZfpwd

func CheckArgZfpwd(zfpwd string) bool

支付密码校验

func CheckStructArgNotNull

func CheckStructArgNotNull(stru interface{}, fields ...string) string

结构体参数非空校验

func CheckStructStringSql

func CheckStructStringSql(stru interface{}, fields ...string) string

结构体参数非空校验

func CheckVcode

func CheckVcode(telnum, vcode string) (err error)

手机验证码验证

func ErWeiImg

func ErWeiImg(link string) (string, error)

func Generator

func Generator() chan int

函数 Generator ,返回通道(Channel),多路复用技术(双倍生成随机数)

func GetSid

func GetSid() string

获取一个唯一键值

func NewPool

func NewPool(function func(interface{}), size int) *pool

func NewRedis

func NewRedis(table string) (rs proredis)

初始化一个集合

func Newimage

func Newimage(digits []byte, width, height int) (string, error)

func OnlyNumber

func OnlyNumber(str string, maxLimit string) (bool, string)

正则验证必须是数字

func PushRoomMessage

func PushRoomMessage(op int32, rid int, v interface{}) bool

func PushUserMessage

func PushUserMessage(op int32, uid int, v interface{}) bool

func RedisConnect

func RedisConnect()

func SendMsgToPhone

func SendMsgToPhone(telnum string, label string) bool

func SendVcode

func SendVcode(telnum string) bool

发送验证码

func StartTimer

func StartTimer(f func())

定时器golang.org/x/text/transform

func StrToMD5

func StrToMD5(str string) string

对字符串进行md5加密

func TransFlowRedisDelete

func TransFlowRedisDelete(Account string, OrderNo string) (err error)

func TransFlowRedisDone

func TransFlowRedisDone(Account string, AimAccount string, WtAmt int64, OrderNo string) (err error)

Types

type Image

type Image struct {
	*image.NRGBA
	// contains filtered or unexported fields
}

type Maps

type Maps struct {
	Lock   sync.RWMutex
	Bucket map[string]interface{}
}

func (*Maps) Delete

func (this *Maps) Delete(key string)

func (*Maps) Get

func (this *Maps) Get(key string) (value interface{}, ok bool)

func (*Maps) NewMaps

func (this *Maps) NewMaps(n int)

func (*Maps) Put

func (this *Maps) Put(key string, value interface{})

func (*Maps) PutNoExit

func (this *Maps) PutNoExit(key string, value interface{}) (val interface{}, ok bool)

type RedisType

type RedisType proredis

type SystemMessage

type SystemMessage struct {
	Code int32
	Msg  string
	Data interface{}
}

消息推送更新用户账户余额

type Worker

type Worker struct {
	Name       string
	ID         int
	JobChannel chan interface{}
	WorkerPool chan chan interface{}
	QuitChan   chan bool
}

消息缓存池,主要用来过滤峰谷大流量请求 消息将存储在内存之中,重启丢失

func NewWorker

func NewWorker(id int, workerPool chan chan interface{}) Worker

func (Worker) Start

func (w Worker) Start(function func(interface{}))

func (Worker) Stop

func (w Worker) Stop()

Jump to

Keyboard shortcuts

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