Commit a5d8d660ad26df113bebdea79e93f3f8ba5cf381
1 parent
c875ecb0
Exists in
master
提交
Showing
2 changed files
with
10 additions
and
12 deletions
Show diff stats
src/HttpServer/logic/httpserver.go
| ... | ... | @@ -90,29 +90,26 @@ func Testsendhttp() { |
| 90 | 90 | redishandler.GetRedisClient().HDel(redis.USER_TASKINFO_LIST, oneuid) |
| 91 | 91 | redishandler.GetRedisClient().HDel(redis.USER_ACHIEVEMENTINFO_LIST, oneuid)*/ |
| 92 | 92 | //存入mysql |
| 93 | - //info,_ := redishandler.GetRedisClient().HGet(redis.USER_DATA_KEY, oneuid) | |
| 94 | - //task, _ := redishandler.GetRedisClient().HGet(redis.USER_TASKINFO_LIST, oneuid) | |
| 93 | + info,_ := redishandler.GetRedisClient().HGet(redis.USER_DATA_KEY, oneuid) | |
| 94 | + task, _ := redishandler.GetRedisClient().HGet(redis.USER_TASKINFO_LIST, oneuid) | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | - //ach, _ := redishandler.GetRedisClient().HGet(redis.USER_ACHIEVEMENTINFO_LIST, oneuid) | |
| 97 | + ach, _ := redishandler.GetRedisClient().HGet(redis.USER_ACHIEVEMENTINFO_LIST, oneuid) | |
| 98 | 98 | |
| 99 | - err := mysql.DoBackUp(oneuid,"info","task","ach") | |
| 99 | + err := mysql.DoBackUp(oneuid,info,task,ach) | |
| 100 | 100 | if err != nil { |
| 101 | 101 | logger.Error("Testsendhttp err=%v",err) |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if right >= 2 { | |
| 105 | - break | |
| 106 | - } | |
| 107 | 104 | }else { |
| 108 | 105 | if oneuid == "5943465P_D_BL01_4" { |
| 109 | - //info,_ := redishandler.GetRedisClient().HGet(redis.USER_DATA_KEY, oneuid) | |
| 110 | - //task, _ := redishandler.GetRedisClient().HGet(redis.USER_TASKINFO_LIST, oneuid) | |
| 106 | + info,_ := redishandler.GetRedisClient().HGet(redis.USER_DATA_KEY, oneuid) | |
| 107 | + task, _ := redishandler.GetRedisClient().HGet(redis.USER_TASKINFO_LIST, oneuid) | |
| 111 | 108 | |
| 112 | 109 | |
| 113 | - //ach, _ := redishandler.GetRedisClient().HGet(redis.USER_ACHIEVEMENTINFO_LIST, oneuid) | |
| 110 | + ach, _ := redishandler.GetRedisClient().HGet(redis.USER_ACHIEVEMENTINFO_LIST, oneuid) | |
| 114 | 111 | |
| 115 | - err := mysql.DoBackUp(oneuid,"1","task","ach") | |
| 112 | + err := mysql.DoBackUp(oneuid,info,task,ach) | |
| 116 | 113 | if err != nil { |
| 117 | 114 | logger.Error("Testsendhttp err=%v",err) |
| 118 | 115 | } | ... | ... |
src/mysql/dbmysql.go
| ... | ... | @@ -75,7 +75,8 @@ func TestClearData(uid int) (int,error) { |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | func DoBackUp(uuid string,info string,task string,ach string) error { |
| 78 | - cmd := "INSERT into hedaoshi VALUES(" + uuid + "," + info + "," + task + "," + ach + ")" | |
| 78 | + cmd := fmt.Sprintf("INSERT into hedaoshi VALUES(%s,%s,%s,%s) ON DUPLICATE KEY UPDATE update info=%s ,task=%s,ach=%s", uuid,info,task,ach,info,task,ach) | |
| 79 | + //cmd := "INSERT into hedaoshi VALUES(" + uuid + "," + info + "," + task + "," + ach + ")" | |
| 79 | 80 | err := ExcuteCmd(cmd) |
| 80 | 81 | if err != nil { |
| 81 | 82 | logger.Error("DoClearData err=%v,cmd=%v",err,cmd) | ... | ... |