mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
fix: redis集群修复
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
type Redis struct {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user