|
- package point
-
- import (
- "code.gitea.io/gitea/models"
- "code.gitea.io/gitea/modules/context"
- "code.gitea.io/gitea/routers/response"
- "code.gitea.io/gitea/services/reward/limiter"
- "net/http"
- )
-
- func GetPointLimitConfigList(ctx *context.Context) {
- r, err := limiter.GetLimitConfigList(models.LimitTypeRewardPoint)
- if err != nil {
- ctx.JSON(http.StatusOK, response.ServerError(err.Error()))
- return
- }
- ctx.JSON(http.StatusOK, response.SuccessWithData(r))
- }
-
- func AddPointLimitConfig(ctx *context.Context, config models.LimitConfigVO) {
- err := limiter.AddLimitConfig(&config, ctx.User, models.LimitTypeRewardPoint)
- if err != nil {
- ctx.JSON(http.StatusOK, response.ServerError(err.Error()))
- return
- }
- ctx.JSON(http.StatusOK, response.Success())
- }
- func DeletePointLimitConfig(ctx *context.Context) {
- id := ctx.QueryInt64("id")
- err := limiter.DeleteLimitConfig(id, ctx.User)
- if err != nil {
- ctx.JSON(http.StatusOK, response.ServerError(err.Error()))
- return
- }
- ctx.JSON(http.StatusOK, response.Success())
- }
|