fix: 旧数据软件包/版本管理的结构体变更

This commit is contained in:
TsMask
2024-04-11 17:15:03 +08:00
parent 841067a8bf
commit b4df83f662

View File

@@ -1402,11 +1402,11 @@ type MeasureThreshold struct {
type NeSoftware struct { type NeSoftware struct {
Id int `json:"id" xorm:"pk 'id' autoincr"` Id int `json:"id" xorm:"pk 'id' autoincr"`
NeType string `json:"neType" xorm:"ne_type"` NeType string `json:"neType" xorm:"ne_type"`
FileName string `json:"neName" xorm:"file_name"` FileName string `json:"fileName" xorm:"name"`
Path string `json:"path"` Path string `json:"path" xorm:"path"`
Version string `json:"version"` Version string `json:"version" `
Md5Sum string `json:"md5Sum" xorm:"md5_sum"` Md5Sum string `json:"md5Sum" xorm:"-"`
Comment string `json:"comment"` Comment string `json:"comment" xorm:"description"`
// Status string `json:"status"` // Status string `json:"status"`
UpdateTime string `json:"createTime" xorm:"-" ` UpdateTime string `json:"createTime" xorm:"-" `
} }
@@ -1415,18 +1415,18 @@ type NeVersion struct {
Id int `json:"id" xorm:"pk 'id' autoincr"` Id int `json:"id" xorm:"pk 'id' autoincr"`
NeType string `json:"neType" xorm:"ne_type"` NeType string `json:"neType" xorm:"ne_type"`
NeId string `json:"neId" xorm:"ne_id"` NeId string `json:"neId" xorm:"ne_id"`
Version string `json:"version"` Version string `json:"version" `
FilePath string `json:"filePath" xorm:"file_path"` FilePath string `json:"filePath" xorm:"path"`
NewVersion string `json:"newVersion" xorm:"new_version"` NewVersion string `json:"newVersion" xorm:"new_version"`
NewFile string `json:"newFile" xorm:"new_file"` NewFile string `json:"newFile" xorm:"new_path"`
PreVersion string `json:"preVersion" xorm:"pre_version"` PreVersion string `json:"preVersion" xorm:"pre_version"`
PreFile string `json:"preFile" xorm:"pre_file"` PreFile string `json:"preFile" xorm:"pre_path"`
Status string `json:"status"` Status string `json:"status" xorm:"status"`
UpdateTime string `json:"createTime" xorm:"-" ` UpdateTime string `json:"createTime" xorm:"-" `
} }
func XormGetDataBySQL(sql string) (*[]map[string]string, error) { func XormGetDataBySQL(sql string) (*[]map[string]string, error) {
//log.Debug("XormGetDataBySQL processing... ") log.Debug("XormGetDataBySQL processing... ")
rows := make([]map[string]string, 0) rows := make([]map[string]string, 0)
rows, err := DbClient.XEngine.QueryString(sql) rows, err := DbClient.XEngine.QueryString(sql)
@@ -1698,25 +1698,26 @@ func IsPermissionAllowed(token, method, module, dbname, tbname, pack string) (bo
type NeLicense struct { type NeLicense struct {
NeType string `json:"neType" xorm:"ne_type"` NeType string `json:"neType" xorm:"ne_type"`
NeID string `json:"neID" xorm:"ne_id"` NeID string `json:"neID" xorm:"ne_id"`
SerialNo string `json:"serialNo" xorm:"serial_no"` SerialNo string `json:"serialNo" xorm:"serial_num"`
Capcity int `json:"capcity" xorm:"capcity"` Capcity int `json:"capcity" xorm:"-"`
Used int `json:"used" xorm:"used"` Used int `json:"used" xorm:"-"`
FeatureEnabled string `json:"featureEnabled" xorm:"feature_enabled"` FeatureEnabled string `json:"featureEnabled" xorm:"-"`
ExpirationDate string `json:"expirationDate" xorm:"expiration_date"` ExpirationDate string `json:"expirationDate" xorm:"expiry_date"`
Status string `json:"status" xorm:"status"` Status string `json:"status" xorm:"status"`
Path string `json:"path" xorm:"path"` Path string `json:"path" xorm:"license_path"`
FileName string `json:"file_name" xorm:"file_name"` FileName string `json:"file_name" xorm:"-"`
Comment string `json:"comment" xorm:"comment"` Comment string `json:"comment" xorm:"remark"`
CreatedAt string `json:"createdAt" xorm:"-"` CreatedAt string `json:"createdAt" xorm:"-"`
UpdatedAt string `json:"updatedAt" xorm:"-"` UpdatedAt string `json:"updatedAt" xorm:"-"`
DeletedAt string `json:"deletedAt" xorm:"-"` DeletedAt string `json:"deletedAt" xorm:"-"`
} }
func XormAdjustmentNeLicense(neType, neID string, value int) (int64, error) { func XormAdjustmentNeLicense(neType, neID string, value int) (int64, error) {
return 1, nil
//neLicense := NeLicense{NeType: neType, NeID: neID, Capability: value} //neLicense := NeLicense{NeType: neType, NeID: neID, Capability: value}
// session.LogoutTime.Valid = true // session.LogoutTime.Valid = true
// session.LogoutTime.Time = time.Now() // session.LogoutTime.Time = time.Now()
res, err := xEngine.Exec("update ne_license set capcity=capcity+? where IFNULL(ne_type, '')=? and IFNULL(ne_id, '')=?", value, neType, neID) // res, err := xEngine.Exec("update ne_license set capcity=capcity+? where IFNULL(ne_type, '')=? and IFNULL(ne_id, '')=?", value, neType, neID)
// defer xSession.Close() // defer xSession.Close()
//affected, err := xSession.Table("ne_license").Where("ne_type=? and ne_id=?", neType, neID).Update(&neLicense) //affected, err := xSession.Table("ne_license").Where("ne_type=? and ne_id=?", neType, neID).Update(&neLicense)
@@ -1724,25 +1725,26 @@ func XormAdjustmentNeLicense(neType, neID string, value int) (int64, error) {
// //affected, err := xSession.Table("ne_license").SQL("ne_tye=? and ne_id=?", neType, neID).Update(session) // //affected, err := xSession.Table("ne_license").SQL("ne_tye=? and ne_id=?", neType, neID).Update(session)
// err := xSession.SQL("update ne_license set capability=capability+? where ne_type=? and ne_id=?", value, neType, neID) // err := xSession.SQL("update ne_license set capability=capability+? where ne_type=? and ne_id=?", value, neType, neID)
//xSession.Commit() //xSession.Commit()
affected, err := res.RowsAffected() // affected, err := res.RowsAffected()
return affected, err // return affected, err
} }
func XormUpdateNeLicense(neType, neID string, capcity int) (int64, error) { func XormUpdateNeLicense(neType, neID string, capcity int) (int64, error) {
var err error return 1, nil
var res sql.Result // var err error
if neType != "" && neID != "" { // var res sql.Result
res, err = xEngine.Exec("update ne_license set capcity=? where ne_type=? and ne_id=?", capcity, neType, neID) // if neType != "" && neID != "" {
} else if neType != "" && neID == "" { // res, err = xEngine.Exec("update ne_license set capcity=? where ne_type=? and ne_id=?", capcity, neType, neID)
res, err = xEngine.Exec("update ne_license set capcity=? where ne_type=?", capcity, neType) // } else if neType != "" && neID == "" {
} else if neType == "" && neID != "" { // res, err = xEngine.Exec("update ne_license set capcity=? where ne_type=?", capcity, neType)
res, err = xEngine.Exec("update ne_license set capcity=? where ne_id=?", capcity, neID) // } else if neType == "" && neID != "" {
} else { // res, err = xEngine.Exec("update ne_license set capcity=? where ne_id=?", capcity, neID)
res, err = xEngine.Exec("update ne_license set capcity=?", capcity) // } else {
} // res, err = xEngine.Exec("update ne_license set capcity=?", capcity)
// }
affected, err := res.RowsAffected() // affected, err := res.RowsAffected()
return affected, err // return affected, err
} }
type NorthboundCm struct { type NorthboundCm struct {