wechat.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package user
  2. import (
  3. logger "eta/eta_mini_ht_api/common/component/log"
  4. "eta/eta_mini_ht_api/common/exception"
  5. "eta/eta_mini_ht_api/controllers"
  6. )
  7. // RefreshToken 绑定微信公众号
  8. // @Summary 绑定微信公众号
  9. // @Success 200 {object} controllers.BaseResponse
  10. // @Description 更新token
  11. // @router /bind_gzh [get]
  12. func (a *AuthController) BindGzh(code string) {
  13. controllers.Wrap(&a.BaseController, func() (result *controllers.WrapData, err error) {
  14. result = a.InitWrapData("刷新token失败")
  15. if code == "" {
  16. logger.Error("code不能为空")
  17. return result, exception.New(exception.WeChatCodeEmpty)
  18. }
  19. logger.Info("bindGzh code:" + code)
  20. //刷新token
  21. //isBind, err := auth.BindWxGzh(code)
  22. //if err != nil {
  23. // logger.Error("绑定公众号失败:%v", err)
  24. // a.FailedResult("绑定公众号失败", result)
  25. // return
  26. //}
  27. //a.SuccessResult("绑定成功", IsBindGzhRes{
  28. // IsBind: isBind,
  29. //}, result)
  30. return
  31. })
  32. }
  33. type IsBindGzhRes struct {
  34. IsBind bool `json:"isBind"`
  35. }