package router

import (
	"ARKItems/entity"
	"ARKItems/util"
	"fmt"
	"github.com/gin-gonic/gin"
)

func ARKConfigRouter(api *gin.RouterGroup) {
	api.GET("/messages", GetMessages)
	api.GET("/timedPointsReward", GetTimedPointsReward)
	api.POST("/timedPointsReward/group", SaveGroup)
}

func GetMessages(c *gin.Context) {
	c.JSON(200, CreateResultData(ARKConfig.Messages))
}
func GetTimedPointsReward(c *gin.Context) {
	c.JSON(200, CreateResultData(ARKConfig.General.TimedPointsReward))
}

// SaveGroup 添加VIP
func SaveGroup(c *gin.Context) {
	param := util.GetJsonAnyParam(c)
	g, err := param("group")
	if err != nil {
		c.JSON(200, CreateResultError(400, "参数错误"))
		return
	}
	var Group = entity.Group{}
	err = util.DataToObject(g, &Group)
	fmt.Println(g, Group)
	c.JSON(200, CreateResult())
}

// UpdateGroup 修改VIP
func UpdateGroup(c *gin.Context) {

}
