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

Function updateUserUsedQuota

model/user.go:763–772  ·  view source on GitHub ↗
(id int, quota int)

Source from the content-addressed store, hash-verified

761}
762
763func updateUserUsedQuota(id int, quota int) {
764 err := DB.Model(&User{}).Where("id = ?", id).Updates(
765 map[string]interface{}{
766 "used_quota": gorm.Expr("used_quota + ?", quota),
767 },
768 ).Error
769 if err != nil {
770 common.SysError("failed to update user used quota: " + err.Error())
771 }
772}
773
774func updateUserRequestCount(id int, count int) {
775 err := DB.Model(&User{}).Where("id = ?", id).Update("request_count", gorm.Expr("request_count + ?", count)).Error

Callers 1

batchUpdateFunction · 0.85

Calls 2

SysErrorFunction · 0.92
ErrorMethod · 0.80

Tested by

no test coverage detected