fix: redis集群修复

This commit is contained in:
meilin.huang
2023-03-17 09:46:41 +08:00
parent 110abc4ac7
commit 738ff86344
8 changed files with 30 additions and 16 deletions

View File

@@ -87,6 +87,9 @@ func (d *dbAppImpl) Save(dbEntity *entity.Db) {
// 查找是否存在该库
oldDb := &entity.Db{Host: dbEntity.Host, Port: dbEntity.Port, Username: dbEntity.Username}
if dbEntity.SshTunnelMachineId > 0 {
oldDb.SshTunnelMachineId = dbEntity.SshTunnelMachineId
}
err := d.GetDbBy(oldDb)
if dbEntity.Id == 0 {

View File

@@ -62,6 +62,9 @@ func (m *machineAppImpl) Count(condition *entity.MachineQuery) int64 {
func (m *machineAppImpl) Save(me *entity.Machine) {
oldMachine := &entity.Machine{Ip: me.Ip, Port: me.Port, Username: me.Username}
if me.SshTunnelMachineId > 0 {
oldMachine.SshTunnelMachineId = me.SshTunnelMachineId
}
err := m.GetMachine(oldMachine)
me.PwdEncrypt()

View File

@@ -18,7 +18,7 @@ import (
"sync"
"time"
"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"
)
type Redis struct {

View File

@@ -18,7 +18,7 @@ import (
"strings"
"time"
"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"
)
type Redis interface {
@@ -81,6 +81,9 @@ func (r *redisAppImpl) Save(re *entity.Redis) {
// 查找是否存在该库
oldRedis := &entity.Redis{Host: re.Host}
if re.SshTunnelMachineId > 0 {
oldRedis.SshTunnelMachineId = re.SshTunnelMachineId
}
err := r.GetRedisBy(oldRedis)
if re.Id == 0 {