diff --git a/lib/dborm/dborm.go b/lib/dborm/dborm.go index f35c7ee7..a638dd54 100644 --- a/lib/dborm/dborm.go +++ b/lib/dborm/dborm.go @@ -1402,11 +1402,11 @@ type MeasureThreshold struct { type NeSoftware struct { Id int `json:"id" xorm:"pk 'id' autoincr"` NeType string `json:"neType" xorm:"ne_type"` - FileName string `json:"neName" xorm:"file_name"` - Path string `json:"path"` - Version string `json:"version"` - Md5Sum string `json:"md5Sum" xorm:"md5_sum"` - Comment string `json:"comment"` + FileName string `json:"fileName" xorm:"name"` + Path string `json:"path" xorm:"path"` + Version string `json:"version" ` + Md5Sum string `json:"md5Sum" xorm:"-"` + Comment string `json:"comment" xorm:"description"` // Status string `json:"status"` UpdateTime string `json:"createTime" xorm:"-" ` } @@ -1415,18 +1415,18 @@ type NeVersion struct { Id int `json:"id" xorm:"pk 'id' autoincr"` NeType string `json:"neType" xorm:"ne_type"` NeId string `json:"neId" xorm:"ne_id"` - Version string `json:"version"` - FilePath string `json:"filePath" xorm:"file_path"` + Version string `json:"version" ` + FilePath string `json:"filePath" xorm:"path"` 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"` - PreFile string `json:"preFile" xorm:"pre_file"` - Status string `json:"status"` + PreFile string `json:"preFile" xorm:"pre_path"` + Status string `json:"status" xorm:"status"` UpdateTime string `json:"createTime" xorm:"-" ` } func XormGetDataBySQL(sql string) (*[]map[string]string, error) { - //log.Debug("XormGetDataBySQL processing... ") + log.Debug("XormGetDataBySQL processing... ") rows := make([]map[string]string, 0) rows, err := DbClient.XEngine.QueryString(sql) @@ -1698,25 +1698,26 @@ func IsPermissionAllowed(token, method, module, dbname, tbname, pack string) (bo type NeLicense struct { NeType string `json:"neType" xorm:"ne_type"` NeID string `json:"neID" xorm:"ne_id"` - SerialNo string `json:"serialNo" xorm:"serial_no"` - Capcity int `json:"capcity" xorm:"capcity"` - Used int `json:"used" xorm:"used"` - FeatureEnabled string `json:"featureEnabled" xorm:"feature_enabled"` - ExpirationDate string `json:"expirationDate" xorm:"expiration_date"` + SerialNo string `json:"serialNo" xorm:"serial_num"` + Capcity int `json:"capcity" xorm:"-"` + Used int `json:"used" xorm:"-"` + FeatureEnabled string `json:"featureEnabled" xorm:"-"` + ExpirationDate string `json:"expirationDate" xorm:"expiry_date"` Status string `json:"status" xorm:"status"` - Path string `json:"path" xorm:"path"` - FileName string `json:"file_name" xorm:"file_name"` - Comment string `json:"comment" xorm:"comment"` + Path string `json:"path" xorm:"license_path"` + FileName string `json:"file_name" xorm:"-"` + Comment string `json:"comment" xorm:"remark"` CreatedAt string `json:"createdAt" xorm:"-"` UpdatedAt string `json:"updatedAt" xorm:"-"` DeletedAt string `json:"deletedAt" xorm:"-"` } func XormAdjustmentNeLicense(neType, neID string, value int) (int64, error) { + return 1, nil //neLicense := NeLicense{NeType: neType, NeID: neID, Capability: value} // session.LogoutTime.Valid = true // 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() //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) // err := xSession.SQL("update ne_license set capability=capability+? where ne_type=? and ne_id=?", value, neType, neID) //xSession.Commit() - affected, err := res.RowsAffected() - return affected, err + // affected, err := res.RowsAffected() + // return affected, err } func XormUpdateNeLicense(neType, neID string, capcity int) (int64, error) { - var err error - var res sql.Result - if neType != "" && neID != "" { - res, err = xEngine.Exec("update ne_license set capcity=? where ne_type=? and ne_id=?", capcity, neType, neID) - } else if neType != "" && neID == "" { - res, err = xEngine.Exec("update ne_license set capcity=? where ne_type=?", capcity, neType) - } else if neType == "" && neID != "" { - res, err = xEngine.Exec("update ne_license set capcity=? where ne_id=?", capcity, neID) - } else { - res, err = xEngine.Exec("update ne_license set capcity=?", capcity) - } + return 1, nil + // var err error + // var res sql.Result + // if neType != "" && neID != "" { + // res, err = xEngine.Exec("update ne_license set capcity=? where ne_type=? and ne_id=?", capcity, neType, neID) + // } else if neType != "" && neID == "" { + // res, err = xEngine.Exec("update ne_license set capcity=? where ne_type=?", capcity, neType) + // } else if neType == "" && neID != "" { + // res, err = xEngine.Exec("update ne_license set capcity=? where ne_id=?", capcity, neID) + // } else { + // res, err = xEngine.Exec("update ne_license set capcity=?", capcity) + // } - affected, err := res.RowsAffected() - return affected, err + // affected, err := res.RowsAffected() + // return affected, err } type NorthboundCm struct {