wxapp login
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -36,6 +37,8 @@ const (
|
||||
AuthTypePassword = "localpass"
|
||||
AuthTypeEmail = "email"
|
||||
AuthTypeMobile = "mobile"
|
||||
AuthTypeWXApp = "weixinapp" //微信小程序
|
||||
AuthTypeWXMini = "weixinmini" //微信小程序
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -280,8 +283,9 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
|
||||
userProvider.UpdateLastLogin(user.GetID(), authType, ctx.GetRealRemoteIP())
|
||||
}
|
||||
//如果是小程序
|
||||
if authType == "weixinmini" || authType == "weixinapp" {
|
||||
if authType == AuthTypeWXMini { // || authType == AuthTypeWXApp 此处AuthTypeWXApp没用上
|
||||
appID := strings.Split(authSecret, ",")[0]
|
||||
globals.SugarLogger.Debugf("authSecret=%s,appID=%s", authSecret, appID)
|
||||
// 菜市商家 // // // 京西商城
|
||||
if appID == model.JXC4BusinessAppId || appID == "wx2d6949f724b2541d" || appID == "wx18111a41fd17f24f" || appID == model.JXC4AppId { //菜市或者果园
|
||||
if authInfo.AuthBindInfo.UserID != "" {
|
||||
@@ -300,6 +304,22 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string
|
||||
}
|
||||
}
|
||||
}
|
||||
//微信APP端登录
|
||||
if authType == AuthTypeWXApp {
|
||||
appID := strings.Split(authSecret, ",")[0]
|
||||
if appID == model.JXC4ClientAppID && authInfo.AuthBindInfo.UserID != "" {
|
||||
binds, err := dao.GetUserBindAuthInfo(dao.GetDB(), authInfo.AuthBindInfo.UserID, 0, nil, "", "", []string{model.JXC4ClientAppID})
|
||||
if err != nil {
|
||||
return authInfo, err
|
||||
}
|
||||
if len(binds) == 0 {
|
||||
authInfo.IsExistOpenID = false
|
||||
} else {
|
||||
authInfo.IsExistOpenID = true
|
||||
}
|
||||
authInfo.AppID = model.JXC4ClientAppID
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user