- mini program login

This commit is contained in:
gazebo
2018-12-27 16:49:32 +08:00
parent b1a7cfdaa8
commit 5adc5e61f3
16 changed files with 301 additions and 51 deletions

View File

@@ -106,7 +106,6 @@ func (c *AuthController) GetUserInfo() {
// @Title 发送验证码
// @Description 发送验证码
// @Param token header string true "认证token"
// @Param mobile formData string true "手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
@@ -133,3 +132,34 @@ func (c *AuthController) BindMobile() {
return retVal, "", err
})
}
// @Title 绑定手机
// @Description 绑定手机(调用此方法前先需要以短信方式登录)
// @Param token header string true "认证token"
// @Param mobile formData string true "手机号,当前无用,置空"
// @Param code formData string true "小程序用户code"
// @Param nickname formData string false "用户名"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /MiniBindWeiXin [post]
func (c *AuthController) MiniBindWeiXin() {
c.callMiniBindWeiXin(func(params *tAuthMiniBindWeiXinParams) (retVal interface{}, errCode string, err error) {
err = weixin.AutherMini.BindWeiXin(params.Ctx, params.Code, params.Nickname)
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 /MiniDecrpytData [post]
func (c *AuthController) MiniDecrpytData() {
c.callMiniDecrpytData(func(params *tAuthMiniDecrpytDataParams) (retVal interface{}, errCode string, err error) {
retVal, err = weixin.AutherMini.DecryptData(params.Ctx, params.Data, params.Iv)
return retVal, "", err
})
}