Merge branch 'main' into multi-tenant
This commit is contained in:
@@ -428,68 +428,6 @@ func XormParseResult(body []byte) ([]NeInfo, error) {
|
||||
return neInfo, nil
|
||||
}
|
||||
|
||||
type ParamConfig struct {
|
||||
// Id int `json:"id" xorm:"pk 'id' autoincr"`
|
||||
NeType string `json:"neType"`
|
||||
NeId string `json:"neId"`
|
||||
TopTag string `json:"topTag"`
|
||||
TopDisplay string `json:"topDisplay"`
|
||||
ParamJson string `json:"paramJson"`
|
||||
}
|
||||
|
||||
func XormInsertParamConfig(mapJson *map[string]interface{}) (int64, error) {
|
||||
var affected, a int64
|
||||
var err error
|
||||
paramConfig := new(ParamConfig)
|
||||
for n, d := range *mapJson {
|
||||
if d == nil {
|
||||
break
|
||||
}
|
||||
log.Debugf("n: %s", n)
|
||||
|
||||
for t, p := range d.(map[string]interface{}) {
|
||||
if p == nil {
|
||||
break
|
||||
}
|
||||
log.Debug("t:", t)
|
||||
log.Debug("p:", p)
|
||||
for k, v := range p.(map[string]interface{}) {
|
||||
log.Debug("k, v: ", k, v)
|
||||
if k == "display" {
|
||||
paramConfig.TopDisplay = fmt.Sprintf("%v", v)
|
||||
|
||||
} else {
|
||||
pc, _ := json.Marshal(v)
|
||||
paramConfig.ParamJson = fmt.Sprintf("{\"%v\":%v}", k, string(pc))
|
||||
}
|
||||
}
|
||||
|
||||
paramConfig.NeType = strings.ToUpper(n)
|
||||
paramConfig.NeId = ""
|
||||
paramConfig.TopTag = t
|
||||
// paramConfig.TopDisplay = p["display"]
|
||||
// paramConfig.ParamJson = p.(string)
|
||||
|
||||
log.Debug("paramConfig:", paramConfig)
|
||||
|
||||
xSession := xEngine.NewSession()
|
||||
defer xSession.Close()
|
||||
_, err = xSession.Table("param_config").Where("ne_type = ? and top_tag = ?", paramConfig.NeType, paramConfig.TopTag).Delete()
|
||||
if err != nil {
|
||||
log.Error("Failed to insert param_config:", err)
|
||||
}
|
||||
a, err = xSession.Insert(paramConfig)
|
||||
if err != nil {
|
||||
log.Error("Failed to insert param_config:", err)
|
||||
}
|
||||
affected += a
|
||||
xSession.Commit()
|
||||
}
|
||||
}
|
||||
|
||||
return affected, err
|
||||
}
|
||||
|
||||
func ConstructUpdateSQLArray(tableName string, updateData interface{}, whereCondition string) (string, []string) {
|
||||
log.Debug("ConstructUpdateSQL processing... ")
|
||||
log.Debug("Request updateData:", updateData)
|
||||
|
||||
@@ -9,14 +9,15 @@ import (
|
||||
)
|
||||
|
||||
type FileInfo struct {
|
||||
FileType string `json:"fileType"` // 文件类型
|
||||
FileMode string `json:"fileMode"` // 文件的权限
|
||||
LinkCount int64 `json:"linkCount"` // 硬链接数目
|
||||
Owner string `json:"owner"` // 所属用户
|
||||
Group string `json:"group"` // 所属组
|
||||
Size int64 `json:"size"` // 文件的大小
|
||||
ModifiedTime int64 `json:"modifiedTime"` // 最后修改时间,单位为秒
|
||||
FileName string `json:"fileName"` // 文件的名称
|
||||
FileType string `json:"fileType"` // file type: file/directory
|
||||
FileMode string `json:"fileMode"` // file mode
|
||||
LinkCount int64 `json:"linkCount"` // link count
|
||||
Owner string `json:"owner"` // owner
|
||||
Group string `json:"group"` // group
|
||||
Size int64 `json:"size"` // size: xx byte
|
||||
ModifiedTime int64 `json:"modifiedTime"` // last modified time:seconds
|
||||
FilePath string `json:"filePath"` // file path
|
||||
FileName string `json:"fileName"` // file name
|
||||
}
|
||||
|
||||
func GetFileInfo(dir, suffix string) ([]FileInfo, error) {
|
||||
@@ -48,6 +49,7 @@ func GetFileInfo(dir, suffix string) ([]FileInfo, error) {
|
||||
Group: "-",
|
||||
Size: info.Size(),
|
||||
ModifiedTime: info.ModTime().Unix(),
|
||||
FilePath: dir,
|
||||
FileName: info.Name(),
|
||||
}
|
||||
files = append(files, fileInfo)
|
||||
|
||||
@@ -207,13 +207,6 @@ func init() {
|
||||
Register("PUT", cm.CustomUriSoftwareNE, cm.ActiveSoftwareToNF, nil)
|
||||
Register("PATCH", cm.CustomUriSoftwareNE, cm.RollBackSoftwareToNF, nil)
|
||||
|
||||
// License management
|
||||
Register("POST", cm.UriLicense, cm.UploadLicenseFileData, midware.LogOperate(collectlogs.OptionNew("License", collectlogs.BUSINESS_TYPE_INSERT)))
|
||||
Register("POST", cm.UriLicenseExt, cm.UploadLicenseFileData, midware.LogOperate(collectlogs.OptionNew("License", collectlogs.BUSINESS_TYPE_INSERT)))
|
||||
|
||||
Register("POST", cm.CustomUriLicense, cm.UploadLicenseFileData, nil)
|
||||
Register("POST", cm.CustomUriLicenseExt, cm.UploadLicenseFileData, nil)
|
||||
|
||||
// Trace management 跟踪任务
|
||||
Register("POST", trace.UriTraceTask, trace.PostTraceTaskToNF, midware.LogOperate(collectlogs.OptionNew("Trace Task", collectlogs.BUSINESS_TYPE_INSERT)))
|
||||
Register("PUT", trace.UriTraceTask, trace.PutTraceTaskToNF, midware.LogOperate(collectlogs.OptionNew("Trace Task", collectlogs.BUSINESS_TYPE_UPDATE)))
|
||||
|
||||
Reference in New Issue
Block a user