fix: machine file & i18n & icon

This commit is contained in:
meilin.huang
2025-01-07 21:02:27 +08:00
parent f30841209c
commit 1be7a0ec79
20 changed files with 268 additions and 243 deletions

View File

@@ -32,8 +32,8 @@ require (
github.com/tidwall/gjson v1.18.0
github.com/veops/go-ansiterm v0.0.5
go.mongodb.org/mongo-driver v1.16.0 // mongo
golang.org/x/crypto v0.31.0 // ssh
golang.org/x/oauth2 v0.24.0
golang.org/x/crypto v0.32.0 // ssh
golang.org/x/oauth2 v0.25.0
golang.org/x/sync v0.10.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v3 v3.0.1
@@ -93,7 +93,7 @@ require (
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/image v0.13.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
modernc.org/libc v1.22.5 // indirect

View File

@@ -21,6 +21,7 @@ import (
"time"
"github.com/google/uuid"
"github.com/may-fly/cast"
)
type DataSyncTask interface {
@@ -348,7 +349,7 @@ func (app *dataSyncAppImpl) srcData2TargetDb(srcRes []map[string]any, fieldMap [
updFieldVal = srcRes[len(srcRes)-1][strings.ToLower(field)]
}
task.UpdFieldVal = updFieldType.DataType.SQLValue(updFieldVal)
task.UpdFieldVal = cast.ToString(updFieldVal)
}
// 如果指定了更新字段,则以更新字段取值

View File

@@ -479,7 +479,7 @@ func (d *dbSqlExecAppImpl) doUpdate(ctx context.Context, sqlExecParam *sqlExecPa
nowRec++
res = append(res, row)
if nowRec == maxRec {
return errorx.NewBiz(fmt.Sprintf("update SQL - the maximum number of updated queries is exceeded: %d", maxRec))
return errorx.NewBiz("update SQL - the maximum number of updated queries is exceeded: %d", maxRec)
}
return nil
})
@@ -535,12 +535,13 @@ func (d *dbSqlExecAppImpl) doDelete(ctx context.Context, sqlExecParam *sqlExecPa
}
execRecord.Table = tableName
whereStr := deletestmt.Where.GetText()
if whereStr == "" {
deleteWhere := deletestmt.Where
if deleteWhere == nil {
logx.ErrorContext(ctx, "delete SQL - there is no where condition")
return d.doExec(ctx, dbConn, sqlExecParam.Sql)
}
whereStr := deleteWhere.GetText()
// 查询删除数据
selectSql := fmt.Sprintf("SELECT * FROM %s where %s LIMIT 200", tableName+" "+tableAlias, whereStr)
_, res, _ := dbConn.QueryContext(ctx, selectSql)

View File

@@ -67,13 +67,13 @@ func (dbInfo *DbInfo) Conn(meta Meta) (*DbConn, error) {
conn, err := meta.GetSqlDb(dbInfo)
if err != nil {
logx.Errorf("db connection failed: %s:%d/%s, err:%s", dbInfo.Host, dbInfo.Port, database, err.Error())
return nil, errorx.NewBiz(fmt.Sprintf("db connection failed: %s", err.Error()))
return nil, errorx.NewBiz("db connection failed: %s", err.Error())
}
err = conn.Ping()
if err != nil {
logx.Errorf("db ping failed: %s:%d/%s, err:%s", dbInfo.Host, dbInfo.Port, database, err.Error())
return nil, errorx.NewBiz(fmt.Sprintf("db connection failed: %s", err.Error()))
return nil, errorx.NewBiz("db connection failed: %s", err.Error())
}
dbc := &DbConn{Id: GetDbConnId(dbInfo.Id, database), Info: dbInfo}

View File

@@ -279,7 +279,7 @@ func (m *machineFileAppImpl) WriteFileContent(ctx context.Context, opParam *dto.
return nil, err
}
f, err := sftpCli.OpenFile(path, os.O_RDWR)
f, err := sftpCli.OpenFile(path, os.O_RDWR|os.O_APPEND|os.O_TRUNC)
if err != nil {
return mi, err
}