MCPcopy
hub / github.com/songquanpeng/one-api / updateUserUsedQuota

Function updateUserUsedQuota

model/user.go:429–438  ·  view source on GitHub ↗
(id int, quota int64)

Source from the content-addressed store, hash-verified

427}
428
429func updateUserUsedQuota(id int, quota int64) {
430 err := DB.Model(&User{}).Where("id = ?", id).Updates(
431 map[string]interface{}{
432 "used_quota": gorm.Expr("used_quota + ?", quota),
433 },
434 ).Error
435 if err != nil {
436 logger.SysError("failed to update user used quota: " + err.Error())
437 }
438}
439
440func updateUserRequestCount(id int, count int) {
441 err := DB.Model(&User{}).Where("id = ?", id).Update("request_count", gorm.Expr("request_count + ?", count)).Error

Callers 1

batchUpdateFunction · 0.85

Calls 1

SysErrorFunction · 0.92

Tested by

no test coverage detected