添加User.Avatar

This commit is contained in:
gazebo
2019-11-08 17:32:46 +08:00
parent 29e6559e17
commit a7164bb511
7 changed files with 51 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ import (
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego"
"git.rosy.net.cn/jx-callback/business/model/dao"
)
func GetComposedCode(c *beego.Controller, code string) (composedCode string) {
@@ -295,3 +296,26 @@ func (c *Auth2Controller) ChangePassword() {
return retVal, "", err
})
}
// @Title 解密小程序数据
// @Description 解密小程序数据
// @Param token header string true "认证token"
// @Param data formData string true "加密数据"
// @Param iv formData string true "iv"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /MiniDecryptData [post]
func (c *Auth2Controller) MiniDecryptData() {
c.callMiniDecryptData(func(params *tAuth2MiniDecryptDataParams) (retVal interface{}, errCode string, err error) {
authInfo, err := params.Ctx.GetV2AuthInfo()
if err == nil {
if retVal, err = weixin.AutherObjMini.DecryptData(authInfo, params.Data, params.Iv); err == nil {
if user:= params.Ctx.GetFullUser(); user != nil {
user.Avatar = "avatar"
dao.UpdateEntity(dao.GetDB(), user, "Avatar")
}
}
}
return retVal, "", err
})
}