package routers

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

func InitWechat(r *gin.Engine) {
	rGroup := r.Group("wechat")

	{
		rGroup.GET("/qrCode", wechat.GetQrCode)
		rGroup.GET("/userInfo", wechat.GetUserInfo)
		rGroup.GET("/session", wechat.GetUserSession)
		rGroup.GET("/login", wechat.Login)

	}

	rGroup2 := r.Group("wechat").Use(middleware.TokenNoLogin())
	{
		rGroup2.POST("/getEncryptInfo", wechat.GetEncryptInfo)
		rGroup2.GET("/getWxJsConf", wechat.GetWxJsConf)
	}

	initWechat(r)
}

func initWechat(r *gin.Engine) {
	rGroup := r.Group("api/wechat")

	{
		rGroup.GET("/qrCode", wechat.GetQrCode)
		rGroup.GET("/userInfo", wechat.GetUserInfo)
		rGroup.GET("/session", wechat.GetUserSession)
		rGroup.GET("/login", wechat.Login)

	}

	rGroup2 := r.Group("api/wechat").Use(middleware.TokenNoLogin())
	{
		rGroup2.POST("/getEncryptInfo", wechat.GetEncryptInfo)
		rGroup2.GET("/getWxJsConf", wechat.GetWxJsConf)
	}
}
