...
|
...
|
@@ -284,18 +284,21 @@ func CheckToken(request *protocol.CheckTokenRequest) (rsp *protocol.CheckTokenRe |
|
|
|
|
|
//检查uuid 是否重复
|
|
|
func CheckUuid(request *protocol.CheckUuidRequest) (rsp *protocol.CheckUuidResponse, err error) {
|
|
|
//var (
|
|
|
// logUuid *models.LogUuid
|
|
|
//)
|
|
|
//if len(request.Uuid) == 0 {
|
|
|
// err = common.NewErrorWithMsg(4142, "uuid not empty")
|
|
|
//}
|
|
|
//logUuid, err = models.GetLogUuidByUuid(request.Uuid)
|
|
|
//if err == nil && logUuid != nil {
|
|
|
// err = common.NewErrorWithMsg(4142, "uuid not valid")
|
|
|
//}
|
|
|
//models.AddLogUuid(&models.LogUuid{Uuid: request.Uuid})
|
|
|
//rsp = &protocol.CheckUuidResponse{}
|
|
|
var ()
|
|
|
rsp = &protocol.CheckUuidResponse{}
|
|
|
if len(request.Uuid) == 0 || (request.Uuid == "123456" && beego.BConfig.RunMode != "prod") {
|
|
|
return
|
|
|
}
|
|
|
if redis.Hexists(protocol.RedisKey(protocol.HashUuid), request.Uuid) {
|
|
|
err = protocol.NewErrWithMessage(4142)
|
|
|
log.Error("[CheckUuid] 存在:", request.Uuid, err)
|
|
|
return
|
|
|
}
|
|
|
if e := redis.Hset(protocol.RedisKey(protocol.HashUuid), request.Uuid, request.Uuid, 3600*2); e == nil {
|
|
|
err = protocol.NewErrWithMessage(4142)
|
|
|
log.Error("[CheckUuid] 设置:", request.Uuid, e)
|
|
|
return
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
|