common

package
v0.0.0-...-7a73484 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

*

  • @Author: Gosin
  • @Date: 2020/4/9 16:20

*

  • @Author: Gosin
  • @Date: 2020/2/24 17:17

*

  • @Author: Gosin
  • @Date: 2020/4/13 10:26

Index

Constants

View Source
const (
	CODE_SUCCESS = 0   // 正常
	CODE_FAIL    = 300 // 字段校验问题
	CODE301      = 301 // 验签名问题
	CODE302      = 302 // 请求频繁
	CODE400      = 400 // 第三方接口异常
	CODE401      = 401 // 第三方接口返回错误信息
	CODE500      = 500 // 异常
	CODE501      = 501 // 异常timeout
)
View Source
const (
	//#二维码类型
	//卡包二维码,使用该二维码进行扫码消费确认
	ERCODE_type_cardconsume = 1
	//用户个人二维码,使用该二维码获取用户信息、用户个人动态验证码(可用于消费确认)
	ERCODE_type_user = 2
	//权益卡二维码,使用该二维码进行扫码耗卡确认
	ERCODE_type_equityconsume = 3

	//二维码类型对应的rediskey值
	ERCODE_type_cardconsume_key   = "kcqrcode_1000_1001"
	ERCODE_type_user_key          = "kcqrcode_1000_1002"
	ERCODE_type_equityconsume_key = "kcqrcode_1000_1003"

	//公共过期key
	ERCODE_common_expire_key = "kcqrcode_common_0001_%d_%d" //%d=二维码类型 %d=二维码值
)
View Source
const (
	// 公共服务验证
	ENCODE_IS_NIL       = "1000001"
	ENCODE_ERR          = "1000002"
	ENCODE_DATA_TIMEOUT = "1000003"
	PERMISSION_ERR      = "1000004"
	PHONE_VERIFY_ERR    = "1000005"

	// 用户服务验证
	CHANNEL_ERR = "1100001"
	DEVICE_ERR  = "1100002"

	// 商户服务验证
	MEMBER_SOURCE_ERROR    = "1200001"
	MEMBER_GENDER_ERROR    = "1200002"
	MEMBER_CARD_NUM_ERROR  = "1200003"
	MEMBER_DATA_TYPE_ERROR = "1200004"
	MEMBER_NAME_IS_NIL     = "1200005"

	//卡项服务
	CARDS_PRICE_ERR            = "1300001"
	CARDS_PERIOD_ERR           = "1300002"
	CARDS_NAME_EMP_ERR         = "1300003"
	CARDS_INC_SINGLES_EMP_ERR  = "1300004"
	CARDS_INC_SINGLES_MAX_ERR  = "1300005"
	CARDS_INC_PRODUCTS_EMP_ERR = "1300006"
	CARDS_INC_PRODUCTS_MAX_ERR = "1300007"
	CARDS_STATUS_OFF_ERR       = "1300008"

	//充值卡
	RCARD_DISCOUNT_TYPE_ERR  = "1400001"
	RCARD_DISCOUNT_PRICE_ERR = "1400002"
	RCARD_DISCOUNT_ITEM_ERR  = "1400003"
	RCARD_DISCOUNT_ERR       = "1400004"

	//二维码
	QRCODE_EXPIRED = "1500001"
)

Variables

This section is empty.

Functions

func GetInterfaceError

func GetInterfaceError(code string) error

获取错误信息

func VerfiyCardNum

func VerfiyCardNum(gender string) error

验证证件号

func VerfiyPhone

func VerfiyPhone(phone string) error

手机号验证

Types

type Autoken

type Autoken struct {
	EncodeStr string //uid加密字符串
	Auid      int
	RoleId    int
}

Autoken Autoken

func (*Autoken) GetAdminInfo

func (au *Autoken) GetAdminInfo() (*ReplyAdminUserAuthBody, error)

GetAdminInfo GetAdminInfo

func (*Autoken) GetAuid

func (au *Autoken) GetAuid() (int, error)

GetAuid GetAuid

type BsToken

type BsToken struct {
	EncodeStr string //加密字符串
	// contains filtered or unexported fields
}

适用于企业/商户ID、门店ID的解密 针对企业/商户、门店增删改操作必须通过加密字符串传递 定义结构体

func (*BsToken) GetBusAcc

func (b *BsToken) GetBusAcc() (bool, error)

获取是否拥有总店操作权限

func (*BsToken) GetBusId

func (b *BsToken) GetBusId() (int, error)

获取企业/商户ID

func (*BsToken) GetShopId

func (b *BsToken) GetShopId() (int, error)

获取是否允许操作总店铺

type EnCode

type EnCode struct {
	QrcodeType int   //二维码类型 //必须
	Id         int   //标识ID    //必须
	Extend     []int //扩展值    //非必须
	NoEncode   bool  //二维码信息数据加密 默认加密 非必须
	Expire     int   //过期时间/秒,默认=2天过期 非必须
	RandomLen  int   //二维码code长度 默认=11  非必须,实际长度比设置长度多一位
	// contains filtered or unexported fields
}

func (*EnCode) CheckExpire

func (e *EnCode) CheckExpire(qrcodeRandom string) (reply QrcodeData, err error)

检测key是否已过期,不过期则返回二维码code对应的id值

func (*EnCode) GetQrcodeStr

func (e *EnCode) GetQrcodeStr() (encodeStr string)

获取二维码

type Input

type Input struct {
	Data   map[string]interface{}
	ShopID int
	BusID  int
}

Input Input

type Output

type Output struct {
	Code    int
	Message string
	Data    map[string]interface{}
}

Output Output

type Pagination

type Pagination struct {
	TotalNum int
	//List     []interface{}
	IndexImg map[int]string
}

Pagination Pagination

type PaginationInput

type PaginationInput struct {
	Page     int `form:"page" json:"page" binding:"required"`
	PageSize int `form:"pageSize" json:"pageSize" binding:"required"`
}

PaginationInput PaginationInput

type PaginationOutput

type PaginationOutput struct {
	Code    int
	Message string
	Data    *Pagination
}

PaginationOutput PaginationOutput

type Paging

type Paging struct {
	Page     int // 分页
	PageSize int // 分页大小
}

func (*Paging) GetPageSize

func (p *Paging) GetPageSize(flag ...bool) int

如果传参 默认是100条

func (*Paging) GetStart

func (p *Paging) GetStart() int

type QrcodeData

type QrcodeData struct {
	QrcodeType int
	Id         int
	Tag        string
	Extend     []int
	Expire     int
	QrcodeSn   string
}

二维码具体信息结构体

type ReplyAdminUserAuthBody

type ReplyAdminUserAuthBody struct {
	Auid   int
	RoleId int
}

ReplyAdminUserAuthBody ReplyAdminUserAuthBody

type ReplyDeBusAuthBody

type ReplyDeBusAuthBody struct {
	ShopId int
	BusId  int
	BusAcc bool // 是否拥有店铺权限
}

解析结构体

type Utoken

type Utoken struct {
	UidEncodeStr string //uid加密字符串
}

func (*Utoken) GetUid

func (u *Utoken) GetUid() (int, error)

获取用户UID

Jump to

Keyboard shortcuts

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