系统优化
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user