util

package
v0.0.0-...-36d6084 Latest Latest
Warning

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

Go to latest
Published: May 20, 2018 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

使用LUA脚本返回配置参数

Index

Constants

View Source
const (
	WALLET_NAME     = "daoone"
	CREATOR         = "daoone"
	BOUNTY_CONTRACT = "bounty"
	DOT_CONTRACT    = "daoone.token"
	//TOKEN_SYM = "DOT"
	//DOT_CONTRACT = "eosio.token"
	TOKEN_SYM = "DOT"
)

Variables

View Source
var (
	KeyPrefix = ""
)

Functions

func B2S

func B2S(bs []int8) string

func ByteToString

func ByteToString(p []byte) string

func Decrypt

func Decrypt(ciphertext, key []byte) ([]byte, error)

func DoGet

func DoGet(url string) (a []byte, e error)

func DoLog

func DoLog(c string, cate string)

func DoPost

func DoPost(url string, payload interface{}) (a []byte, e error)

公用请求

func DotUnitToFloat

func DotUnitToFloat(am int64) float64

func DotUnitToInt

func DotUnitToInt(am float64) int64

func Encrypt

func Encrypt(plantText, key []byte) ([]byte, error)

AES normal

func Error

func Error(name string, code int, message string) gin.H

func FUNCTION

func FUNCTION() string

func GetBytes

func GetBytes(key interface{}) ([]byte, error)

interface转byte

func GetConfig

func GetConfig(section, key string) string

func IsPhone

func IsPhone(phone string) bool

正则验证手机号

func MakeRandomStr

func MakeRandomStr(l int) string

func MakeRandomStrLower

func MakeRandomStrLower(l int) string

func Md5

func Md5(text string) string

func NewRedisPool

func NewRedisPool() *redis.Pool

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(plantText []byte, blockSize int) []byte

func Success

func Success() gin.H

func WxError

func WxError(msg string) gin.H

func WxGetSessionKey

func WxGetSessionKey(code string) (sessionKey, openId string)

func WxPKCS7UnPadding

func WxPKCS7UnPadding(plantText []byte) []byte

WxPKCS7UnPadding return unpadding []Byte plantText

Types

type EosInstance

type EosInstance struct {
	*eos.API
	// contains filtered or unexported fields
}

func GetEos

func GetEos() *EosInstance

func (*EosInstance) CreateAccount

func (e *EosInstance) CreateAccount(accountName string) (string, string, error)

创建用户

func (*EosInstance) CreateTask

func (e *EosInstance) CreateTask(owner, approver, contributor, desc string, bounty int64) (string, error)

调用合约生成bounty

func (*EosInstance) CreateWallet

func (e *EosInstance) CreateWallet(walletName string) (string, error)

创建唯一的钱包 每个用户只能创建一个钱包,钱包名字关联用户表 不存储钱包密钥,创建钱包无法从外部调用

func (*EosInstance) GetAccountTransaction

func (e *EosInstance) GetAccountTransaction(id string) (eos.Action, error)

func (*EosInstance) GetAccountTransactionsRaw

func (e *EosInstance) GetAccountTransactionsRaw(accountName string, startNum, count int) (interface{}, error)

func (*EosInstance) IssueDot

func (e *EosInstance) IssueDot(to, memo string, quantity float64) (string, error)

func (*EosInstance) TransferDot

func (e *EosInstance) TransferDot(from, to, memo, walletName string, quantity float64) (string, error)

func (*EosInstance) WalletImport

func (e *EosInstance) WalletImport(privKey string) error

func (*EosInstance) WalletLock

func (e *EosInstance) WalletLock(name string) error

func (*EosInstance) WalletUnlock

func (e *EosInstance) WalletUnlock(name, secret string) error

type Logger

type Logger struct {
	*log.Logger
}

type NewTask

type NewTask struct {
	Owner       eos.AccountName `json:"owner"`
	Approver    eos.AccountName `json:"approver"`
	Contributor eos.AccountName `json:"contributor"`
	Desc        string          `json:"desc"`
	Bounty      int64           `json:"bounty"`
}

type RedisClient

type RedisClient struct {
	Conn redis.Conn

	HasPrefix bool
	// contains filtered or unexported fields
}
func init() {
	po = NewRedisPool()
}

func GetRedis

func GetRedis() *RedisClient

func (*RedisClient) Close

func (r *RedisClient) Close()

func (*RedisClient) DEL

func (r *RedisClient) DEL(key string) error

func (*RedisClient) EXPIRE

func (r *RedisClient) EXPIRE(key string, expireSeconds int) error

func (*RedisClient) GET

func (r *RedisClient) GET(key string) string

func (*RedisClient) HDEL

func (r *RedisClient) HDEL(key, field string) error

func (*RedisClient) HEXISTS

func (r *RedisClient) HEXISTS(key, field string) (bool, error)

func (*RedisClient) HGET

func (r *RedisClient) HGET(key, field string) (string, error)

func (*RedisClient) HGETALL

func (r *RedisClient) HGETALL(key string) (map[string]string, error)

func (*RedisClient) HLEN

func (r *RedisClient) HLEN(key string) (int, error)

func (*RedisClient) HSCAN

func (r *RedisClient) HSCAN(key string, cursor interface{}, optionArgs ...interface{}) (uint64, map[string]string, error)

func (*RedisClient) HSET

func (r *RedisClient) HSET(key, field, val string) error

func (*RedisClient) INCR

func (r *RedisClient) INCR(key string) (int64, error)

func (*RedisClient) SET

func (r *RedisClient) SET(key string, val interface{}) error

func (*RedisClient) SETEX

func (r *RedisClient) SETEX(key string, expireSeconds int, val interface{}) error

func (*RedisClient) WithPrefix

func (r *RedisClient) WithPrefix(p string) *RedisClient

func (*RedisClient) ZADD

func (r *RedisClient) ZADD(key string, score, member interface{}, optionArgs ...interface{}) error

func (*RedisClient) ZINCRBY

func (r *RedisClient) ZINCRBY(key string, increment, member interface{}) error

type WxBizDataCrypt

type WxBizDataCrypt struct {
	AppID      string
	SessionKey string
}

WxBizDataCrypt represents an active WxBizDataCrypt object

func (*WxBizDataCrypt) Decrypt

func (wxCrypt *WxBizDataCrypt) Decrypt(encryptedData string, iv string, isJSON bool) (interface{}, error)

Decrypt Weixin APP's AES Data If isJSON is true, Decrypt return JSON type. If isJSON is false, Decrypt return map type.

type WxSessionData

type WxSessionData struct {
	SessionKey string `json:"session_key"`
	Openid     string `json:"openid"`
	Unionid    string `json:"unionid"`
}

Jump to

Keyboard shortcuts

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