lib

package
v0.0.0-...-c107b7b Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const BIZ_NO_RECORD = "200007"
View Source
const BIZ_OTP_VERIFIED_FAILED = "200001"
View Source
const BIZ_REQUIRED_CATEGORYKEY = "200005"
View Source
const BIZ_REQUIRED_LOVCODE = "200004"
View Source
const BIZ_REQUIRED_TRANSACTIONID = "200006"
View Source
const BIZ_SEND_SMS_FAILED = "200002"
View Source
const BIZ_WRONG_MOBILE_NUMBER = "200003"
View Source
const ERROR_JSON_MARSHAL_FAILED = "300002"
View Source
const ERROR_JSON_UNMARSHAL_FAILED = "300001"
View Source
const ERROR_MYSQL_QUERY_FAILED = "300005"
View Source
const ERROR_MYSQL_UPDATE_FAILED = "300006"
View Source
const ERROR_NO_LOV_DATA = "300004"
View Source
const ERROR_SEND_SMS_FAILED = "300003"
View Source
const ERROR_TOKEN_NOT_VERIFIED = "300007"
View Source
const LOV_MATERIAL_CATEGORY = "MATERIAL_CATEGORY"

LOV Code 材料分类

View Source
const LOV_MERCHANT_KEY_RET = "RET"

餐厅

View Source
const LOV_MERCHANT_KEY_SUP = "SUP"

菜老板

View Source
const LOV_MERCHANT_TYPE = "MERCHANT_TYPE"

商户类型

View Source
const LOV_STANDARD_TYPE = "STANDARD_TYPE"

材料等级

View Source
const LOV_TRANSACTION_TYPE = "TRANSACTION_TYPE"

订单类型

View Source
const LOV_TRANSACTION_TYPE_CANCEL = "007"
View Source
const LOV_TRANSACTION_TYPE_FINISH = "006"
View Source
const LOV_TRANSACTION_TYPE_NOT_PAIED = "002"
View Source
const LOV_TRANSACTION_TYPE_PAIED = "003"
View Source
const LOV_TRANSACTION_TYPE_SIGNOFF = "005"
View Source
const LOV_TRANSACTION_TYPE_START = "001"

订单状态

View Source
const LOV_TRANSACTION_TYPE_TRANSPORT = "004"
View Source
const ORDER_REQUEST = "REQ"

REQ: 询价单 RES: 报价单 TRX: 订单

View Source
const ORDER_RESPONSE = "RES"
View Source
const ORDER_TRANSACTION = "TRX"
View Source
const STATUS_SUCCESS = "000000"
View Source
const SUPPLIER_QUALIFIED = 10

Supplier Priority: 备选送货

View Source
const SUPPLIER_READY = 5

Supplier Priority: 可以合作的级别

Variables

View Source
var Messages map[string]string

Functions

func ConvertStrToInt

func ConvertStrToInt(s string) int

func GenerateOTP

func GenerateOTP() string

生成OTP

func GenerateOrderNumber

func GenerateOrderNumber(purchaseType string) string

生成订单号 REQ: 询价单 RES: 报价单 TRX: 订单

func GenerateSecurityToken

func GenerateSecurityToken(mobileNumber string) string

生成Security token

func GenerateSequenceNumberForOTP

func GenerateSequenceNumberForOTP(otp string) string

生成OTP Sequence Number

func GetBytes

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

func GetCurrentTime

func GetCurrentTime() string

得到当前时间

func GetMd5String

func GetMd5String(s string) string

生成32位md5字串

func Pwdhash

func Pwdhash(str string) string

password hash function

func SendTemplateSMS

func SendTemplateSMS(to string, datas []string, tempId string, serverInfo *ServerInfo) (result map[string]interface{}, err error)

func StringsToJson

func StringsToJson(str string) string

func Strtomd5

func Strtomd5(s string) string

create md5 string

Types

type BizError

type BizError struct {
	ErrorCode    string
	ErrorMessage string
	Err          error
}

func (*BizError) Error

func (e *BizError) Error() string

type RedisxCache

type RedisxCache struct {
	// contains filtered or unexported fields
}

Redis cache adapter.

func NewRedisxCache

func NewRedisxCache() *RedisxCache

create new redis cache with default collection name.

func (*RedisxCache) ClearAll

func (rc *RedisxCache) ClearAll() error

clean all cache in redis. delete this redis collection.

func (*RedisxCache) Decr

func (rc *RedisxCache) Decr(key string) error

decrease counter in redis.

func (*RedisxCache) Delete

func (rc *RedisxCache) Delete(key string) error

delete cache in redis.

func (*RedisxCache) Get

func (rc *RedisxCache) Get(key string) interface{}

Get cache from redis.

func (*RedisxCache) Incr

func (rc *RedisxCache) Incr(key string) error

increase counter in redis.

func (*RedisxCache) IsExist

func (rc *RedisxCache) IsExist(key string) bool

check cache exist in redis.

func (*RedisxCache) Put

func (rc *RedisxCache) Put(key string, val interface{}, timeout int64) error

put cache to redis. timeout is ignored.

func (*RedisxCache) StartAndGC

func (rc *RedisxCache) StartAndGC(config string) error

start redis cache adapter. config is like {"key":"collection key","conn":"connection info"} the cache item in redis are stored forever, so no gc operation.

type ServerInfo

type ServerInfo struct {
	AccountSid   string
	AccountToken string
	AppId        string
	ServerIP     string
	ServerPort   string
	SoftVersion  string
}

type SmsData

type SmsData struct {
	To         string   `json:"to"`
	AppId      string   `json:"appId"`
	TemplateId string   `json:"templateId"`
	Datas      []string `json:"datas"`
}

type SysError

type SysError struct {
	ErrorCode    string
	ErrorMessage string
	Err          error
}

func (*SysError) Error

func (e *SysError) Error() string

Jump to

Keyboard shortcuts

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