MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / IncreaseUserQuota

Function IncreaseUserQuota

model/user.go:665–680  ·  view source on GitHub ↗
(id int, quota int, db bool)

Source from the content-addressed store, hash-verified

663}
664
665func IncreaseUserQuota(id int, quota int, db bool) (err error) {
666 if quota < 0 {
667 return errors.New("quota 不能为负数!")
668 }
669 gopool.Go(func() {
670 err := cacheIncrUserQuota(id, int64(quota))
671 if err != nil {
672 common.SysError("failed to increase user quota: " + err.Error())
673 }
674 })
675 if !db && common.BatchUpdateEnabled {
676 addNewRecord(BatchUpdateTypeUserQuota, id, quota)
677 return nil
678 }
679 return increaseUserQuota(id, quota)
680}
681
682func increaseUserQuota(id int, quota int) (err error) {
683 err = DB.Model(&User{}).Where("id = ?", id).Update("quota", gorm.Expr("quota + ?", quota)).Error

Callers 7

EpayNotifyFunction · 0.92
updateVideoSingleTaskFunction · 0.92
UpdateMidjourneyTaskBulkFunction · 0.92
updateSunoTaskAllFunction · 0.92
PostConsumeQuotaFunction · 0.92
InsertMethod · 0.85
DeltaUpdateUserQuotaFunction · 0.85

Calls 5

SysErrorFunction · 0.92
cacheIncrUserQuotaFunction · 0.85
addNewRecordFunction · 0.85
increaseUserQuotaFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected