redis.go
830 字节
package protocol
import (
"fmt"
"github.com/astaxie/beego"
)
//短信类型
const (
SmsCode = "sms_code"
SmsLoginCode = "sms_login_code"
SmsChangeMobile = "sms_change_mobile"
)
type SmsInfo struct {
Code string `json:"code"`
Count int `json:"count"`
ErrorCount int `json:"error_count"`
LastTime int64 `json:"last_time"`
CreateTime int64 `json:"create_time"`
Checked int `json:"checked"` //0:未校验证 1:已校验
}
//redis键值
func RedisKey(businessKey string) string {
//项目:环境:业务码
return fmt.Sprintf("%v:%v:%v", "opp", beego.BConfig.RunMode, businessKey)
}
//redis键值 项标识
func RedisKeyWithId(businessKey string, id int64) string {
//项目:环境:业务码
return fmt.Sprintf("%v:%v:%v:%v", "opp", beego.BConfig.RunMode, businessKey, id)
}