Giter Club home page Giter Club logo

Comments (8)

royalrick avatar royalrick commented on August 27, 2024

可以附上代码吗?

from weapp.

LOFTERART avatar LOFTERART commented on August 27, 2024

可以附上代码吗?

fmt.Println(item.SessionKey, "-----")
fmt.Println(item.EncryptedData)
fmt.Println(item.Iv)
fmt.Println(item.UserID)
//1查找user
u := model.User{
BaseInfo: model.BaseInfo{
ID: item.UserID,
},
}
//2解密用户手机号信息
res, err := weapp.DecryptMobile(item.SessionKey, item.EncryptedData, item.Iv)
fmt.Println(res, err, "-----wxinfo---")
if err != nil {
return &u, err
}

启动通过小程序的 code获取的ssk ,也都是有效的 wx.checksession 也是通过的 ;

from weapp.

royalrick avatar royalrick commented on August 27, 2024

好的,空了我核对下。记得一定是先完成登陆流程然后再获取的电话加密数据才有效哦;

from weapp.

LOFTERART avatar LOFTERART commented on August 27, 2024

好的,空了我核对下。记得一定是先完成登陆流程然后再获取的电话加密数据才有效哦;
是的,是这样操作的,小程序启动通过code 获取ssk 前端存入缓存 获取手机号的时候从缓存读取得ssk

from weapp.

LOFTERART avatar LOFTERART commented on August 27, 2024

好的,空了我核对下。记得一定是先完成登陆流程然后再获取的电话加密数据才有效哦;
// decryptUserData 解密用户数据这个函数先base64编码在base64解码 我那个错误能解决,接下来的cbcDecrypt(CBC解密数据)一直走到这个错if len(ciphertext) % size != 0 {
return nil, errors.New("ciphertext is not a multiple of the block size")
}

编码
base64.StdEncoding.EncodeToString

from weapp.

LOFTERART avatar LOFTERART commented on August 27, 2024

每次小程序用户提交解密数据后 后台解析报这个错 每次 'x1a'这个地方会有变化. invalid character '\x1a' looking for beginning of value

换 了个小程序可以获取到手机号信息,很奇怪了 ,能够获取到的是之前正式发布过,新申请的这个小程序获取不到信息 报这个错一直

from weapp.

LOFTERART avatar LOFTERART commented on August 27, 2024

找到问题了 数据库垃圾数据造成的 清空数据库 都可以获取到数据了 可以close到问题了 谢谢啦

from weapp.

royalrick avatar royalrick commented on August 27, 2024

OK👌

from weapp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.