You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
947 B
40 lines
947 B
package handler
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"jrest"
|
|
"net/http"
|
|
"third-party-gateway/api/client"
|
|
"third-party-gateway/utils"
|
|
)
|
|
|
|
func GetPrintMiniProgramQrCode(c *gin.Context) {
|
|
var sceneId string
|
|
var envVersion string
|
|
err := jrest.QueryScanOptional(c, "sceneId:envVersion",
|
|
&sceneId, &envVersion)
|
|
if err != nil {
|
|
utils.ParamError(c)
|
|
return
|
|
}
|
|
resp, err := client.GetPrintMiniProgramQrCode(sceneId, envVersion)
|
|
if err != nil {
|
|
utils.Error(c, http.StatusInternalServerError, "获取微信小程序二维码失败")
|
|
return
|
|
}
|
|
c.Data(http.StatusOK, "application/octet-stream", resp)
|
|
}
|
|
|
|
func GetMiniProgramOpenId(c *gin.Context) {
|
|
var code string
|
|
if err := jrest.QueryScan(c, "code", &code); err != nil {
|
|
utils.ParamError(c)
|
|
return
|
|
}
|
|
openId, err := client.GetMiniProgramOpenId(code)
|
|
if err != nil {
|
|
utils.Error(c, http.StatusInternalServerError, "权限检验失败")
|
|
return
|
|
}
|
|
utils.OKWithData(c, openId)
|
|
}
|
|
|