heritage-api/handler/wechat-handler.go

46 lines
808 B
Go
Raw Normal View History

2026-03-20 04:30:58 +00:00
package handler
import (
"net/http"
"github.com/gin-gonic/gin"
"myschools.me/heritage/heritage-api/service"
)
func WechatQrGet(c *gin.Context) {
reqid := c.Param("id")
if reqid == "" {
c.JSON(http.StatusBadRequest, gin.H{
"error": "reqid is required",
})
return
}
resp, err := service.WechatQrGet(&reqid)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
return
}
c.JSON(http.StatusOK, resp)
}
func WechatAuth(c *gin.Context) {
reqid := c.Param("id")
if reqid == "" {
c.JSON(http.StatusBadRequest, gin.H{
"error": "reqid is required",
})
return
}
2026-03-20 09:08:31 +00:00
resp, err := service.WechatAuth(&reqid)
2026-03-20 04:30:58 +00:00
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
return
}
c.JSON(http.StatusOK, resp)
}