aa
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
beego "github.com/astaxie/beego/server/web"
|
||||
"github.com/gorilla/websocket"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -16,9 +17,12 @@ type CallBackPrint struct {
|
||||
Code string `json:"code"`
|
||||
}
|
||||
|
||||
// 配置升级程序(升级为websocket)
|
||||
var upgrader2 = websocket.Upgrader{}
|
||||
|
||||
func (c *PrintController) Msg() {
|
||||
// 解决跨域问题(微信小程序)
|
||||
upgrader.CheckOrigin = func(r *http.Request) bool {
|
||||
upgrader2.CheckOrigin = func(r *http.Request) bool {
|
||||
return true
|
||||
}
|
||||
//升级将HTTP服务器连接升级到WebSocket协议。
|
||||
@@ -26,7 +30,7 @@ func (c *PrintController) Msg() {
|
||||
//请求。使用responseHeader指定Cookie(设置Cookie)和
|
||||
//应用程序协商的子目录(Sec WebSocket协议)。
|
||||
//如果升级失败,则升级将向客户端答复一个HTTP错误
|
||||
_, err := upgrader.Upgrade(c.Ctx.ResponseWriter, c.Ctx.Request, nil)
|
||||
_, err := upgrader2.Upgrade(c.Ctx.ResponseWriter, c.Ctx.Request, nil)
|
||||
//if c.Ctx.Input.Method() == http.MethodPost {
|
||||
callBackPrint := &CallBackPrint{}
|
||||
globals.SugarLogger.Debugf("print callback callbackResponse:%s", utils.Format4Output(c.Ctx.Request, true))
|
||||
|
||||
Reference in New Issue
Block a user