系统优化

This commit is contained in:
hoteas
2022-04-20 18:36:05 +08:00
parent c368619e51
commit 3fdc3aac2e
9 changed files with 1701 additions and 13 deletions
+8 -7
View File
@@ -9,23 +9,24 @@ import (
var Wechat = Ctr{
"login": func(that *Context) {
retoken := that.Req.FormValue("retoken")
sessionKey := that.Req.FormValue("sessionkey")
encryptedData := that.Req.FormValue("encryptedData")
iv := that.Req.FormValue("iv")
if retoken == "" || encryptedData == "" || iv == "" {
if sessionKey == "" || encryptedData == "" || iv == "" {
that.Display(3, "参数不足")
return
}
eny := miniProgram.GetEncryptor()
re, e := eny.Decrypt(retoken, encryptedData, iv)
re, e := eny.Decrypt(sessionKey, encryptedData, iv)
if e != nil {
that.Display(4, e)
return
}
that.Display(0, re.PhoneNumber)
},
"code": func(that *Context) {
code := that.Req.FormValue("code")
@@ -42,10 +43,10 @@ var Wechat = Ctr{
return
}
wchat := Map{"openid": re.OpenID,
"appid": a.AppID,
"state": 0,
"retoken": re.SessionKey,
"unionid": re.UnionID,
"appid": a.AppID,
"state": 0,
"sessionkey": re.SessionKey,
"unionid": re.UnionID,
}
//wchat["id"] = that.Db.Insert("wechat", wchat)