|
@@ -6,6 +6,7 @@ import (
|
|
|
"eta/eta_mini_ht_api/common/exception"
|
|
|
authUtils "eta/eta_mini_ht_api/common/utils/auth"
|
|
|
"eta/eta_mini_ht_api/controllers"
|
|
|
+ "eta/eta_mini_ht_api/service/auth"
|
|
|
"eta/eta_mini_ht_api/service/user"
|
|
|
"fmt"
|
|
|
)
|
|
@@ -296,3 +297,36 @@ func covertToUserProfile(user user.User) UserProfileReq {
|
|
|
Mobile: user.Mobile,
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// RefreshToken 绑定微信公众号
|
|
|
+// @Summary 绑定微信公众号
|
|
|
+// @Success 200 {object} controllers.BaseResponse
|
|
|
+// @Description 更新token
|
|
|
+// @router /bind_gzh [get]
|
|
|
+func (a *UserController) BindGzh(code string) {
|
|
|
+ controllers.Wrap(&a.BaseController, func() (result *controllers.WrapData, err error) {
|
|
|
+ result = a.InitWrapData("绑定公众号失败")
|
|
|
+ if code == "" {
|
|
|
+ logger.Error("code不能为空")
|
|
|
+ return result, exception.New(exception.WeChatCodeEmpty)
|
|
|
+ }
|
|
|
+
|
|
|
+ logger.Info("bindGzh code:" + code)
|
|
|
+
|
|
|
+ //刷新token
|
|
|
+ isBind, err := auth.BindWxGzh(code)
|
|
|
+ if err != nil {
|
|
|
+ logger.Error("绑定公众号失败:%v", err)
|
|
|
+ a.FailedResult("绑定公众号失败", result)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ a.SuccessResult("绑定成功", IsBindGzhRes{
|
|
|
+ IsBind: isBind,
|
|
|
+ }, result)
|
|
|
+ return
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+type IsBindGzhRes struct {
|
|
|
+ IsBind bool `json:"isBind"`
|
|
|
+}
|