This commit is contained in:
邹宗楠
2023-01-31 09:16:28 +08:00
parent 63687148fb
commit c3c7c7ddbd
2 changed files with 9 additions and 2 deletions

View File

@@ -2,6 +2,8 @@ package weixin
import ( import (
"errors" "errors"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/baseapi/platformapi/weixinapi" "git.rosy.net.cn/baseapi/platformapi/weixinapi"
"git.rosy.net.cn/jx-callback/business/auth2" "git.rosy.net.cn/jx-callback/business/auth2"
@@ -14,7 +16,7 @@ const (
AuthTypeWeixin = "wxqrcode" // 微信扫码 AuthTypeWeixin = "wxqrcode" // 微信扫码
AuthTypeMP = "weixinsns" // 公众号 AuthTypeMP = "weixinsns" // 公众号
AuthTypeWXNative = "wxnative" // 微信APP AuthTypeWXNative = "wxnative" // 微信APP
AuthTypeWxApp = "weixinapp" //app微信登录 AuthTypeWxApp = "weixinapp" //app微信登录()
) )
type Auther struct { type Auther struct {
@@ -57,7 +59,10 @@ func init() {
func (a *Auther) VerifySecret(id, secret string) (authBindEx *auth2.AuthBindEx, err error) { func (a *Auther) VerifySecret(id, secret string) (authBindEx *auth2.AuthBindEx, err error) {
var openID, accessToken string var openID, accessToken string
_, jsCode := SplitJsCode(secret) appId, jsCode := SplitJsCode(secret)
globals.SugarLogger.Debugf("=======appId := %s ,jscode := %s", appId, jsCode)
globals.SugarLogger.Debugf("auther := %s", utils.Format4Output(a.authType, false))
globals.SugarLogger.Debugf("auther := %s", utils.Format4Output(a.DefAuther, false))
if a.authType != AuthTypeWXNative { if a.authType != AuthTypeWXNative {
state := id state := id
code := jsCode code := jsCode

View File

@@ -3,6 +3,7 @@ package controllers
import ( import (
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"git.rosy.net.cn/jx-callback/globals"
"net/http" "net/http"
"strings" "strings"
@@ -131,6 +132,7 @@ func (c *Auth2Controller) Login() {
params.AuthSecret = GetComposedCode2(&c.Controller, params.AuthSecret) params.AuthSecret = GetComposedCode2(&c.Controller, params.AuthSecret)
} }
ctx := auth2.NewContext(c.Ctx.ResponseWriter, c.Ctx.Request) ctx := auth2.NewContext(c.Ctx.ResponseWriter, c.Ctx.Request)
globals.SugarLogger.Debugf("======参数login === %s", utils.Format4Output(params, false))
authInfo, err := auth2.Login(ctx, params.AuthType, params.AuthID, params.AuthIDType, params.AuthSecret) authInfo, err := auth2.Login(ctx, params.AuthType, params.AuthID, params.AuthIDType, params.AuthSecret)
// TODO 兼容没有取到authid2的错误 // TODO 兼容没有取到authid2的错误
if err == nil && authInfo.AuthBindInfo != nil { if err == nil && authInfo.AuthBindInfo != nil {