|
|
@@ -14,7 +14,7 @@ import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_system_rules.git/aliyun" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_system_rules.git/kuaizhan" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_system_rules.git/baidu" |
|
|
|
md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" |
|
|
|
md4 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" |
|
|
|
es2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/es" |
|
|
@@ -202,6 +202,56 @@ func UserBindParent(c *gin.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// BindUserInfo |
|
|
|
// @Summary 绑定用户信息 |
|
|
|
// @Tags 会员中心 |
|
|
|
// @Description 绑定用户信息 |
|
|
|
// @Accept json |
|
|
|
// @Produce json |
|
|
|
// @Param req body md.WechatAccountUserInfoReq true "注册参数" |
|
|
|
// @Success 200 {string} "具体数据" |
|
|
|
// @Failure 400 {object} md.Response "具体错误" |
|
|
|
// @Router /api/v1/memberCenter/bindUserInfo [post] |
|
|
|
func BindUserInfo(c *gin.Context) { |
|
|
|
var req md.WechatAccountUserInfoReq |
|
|
|
err := c.ShouldBindJSON(&req) |
|
|
|
if err != nil { |
|
|
|
err = svc.HandleValidateErr(err) |
|
|
|
err1 := err.(e.E) |
|
|
|
e.OutErr(c, err1.Code, err1.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
if req.WechatAccount == "" { |
|
|
|
e.OutErr(c, 400, e.NewErr(400, "微信号不能为空")) |
|
|
|
return |
|
|
|
} |
|
|
|
ownUser := svc.GetUser(c) |
|
|
|
cols := "" |
|
|
|
if req.Nickname != "" { |
|
|
|
ownUser.Nickname = req.Nickname |
|
|
|
cols += ",nickname" |
|
|
|
} |
|
|
|
if req.HeadImg != "" { |
|
|
|
ownUser.Avatar = req.HeadImg |
|
|
|
cols += ",avatar" |
|
|
|
} |
|
|
|
if req.WechatAccount != "" { |
|
|
|
ownUser.WechatAccount = req.WechatAccount |
|
|
|
cols += ",wechat_account" |
|
|
|
} |
|
|
|
if cols == "" { |
|
|
|
e.OutErr(c, 400, e.NewErr(400, "修改失败")) |
|
|
|
return |
|
|
|
} |
|
|
|
_, err = db.Db.Where("id=?", ownUser.Id).Cols(cols[1:]).Update(ownUser) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, 400, e.NewErr(400, "修改失败")) |
|
|
|
return |
|
|
|
} |
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// UpdatePassword |
|
|
|
// @Summary 修改密码-不要原密码 换成验证码 |
|
|
|
// @Tags 账号与安全 |
|
|
@@ -308,11 +358,11 @@ func InviteUrl(c *gin.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
if isHas == 0 { |
|
|
|
send, _ := kuaizhan.KuaizhanSend(svc.GetSysCfgStr("kuaizhan_app_key"), svc.GetSysCfgStr("kuaizhan_app_secret"), link) |
|
|
|
if gjson.Get(send, "url").String() != "" { |
|
|
|
url, _ := baidu.BaiduShortenUrl(svc.GetSysCfgStr("baidu_token"), link) |
|
|
|
if url != "" { |
|
|
|
var uniqueId = php2go.Md5(link) |
|
|
|
oldLink := link |
|
|
|
link = gjson.Get(send, "url").String() |
|
|
|
link = url |
|
|
|
tmp := map[string]interface{}{ |
|
|
|
"uid": user.Id, |
|
|
|
"link": oldLink, |
|
|
|