MML
This commit is contained in:
@@ -1499,3 +1499,42 @@ func IsPermissionAllowed(token, method, dbname, tbname string) (bool, error) {
|
||||
|
||||
return exist, nil
|
||||
}
|
||||
|
||||
type NeLicense struct {
|
||||
NeType string `json:"neType" xorm:"ne_type"`
|
||||
NeID string `json:"neID" xorm:"ne_id"`
|
||||
Capability int `json:"capability"`
|
||||
}
|
||||
|
||||
func XormAdjustmentNeLicense(neType, neID string, value int) (int64, error) {
|
||||
//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)
|
||||
// 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").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
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
affected, err := res.RowsAffected()
|
||||
return affected, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user