ratio_config.go 502 B

123456789101112131415161718192021222324
  1. package controller
  2. import (
  3. "net/http"
  4. "one-api/setting/ratio_setting"
  5. "github.com/gin-gonic/gin"
  6. )
  7. func GetRatioConfig(c *gin.Context) {
  8. if !ratio_setting.IsExposeRatioEnabled() {
  9. c.JSON(http.StatusForbidden, gin.H{
  10. "success": false,
  11. "message": "倍率配置接口未启用",
  12. })
  13. return
  14. }
  15. c.JSON(http.StatusOK, gin.H{
  16. "success": true,
  17. "message": "",
  18. "data": ratio_setting.GetExposedData(),
  19. })
  20. }