heritage-api/handler/wechat-handler.go

46 lines
808 B
Go

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
}
resp, err := service.WechatAuth(&reqid)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
return
}
c.JSON(http.StatusOK, resp)
}