Commit d3281af441bfc3f8dc124d93ce4386bc22194ff6

Authored by 陆恒
1 parent 413dc8cd

修复bug

Showing 1 changed file with 14 additions and 0 deletions   Show diff stats
src/HttpServer/logic/function.go
... ... @@ -301,6 +301,20 @@ func GetTaskInfo(uuid int, tasktype int, channel string) (*TaskList, error) {
301 301 var err error
302 302 if tasktype == 1 {
303 303 data, err = redishandler.GetRedisClient().HGet(redis.USER_TASKINFO_LIST, unqiueuuid)
  304 + //兼容老的数据
  305 + if err != nil {
  306 + //没有读到数据 则去读取一下老的id
  307 + olddata, err := redishandler.GetRedisClient().HGet(redis.USER_TASKINFO_LIST, strconv.Itoa(uuid))
  308 + if err == nil {
  309 + err = redishandler.GetRedisClient().HSet(redis.USER_TASKINFO_LIST, unqiueuuid, olddata)
  310 + if err == nil {
  311 + //删除老的数据 以后都走新的数据
  312 + err = redishandler.GetRedisClient().HDel(redis.USER_TASKINFO_LIST, strconv.Itoa(uuid))
  313 +
  314 + }
  315 + data, err = redishandler.GetRedisClient().HGet(redis.USER_TASKINFO_LIST, unqiueuuid)
  316 + }
  317 + }
304 318 } else if tasktype == 2 {
305 319 data, err = redishandler.GetRedisClient().HGet(redis.USER_ACHIEVEMENTINFO_LIST, unqiueuuid)
306 320 //成就这一块需要兼容老的数据
... ...