|
@@ -1,6 +1,7 @@
|
|
package user
|
|
package user
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "encoding/json"
|
|
"eta/eta_mini_ht_api/common/component/cache"
|
|
"eta/eta_mini_ht_api/common/component/cache"
|
|
logger "eta/eta_mini_ht_api/common/component/log"
|
|
logger "eta/eta_mini_ht_api/common/component/log"
|
|
"eta/eta_mini_ht_api/common/exception"
|
|
"eta/eta_mini_ht_api/common/exception"
|
|
@@ -302,9 +303,18 @@ func covertToUserProfile(user user.User) UserProfileReq {
|
|
// @Summary 绑定微信公众号
|
|
// @Summary 绑定微信公众号
|
|
// @Success 200 {object} controllers.BaseResponse
|
|
// @Success 200 {object} controllers.BaseResponse
|
|
// @Description 更新token
|
|
// @Description 更新token
|
|
-// @router /bind_gzh [get]
|
|
|
|
-func (a *UserController) BindGzh(code string) {
|
|
|
|
|
|
+// @router /bind_gzh [post]
|
|
|
|
+func (a *UserController) BindGzh() {
|
|
controllers.Wrap(&a.BaseController, func() (result *controllers.WrapData, err error) {
|
|
controllers.Wrap(&a.BaseController, func() (result *controllers.WrapData, err error) {
|
|
|
|
+ bindReq := new(BindGzhReq)
|
|
|
|
+ body := a.Ctx.Input.RequestBody
|
|
|
|
+ err = json.Unmarshal(body, &bindReq)
|
|
|
|
+ if err != nil {
|
|
|
|
+ logger.Error("解析参数失败,Err:" + err.Error())
|
|
|
|
+ return result, exception.New(exception.WeChatCodeEmpty)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ code := bindReq.Code
|
|
result = a.InitWrapData("绑定公众号失败")
|
|
result = a.InitWrapData("绑定公众号失败")
|
|
if code == "" {
|
|
if code == "" {
|
|
logger.Error("code不能为空")
|
|
logger.Error("code不能为空")
|
|
@@ -330,3 +340,7 @@ func (a *UserController) BindGzh(code string) {
|
|
type IsBindGzhRes struct {
|
|
type IsBindGzhRes struct {
|
|
IsBind bool `json:"isBind"`
|
|
IsBind bool `json:"isBind"`
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+type BindGzhReq struct {
|
|
|
|
+ Code string
|
|
|
|
+}
|