This commit is contained in:
邹宗楠
2023-01-30 11:26:21 +08:00
parent 0c0e640df2
commit eb8b84384e
4 changed files with 142 additions and 10 deletions

View File

@@ -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
}