Compare commits

..

2 Commits

Author SHA1 Message Date
junleea ca400be8b8 Merge branch 'refs/heads/feat-file'
# Conflicts:
#	service/userService.go
2024-12-27 20:45:19 +08:00
junleea 80cafbc839 用户同步问题 2024-12-27 20:44:50 +08:00
2 changed files with 14 additions and 3 deletions

View File

@ -121,10 +121,10 @@ func UserSyncDataFromMaster() {
fmt.Println("All ClearAllUsers error:", err)
return
}
worker.SetRedis("user_sync_all", "2")
worker.SetRedisForever("user_sync_all", "1")
req.Types = 1
} else {
worker.SetRedis("user_sync_all", "2")
worker.SetRedisForever("user_sync_all", "2")
req.Types = 2
}
@ -184,7 +184,7 @@ func UserSyncDataFromMaster() {
confirm_req.Confirm = data
worker.SyncDataFromMasterReq2(url, confirm_req)
} else {
worker.SetRedis("user_sync_all", "2")
worker.SetRedisForever("user_sync_all", "2")
}
}

View File

@ -71,6 +71,17 @@ func SetRedis(key string, value string) bool {
return true
}
// 设置redis,永久
func SetRedisForever(key string, value string) bool {
ctx := context.Background()
err := RedisClient.Set(ctx, key, value, 0).Err()
if err != nil {
fmt.Println("Error setting key: %v", err)
return false
}
return true
}
// 设置hash
func SetHashWithTime(key string, id int, name, email string, duration time.Duration) bool {
//捕获错误,如果错误返回