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