domain

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

*

  • Copyright 2014 @ 56x.net.
  • name : delivery
  • author : jarryliu
  • date : 2014-10-06 14:21 :
  • description :
  • history :

*

  • Copyright 2015 @ 56x.net.
  • name : download.go
  • author : jarryliu
  • date : 2015-12-31 12:23
  • description :
  • history :

*

  • Copyright 2014 @ 56x.net.
  • name :
  • author : jarryliu
  • date : 2014-02-05 21:53
  • description :
  • history :

*

  • Copyright 2015 @ 56x.net.
  • name : option.go
  • author : jarryliu
  • date : 2016-04-18 13:48
  • description :
  • history :

Index

Constants

View Source
const (
	OptionTypeInt int = iota
	OptionTypeString
	OptionTypeBoolean
)

Variables

View Source
var (
	Sha1OffSet = ""
)

Functions

func AndPayMethod

func AndPayMethod(payFlag int, method int) bool

支付方式且运算

func BuildOptionsForm

func BuildOptionsForm(v *[]Option) string

func ChkPwdRight

func ChkPwdRight(pwd string) (bool, error)

func DownloadToLocal

func DownloadToLocal(url string, savePath string, ext string) string

下载远程资源并返回本地地址

func GenerateCartCode

func GenerateCartCode(unix int64, nano int) string

生成16位唯一的md5购物车码

func GenerateRandomIntPwd

func GenerateRandomIntPwd(n int) string

创建随机数字密码

func GetAreaName

func GetAreaName(addr string) (string, error)

获取地区名称

func GetCityName

func GetCityName(addr string) (string, error)

获取城市名称

func GrantFlag added in v0.4.10

func GrantFlag(field, flag int) (int, error)

GrantFlag 添加标志

func HandleError

func HandleError(err error, src string) error

todo: 可以做通过后台设置错误信息 处理错误

func MathPaymentMethodFlag

func MathPaymentMethodFlag(methods []int) int

计算支付方式标志

func Md5

func Md5(pwd string) string

MD5加密

func Md5Pwd

func Md5Pwd(pwd, str string) string

密码Md5加密

func MemberSha1Pwd

func MemberSha1Pwd(pwd string, salt string) string

加密会员密码,因为可能会使用手机号码登录, 所以密码不能依据用户名作为生成凭据

func MerchantSha1Pwd

func MerchantSha1Pwd(pwd string, salt string) string

加密合作商密码

func NewApiId

func NewApiId(id int) string

创建API编号(10位)

func NewCheckCode

func NewCheckCode() string

获取新的验证码

func NewSecret

func NewSecret(hex int) string

创建密钥(16位)

func NewTradeNo

func NewTradeNo(business int, userId int) string

创建交易号(16位),business为零时,交易号为15位

func ParseCartCheckedMap

func ParseCartCheckedMap(data string) (m map[int64][]int64)

转换勾选字典,数据如:{"1":["10","11"],"2":["20","21"]}

func Sha1

func Sha1(s string) string

func Sha1Pwd

func Sha1Pwd(pwd string, salt string) string

密码SHA1加密

func ShaPwd

func ShaPwd(pwd, p string) string

密码SHA1加密

func TestFlag added in v0.4.10

func TestFlag(field, flag int) bool

TestFlag 测试是否包含标志

func TradePassword

func TradePassword(pwd string, salt string) string

交易密码

Types

type DomainError

type DomainError struct {
	Key          string
	DefaultError string
}

func NewError

func NewError(key string, msg string) *DomainError

func (*DomainError) Error

func (this *DomainError) Error() string

func (*DomainError) Set

func (this *DomainError) Set(msg string)

type IOptionStore

type IOptionStore interface {
	// the indent of option store
	Indent() string

	// check state
	Stat() error

	// get all options
	All() (keys []string, values []*Option)

	// get option by key
	Get(key string) (value *Option)

	// after set,call flush()
	Set(key string, value *Option)

	// flush to file
	Flush() error

	// destroy and delete file
	Destroy() error
}

func NewOptionStoreWrapper

func NewOptionStoreWrapper(indent string) IOptionStore

type Option

type Option struct {
	Key   string `json:"key"`   //键
	Type  int    `json:"type"`  //类型
	Must  bool   `json:"must"`  //是否必须填写
	Title string `json:"title"` //标题
	Value string `json:"value"` //值
}

type OptionStoreWrapper

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

func (*OptionStoreWrapper) All

func (this *OptionStoreWrapper) All() (keys []string, values []*Option)

get all options

func (*OptionStoreWrapper) Destroy

func (this *OptionStoreWrapper) Destroy() error

destroy and delete file

func (*OptionStoreWrapper) Flush

func (this *OptionStoreWrapper) Flush() (err error)

flush to file

func (*OptionStoreWrapper) Get

func (this *OptionStoreWrapper) Get(key string) *Option

get option by key

func (*OptionStoreWrapper) Indent

func (this *OptionStoreWrapper) Indent() string

the indent of option store

func (*OptionStoreWrapper) Set

func (this *OptionStoreWrapper) Set(key string, v *Option)

after set,call flush()

func (*OptionStoreWrapper) Stat

func (this *OptionStoreWrapper) Stat() error

type OptionType

type OptionType int

Directories

Path Synopsis
*
*

Jump to

Keyboard shortcuts

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