1
This commit is contained in:
@@ -16,20 +16,20 @@ const (
|
||||
AuthTypeTiktokMini = "tiktokmini" // 抖音小程序
|
||||
)
|
||||
|
||||
type TiktopMiniAuther struct {
|
||||
type TiktokMiniAuther struct {
|
||||
authprovider.DefAuther
|
||||
}
|
||||
|
||||
var (
|
||||
AutherObjMini *TiktopMiniAuther
|
||||
AutherObjMini *TiktokMiniAuther
|
||||
)
|
||||
|
||||
func init() {
|
||||
AutherObjMini = new(TiktopMiniAuther)
|
||||
AutherObjMini = new(TiktokMiniAuther)
|
||||
auth2.RegisterAuther(AuthTypeTiktokMini, AutherObjMini)
|
||||
}
|
||||
|
||||
func (a *TiktopMiniAuther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx, err error) {
|
||||
func (a *TiktokMiniAuther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx, err error) {
|
||||
//appID, realCode := splitCode(code)
|
||||
//sessionInfo, err := getTikTokApp(appID).GetTiktokOauth(realCode)
|
||||
sessionInfo, err := api.TiktokApi.GetTiktokOauth(code)
|
||||
@@ -44,7 +44,7 @@ func (a *TiktopMiniAuther) VerifySecret(dummy, code string) (authBindEx *auth2.A
|
||||
}
|
||||
|
||||
// 特殊接口
|
||||
func (a *TiktopMiniAuther) DecryptData(authInfo *auth2.AuthInfo, jsCode, encryptedData, iv string) (decryptedDataBase64 string, err error) {
|
||||
func (a *TiktokMiniAuther) DecryptData(authInfo *auth2.AuthInfo, jsCode, encryptedData, iv string) (decryptedDataBase64 string, err error) {
|
||||
var sessionKey string
|
||||
appID, jsCode := weixin.SplitJsCode(jsCode)
|
||||
if jsCode != "" {
|
||||
@@ -74,7 +74,7 @@ func (a *TiktopMiniAuther) DecryptData(authInfo *auth2.AuthInfo, jsCode, encrypt
|
||||
return string(decryptedData), nil
|
||||
}
|
||||
|
||||
func (a *TiktopMiniAuther) GetUserType() (userType int8) {
|
||||
func (a *TiktokMiniAuther) GetUserType() (userType int8) {
|
||||
return model.UserTypeStoreBoss
|
||||
}
|
||||
|
||||
109
business/auth2/authprovider/kuaishou/kuaishou_mini.go
Normal file
109
business/auth2/authprovider/kuaishou/kuaishou_mini.go
Normal file
@@ -0,0 +1,109 @@
|
||||
package kuaishou
|
||||
|
||||
//
|
||||
//import (
|
||||
// "git.rosy.net.cn/baseapi/platformapi/tiktok"
|
||||
// "git.rosy.net.cn/baseapi/platformapi/weixinapi"
|
||||
// "git.rosy.net.cn/jx-callback/business/auth2"
|
||||
// "git.rosy.net.cn/jx-callback/business/auth2/authprovider"
|
||||
// "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
// "git.rosy.net.cn/jx-callback/business/model"
|
||||
// "git.rosy.net.cn/jx-callback/globals"
|
||||
// "git.rosy.net.cn/jx-callback/globals/api"
|
||||
// "strings"
|
||||
//)
|
||||
//
|
||||
//const (
|
||||
// AuthTypeKuaiShouMini = "kuaishoumini" // 快手小程序
|
||||
//)
|
||||
//
|
||||
//type KuaiShouMiniAuther struct {
|
||||
// authprovider.DefAuther
|
||||
//}
|
||||
//
|
||||
//var (
|
||||
// AutherObjMini *KuaiShouMiniAuther
|
||||
//)
|
||||
//
|
||||
//func init() {
|
||||
// AutherObjMini = new(KuaiShouMiniAuther)
|
||||
// auth2.RegisterAuther(AuthTypeKuaiShouMini, AutherObjMini)
|
||||
//}
|
||||
//
|
||||
//func (a *KuaiShouMiniAuther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx, err error) {
|
||||
// //appID, realCode := splitCode(code)
|
||||
// //sessionInfo, err := getTikTokApp(appID).GetTiktokOauth(realCode)
|
||||
// sessionInfo, err := api.TiktokApi.GetTiktokOauth(code)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// sessionKey := sessionInfo.Data.SessionKey
|
||||
// if authBindEx, err = a.UnionFindAuthBind(AuthTypeKuaiShouMini, api.TiktokApi.GetAppID(), []string{AuthTypeKuaiShouMini}, sessionInfo.Data.OpenId, sessionInfo.Data.Unionid, sessionInfo); err == nil {
|
||||
// authBindEx.UserData = sessionKey
|
||||
// }
|
||||
// return authBindEx, err
|
||||
//}
|
||||
//
|
||||
//// 特殊接口
|
||||
//func (a *KuaiShouMiniAuther) DecryptData(authInfo *auth2.AuthInfo, jsCode, encryptedData, iv string) (decryptedDataBase64 string, err error) {
|
||||
// var sessionKey string
|
||||
// appID, jsCode := weixin.SplitJsCode(jsCode)
|
||||
// if jsCode != "" {
|
||||
// sessionInfo, err := getWxApp(appID).SNSCode2Session(jsCode)
|
||||
// if err == nil {
|
||||
// // if authBindEx, err := a.UnionFindAuthBind(AuthTypeMini, getWxApp(appID).GetAppID(), []string{AuthTypeMini}, sessionInfo.OpenID, "", nil); err == nil {
|
||||
// // if authBindEx.UserID != authInfo.GetID() {
|
||||
// // return "", fmt.Errorf("jsCode与token不匹配")
|
||||
// // }
|
||||
// // } else {
|
||||
// // return "", err
|
||||
// // }
|
||||
// sessionKey = sessionInfo.SessionKey
|
||||
// } else {
|
||||
// return "", err
|
||||
// }
|
||||
// } else {
|
||||
// if authInfo.AuthBindInfo.Type != AuthTypeKuaiShouMini {
|
||||
// // return "", ErrAuthTypeShouldBeMini
|
||||
// }
|
||||
// sessionKey = authInfo.AuthBindInfo.UserData.(string)
|
||||
// }
|
||||
// decryptedData, err := weixinapi.SNSDecodeMiniProgramData(encryptedData, sessionKey, iv)
|
||||
// if err != nil {
|
||||
// return "", err
|
||||
// }
|
||||
// return string(decryptedData), nil
|
||||
//}
|
||||
//
|
||||
//func (a *KuaiShouMiniAuther) GetUserType() (userType int8) {
|
||||
// return model.UserTypeStoreBoss
|
||||
//}
|
||||
//
|
||||
//func getWxApp(appID string) (miniApi *weixinapi.API) {
|
||||
// miniApi = api.WeixinMiniAPI
|
||||
// if len(appID) > 0 && appID == api.WeixinMiniAppID2 {
|
||||
// miniApi = api.WeixinMiniAPI2
|
||||
// }
|
||||
// if len(appID) > 0 && appID == api.WeixinMiniAppIDsc {
|
||||
// miniApi = api.WeixinMiniAPIsc
|
||||
// }
|
||||
// return miniApi
|
||||
//}
|
||||
//
|
||||
//func getTikTokApp(appID string) (TikTokMini *tiktok.API) {
|
||||
// TikTokMini = api.TiktokApi
|
||||
// if len(appID) > 0 && appID == api.TiktokJXDJApiID {
|
||||
// TikTokMini = api.TiktokJXDJApi
|
||||
// }
|
||||
// return TikTokMini
|
||||
//}
|
||||
//func splitCode(code string) (appID, realCode string) {
|
||||
// str := strings.Split(code, "&")
|
||||
// if len(str) == 2 {
|
||||
// appID = str[1]
|
||||
// realCode = str[0]
|
||||
// } else {
|
||||
// globals.SugarLogger.Warnf("splitCode abnormal code:%s", code)
|
||||
// }
|
||||
// return appID, realCode
|
||||
//}
|
||||
@@ -6,12 +6,35 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
var enterpriseUserIdMap = map[string]string{
|
||||
"15881105234": "WenShiQi",
|
||||
"15928865396": "HeJiaMeng2",
|
||||
"18981810340": "LiuLei",
|
||||
"18048531223": "ShiFeng2",
|
||||
"18080188338": "ShiFeng",
|
||||
"18744776542": "WuTingQi",
|
||||
"15729837802": "ZhangShuWei",
|
||||
"17358644830": "ShengTianBanZi1376",
|
||||
"18982250714": "LaoZhaoTongXue",
|
||||
"15680070110": "LiRongWei",
|
||||
"18780171617": "TianQinXin",
|
||||
"17381914617": "TianQinXin2",
|
||||
"18583684218": "JingXiCaiShi-YanXiaoKang18583684218",
|
||||
}
|
||||
|
||||
// SendUserMessage 发送文本卡片
|
||||
func SendUserMessage(phone, title, description, url string) error {
|
||||
// 根据电话号码获取用户touserId
|
||||
enterpriseUserId, err := api.EnterpriseChatMin.GetUserIdByMobile(phone)
|
||||
if err != nil {
|
||||
return err
|
||||
var enterpriseUserId = ""
|
||||
var err error = nil
|
||||
if id, ok := enterpriseUserIdMap[phone]; ok {
|
||||
enterpriseUserId = id
|
||||
} else {
|
||||
enterpriseUserId, err = api.EnterpriseChatMin.GetUserIdByMobile(phone)
|
||||
if err != nil {
|
||||
enterpriseUserId = enterpriseUserIdMap["18981810340"]
|
||||
}
|
||||
enterpriseUserIdMap[phone] = enterpriseUserId
|
||||
}
|
||||
|
||||
err = api.EnterpriseChatMin.SendMsgToUserTypeText(&enterprise.SendTextMsgReq{
|
||||
|
||||
@@ -104,7 +104,7 @@ func (c *Auth2Controller) TiktokDecrypt() {
|
||||
|
||||
// @Title 登录接口
|
||||
// @Description 登录接口(微信与公众号登录不能直接调用此接口)
|
||||
// @Param authType formData string true "登录类型,当前支持[localpass:本地账号密码,mobile:手机短信,wxqrcode:微信登录,weixinsns:微信公众号,weixinmini;小程序,wxnative:微信APP,ddstaff:钉钉企业,ddqrcode:钉钉扫码,alipaycode:支付宝小程序]"
|
||||
// @Param authType formData string true "登录类型,当前支持[kuaishou:快手授权登录,localpass:本地账号密码,mobile:手机短信,wxqrcode:微信登录,weixinsns:微信公众号,weixinmini;小程序,wxnative:微信APP,ddstaff:钉钉企业,ddqrcode:钉钉扫码,alipaycode:支付宝小程序]"
|
||||
// @Param authSecret formData string true "不同登录类型的登录秘密,如果是localpass登录类型,是md5后的值(空串不要md5)"
|
||||
// @Param authID formData string false "登录ID,登录类型为localpass时依赖于authIDType,其它为相应登录类型的id"
|
||||
// @Param authIDType formData string false "只有在登录类型为localpass时,才有意义,分别为:userid2:用户名,email,mobile"
|
||||
|
||||
Reference in New Issue
Block a user