package routers

import (
	"github.com/gin-gonic/gin"
	"hongze/hongze_yb/controller/activity"
	"hongze/hongze_yb/middleware"
)

func InitActivity(r *gin.Engine) {
	// 需要Token
	rGroup := r.Group("activity").Use(middleware.Token())
	{
		rGroup.GET("/getPageList", activity.GetPageList)
		rGroup.GET("/getActivityDetail", activity.GetActivityDetail)
		rGroup.GET("/getActivityVoices", activity.GetActivityVoices)
		rGroup.POST("/addRemind", activity.AddRemind)
		rGroup.POST("/cancelRemind", activity.CancelRemind)
		rGroup.POST("/registerActivity", activity.RegisterActivity)
		rGroup.POST("/cancelRegister", activity.CancelRegister)
		rGroup.POST("/voice_log/add", activity.AddActivityAudioLog)
		rGroup.POST("/voice_log/update", activity.UpdateActivityAudioLog)
	}
	// 不需要Token
	rGroup2 := r.Group("activity")
	{
		rGroup2.GET("/getActivityShareImg", activity.GetActivityShareImg)
	}

	initActivity(r)
}

func initActivity(r *gin.Engine) {
	// 需要Token
	rGroup := r.Group("api/activity").Use(middleware.Token())
	{
		rGroup.GET("/getPageList", activity.GetPageList)
		rGroup.GET("/getActivityDetail", activity.GetActivityDetail)
		rGroup.GET("/getActivityVoices", activity.GetActivityVoices)
		rGroup.POST("/addRemind", activity.AddRemind)
		rGroup.POST("/cancelRemind", activity.CancelRemind)
		rGroup.POST("/registerActivity", activity.RegisterActivity)
		rGroup.POST("/cancelRegister", activity.CancelRegister)
		rGroup.POST("/voice_log/add", activity.AddActivityAudioLog)
		rGroup.POST("/voice_log/update", activity.UpdateActivityAudioLog)
	}
	// 不需要Token
	rGroup2 := r.Group("api/activity")
	{
		rGroup2.GET("/getActivityShareImg", activity.GetActivityShareImg)
	}
}
