diff --git a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go index 442a4a28..55f23fe0 100644 --- a/dsSso/Controller/ControllerOauth2/ControllerOauth2.go +++ b/dsSso/Controller/ControllerOauth2/ControllerOauth2.go @@ -21,12 +21,9 @@ import ( "fmt" "github.com/dchest/captcha" "github.com/gin-gonic/gin" - "github.com/opesun/goquery" "github.com/tidwall/gjson" - "io" "io/ioutil" "net/http" - "os" "strconv" "strings" "time" @@ -55,8 +52,6 @@ func Routers(r *gin.RouterGroup) { r.GET("/checkOpenId", checkOpenId) //绑定用户 r.POST("/bindWxUser", bindWxUser) - //显示微信二维码 - r.GET("/wxShowImg", wxShowImg) return } @@ -710,40 +705,3 @@ func bindWxUser(context *gin.Context) { return } } - -// @Summary 微信显示二维码 -// @Description 微信显示二维码 -// @Tags 登录验证类 -// @Accept application/x-www-form-urlencoded -// @Produce json -// @Success 200 {string} string -// @Router /oauth2/wxShowImg [get] -// http://10.10.14.187/oauth2/wxShowImg -func wxShowImg(context *gin.Context) { - url := `https://open.weixin.qq.com/connect/qrconnect?appid=wx3e0449144386938a&redirect_uri=http://fort.edusoa.com:7777/sso/static/jumpWx.html&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect` - //获取http代码 - p, err := goquery.ParseUrl(url) - if err != nil { - context.JSON(http.StatusOK, map[string]interface{}{"success": false, "imgSrc": "", "message": "获取微信图片发生异常!"}) - return - } else { - imgSrc := p.Find("img").Attr("src") - imgSrc = `https://open.weixin.qq.com` + imgSrc - //下载文件到本地临时目录中 - res, err := http.Get(imgSrc) - if err != nil { - context.JSON(http.StatusOK, map[string]interface{}{"success": false, "imgSrc": "", "message": "获取微信图片发生异常!"}) - return - } - //图片 - pngFile := "/usr/local/dsMin/dsSso/Logs/" + CommonUtil.GetUUID() + ".png" - f, err := os.Create(pngFile) - if err != nil { - context.JSON(http.StatusOK, map[string]interface{}{"success": false, "imgSrc": "", "message": "获取微信图片发生异常!"}) - return - } - io.Copy(f, res.Body) - //提供图片 - context.File(pngFile) - } -} diff --git a/dsSso/docs/docs.go b/dsSso/docs/docs.go index 0bba7740..1f4adced 100644 --- a/dsSso/docs/docs.go +++ b/dsSso/docs/docs.go @@ -440,6 +440,29 @@ var doc = `{ ] } }, + "/oauth2/wxShowImg": { + "get": { + "description": "微信显示二维码", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json" + ], + "tags": [ + "登录验证类" + ], + "summary": "微信显示二维码", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, "/sso/addJoinApp": { "post": { "description": "增加一条接入系统的记录", diff --git a/dsSso/docs/swagger.json b/dsSso/docs/swagger.json index a8515c0a..eaddccae 100644 --- a/dsSso/docs/swagger.json +++ b/dsSso/docs/swagger.json @@ -424,6 +424,29 @@ ] } }, + "/oauth2/wxShowImg": { + "get": { + "description": "微信显示二维码", + "consumes": [ + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json" + ], + "tags": [ + "登录验证类" + ], + "summary": "微信显示二维码", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + } + } + } + }, "/sso/addJoinApp": { "post": { "description": "增加一条接入系统的记录", diff --git a/dsSso/docs/swagger.yaml b/dsSso/docs/swagger.yaml index c634d8ac..d88930bc 100644 --- a/dsSso/docs/swagger.yaml +++ b/dsSso/docs/swagger.yaml @@ -317,6 +317,21 @@ paths: - 登录验证类 x-emptylimit: - code + /oauth2/wxShowImg: + get: + consumes: + - application/x-www-form-urlencoded + description: 微信显示二维码 + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + summary: 微信显示二维码 + tags: + - 登录验证类 /sso/addJoinApp: post: consumes: