constants

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ActionTypeEditPhone 修改手机号
	ActionTypeEditPhone = "EDIT_PHONE"
	// ActionTypeWithdraw 提现
	ActionTypeWithdraw = "WITHDRAW"
	// ActionTypeLogin 登录
	ActionTypeLogin = "LOGIN"
	// ActionTypeMergeAccount 合并账号
	ActionTypeMergeAccount = "MERGE_ACCOUNT"
	// ActionTypeRegister 注册
	ActionTypeRegister = "REGISTER"
	// ActionTypeBalanceChange 余额变更
	ActionTypeBalanceChange = "BALANCE_CHANGE"
	// ActionTypeSmsLog 短信日志
	ActionTypeSmsLog = "SMS_LOG"
)

定义常量来表示 StatusCodes 的键

View Source
const (
	// SmsTypeRegister 注册短信
	SmsTypeRegister = "REGISTER_SMS"

	// SmsTypeChangePhone 修改手机号短信
	SmsTypeChangePhone = "CHANGE_PHONE_SMS"

	// SmsTypeMergeAccount 账号合并短信
	SmsTypeMergeAccount = "MERGE_ACCOUNT_SMS"
)

发送短信类型

View Source
const (
	// StatusSuccess 操作成功
	StatusSuccess = "Success"
	// StatusError 操作失败
	StatusError = "Error"
	// StatusSnBlank SN不正确
	StatusSnBlank = "SnBlank"
	// StatusCodeInvalid Code不正确
	StatusCodeInvalid = "CodeInvalid"
	// StatusAppIdInvalid AppID 不正确
	StatusAppIdInvalid = "AppIdInvalid"
	// StatusDeviceInfoErr 设备信息错误
	StatusDeviceInfoErr = "DeviceInfoError"
	// StatusOpenIdInvalid OpenID 不正确
	StatusOpenIdInvalid = "OpenIdInvalid"
	// StatusPhoneInvalid 手机号不正确
	StatusPhoneInvalid = "PhoneInvalid"
	// StatusUuIDInvalid UUID不正确
	StatusUuIDInvalid = "UuidInvalid"
	// StatusSignNameInvalid 签名不正确
	StatusSignNameInvalid = "SignNameInvalid"
	// StatusAccessKeyInvalid AccessKey 不正确
	StatusAccessKeyInvalid = "AccessKey"
	// StatusAccessSecretInvalid AccessSecret 不正确
	StatusAccessSecretInvalid = "AccessSecret"
	// StatusSmsCodeInvalid 短信验证码不正确
	StatusSmsCodeInvalid = "SmsCodeInvalid"
	// StatusPhoneMergeConflictInvalid 手机号合并冲突
	StatusPhoneMergeConflictInvalid = "PhoneMergeConflictInvalid"
	// StatusErrPendingDataInvalid 有处理中数据,暂时无法合并
	StatusErrPendingDataInvalid = "ErrPendingData"
	// StatusDataConflictInvalid 数据冲突
	StatusDataConflictInvalid = "DataConflict"
	// StatusSmsTypeInvalid 短信类型不正确
	StatusSmsTypeInvalid = "SmsTypeInvalid"
	// StatusImageCaptchaInvalid 图形验证码不正确
	StatusImageCaptchaInvalid = "ImageCaptcha"
	// StatusUserTypeInvalid 图形验证码不正确
	StatusUserTypeInvalid = "UserTypeInvalid"
)

定义常量来表示 StatusCodes 的键

View Source
const (
	// UserTypeInitialAdmin 初始管理员
	UserTypeInitialAdmin = "IA" // 初始管理员
	// UserTypeAdmin 管理员
	UserTypeAdmin = "AD" // 管理员
	// UserTypeDeliverer 投递用户
	UserTypeDeliverer = "UD" // 投递用户
	// UserTypeClearWorker 清运员
	UserTypeClearWorker = "CW" // 清运员
)
View Source
const SmsCodeCacheKey = "SMS_CODE_CACHE:"

SmsCodeCacheKey 定义短信验证码缓存键

Variables

View Source
var ActionTypeCodes = map[string]ActionTypeMessage{
	"EDIT_PHONE": {
		Des:     "用户ID %d 修改手机号,原手机号 %s,修改为 %s",
		Message: "修改手机号",
	},
	"WITHDRAW": {
		Des:     "用户ID %d 发起了提现请求,提现金额为 %s",
		Message: "用户提现",
	},
	"LOGIN": {
		Des:     "用户ID %d 成功登录,登录时间为 %s",
		Message: "用户登录",
	},
	"MERGE_ACCOUNT": {
		Des:     "用户ID %d 发起合并账户,被合并账户ID %d,合并后账户ID %d",
		Message: "用户合并账户",
	},
	"REGISTER": {
		Des:     "用户ID %d 完成了注册,注册时使用的手机号是 %s",
		Message: "用户注册",
	},
	"BALANCE_CHANGE": {
		Des:     "用户ID %d 原余额:%.2f,变更金额是: %.2f, 变更后余额:%.2f",
		Message: "用户余额变更",
	},
	"SMS_LOG": {
		Des:     "用户ID %d 短信内容: %s",
		Message: "短信日志",
	},
}

ActionTypeCodes 定义状态和提示信息

SmsTypeSlice 定义 SmsTypeSlice 包含所有预定义的短信类型

View Source
var StatusCodes = map[string]StatusMessage{
	"Success": {
		Code:    1,
		Message: "操作成功",
	},
	"Error": {
		Code:    0,
		Message: "操作失败",
	},
	"SnBlank": {
		Code:    0,
		Message: "sn 不能为空",
	},
	"CodeInvalid": {
		Code:    0,
		Message: "Code无效的代码",
	},
	"AppIdInvalid": {
		Code:    0,
		Message: "无效的 AppId",
	},
	"DeviceInfoError": {
		Code:    0,
		Message: "设备暂未开通",
	},
	"OpenIdInvalid": {
		Code:    0,
		Message: "无效的 OpenId",
	},
	"UuiDInvalid": {
		Code:    0,
		Message: "无效的 UuId",
	},
	"SignNameInvalid": {
		Code:    0,
		Message: "无效的 SignName",
	},
	"SmsCodeInvalid": {
		Code:    0,
		Message: "无效的 SmsCode",
	},
	"PhoneMergeConflictInvalid": {
		Code:    0,
		Message: "合并手机号不能是当前手机号",
	},
	"ErrPendingData": {
		Code:    0,
		Message: "当前有正在处理的数据,暂时无法合并,请稍后再试",
	},
	"DataConflict": {
		Code:    0,
		Message: "系统存在冲突数据请仔细检查,或联系管理员",
	},
	"SmsTypeInvalid": {
		Code:    0,
		Message: "短信类型不正确",
	},
	"ImageCaptchaInvalid": {
		Code:    0,
		Message: "图形验证码不正确",
	},
	"UserTypeInvalid": {
		Code:    0,
		Message: "用户类型不正确",
	},
}

StatusCodes 定义状态和提示信息

Functions

func CheckSmsTypeNo added in v0.0.19

func CheckSmsTypeNo(smsType string) bool

CheckSmsTypeNo 检查传入的短信类型是否在预定义的 SmsType 常量中

func GetSmsKey added in v0.0.15

func GetSmsKey(smsKey, phone string) string

GetSmsKey 返回缓存值数据

func ReplaceTemplateValues added in v0.0.19

func ReplaceTemplateValues(template string, values map[string]string) (jsonStr string, str string)

ReplaceTemplateValues 替换模板中的占位符并返回 JSON 格式的字符串,只包含使用到的变量

Types

type ActionTypeMessage added in v0.0.17

type ActionTypeMessage struct {
	Des     string
	Message string
}

ActionTypeMessage 操作动作类型信息

type StatusMessage

type StatusMessage struct {
	Code    int32
	Message string
}

StatusMessage 状态和提示信息的结构体

Jump to

Keyboard shortcuts

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