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

Function TopUp

controller/user.go:822–843  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

820var topUpLock = sync.Mutex{}
821
822func TopUp(c *gin.Context) {
823 topUpLock.Lock()
824 defer topUpLock.Unlock()
825 req := topUpRequest{}
826 err := c.ShouldBindJSON(&req)
827 if err != nil {
828 common.ApiError(c, err)
829 return
830 }
831 id := c.GetInt("id")
832 quota, err := model.Redeem(req.Key, id)
833 if err != nil {
834 common.ApiError(c, err)
835 return
836 }
837 c.JSON(http.StatusOK, gin.H{
838 "success": true,
839 "message": "",
840 "data": quota,
841 })
842 return
843}
844
845type UpdateUserSettingRequest struct {
846 QuotaWarningType string `json:"notify_type"`

Callers

nothing calls this directly

Calls 2

ApiErrorFunction · 0.92
RedeemFunction · 0.92

Tested by

no test coverage detected