|
|
@@ -279,6 +279,74 @@ func UserManagementAddUser(c *gin.Context) { |
|
|
|
defer ch.Release() |
|
|
|
ch.Publish(md3.EggAppExchange, md3.EggNewUserRegisterData{Uid: user.Id}, md3.EggNewUserRegister) |
|
|
|
svc.UserImeiAdd(c, user.Id) |
|
|
|
admin := svc2.GetUser(c) |
|
|
|
svc2.AddAdminLog(c, admin.AdmId, "用户新增", "用户id:"+utils.Int64ToStr(user.Id)+",用户手机号:"+user.Phone, "") |
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// UserManagementDelUserAlipay |
|
|
|
// @Summary 制度中心-会员中心-用户管理-删除用户支付宝 |
|
|
|
// @Tags 会员中心 |
|
|
|
// @Description 用户添加 |
|
|
|
// @Accept json |
|
|
|
// @Produce json |
|
|
|
// @param Authorization header string true "验证参数Bearer和token空格拼接" |
|
|
|
// @Param req body md.UserReq true "分页信息必填" |
|
|
|
// @Success 200 {string} "具体数据" |
|
|
|
// @Failure 400 {object} md.Response "具体错误" |
|
|
|
// @Router /api/memberCenter/userManagement/delUserAlipay [post] |
|
|
|
func UserManagementDelUserAlipay(c *gin.Context) { |
|
|
|
var req *md.UserReq |
|
|
|
if err := c.ShouldBindJSON(&req); err != nil { |
|
|
|
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
NewAlipayUserInfoDb := implement.NewAlipayUserInfoDb(db.Db) |
|
|
|
info, _ := NewAlipayUserInfoDb.GetAlipayUserInfo(utils.StrToInt64(req.Id)) |
|
|
|
if info == nil { |
|
|
|
e.OutErr(c, 400, e.NewErr(400, "支付宝信息不存在")) |
|
|
|
return |
|
|
|
} |
|
|
|
oldUserName := info.UserName |
|
|
|
oldOpenId := info.OpenId |
|
|
|
db.Db.Where("id=?", info.Id).Delete(&model.AlipayUserInfo{}) |
|
|
|
admin := svc2.GetUser(c) |
|
|
|
svc2.AddAdminLog(c, admin.AdmId, "用户解除支付宝", "用户id:"+utils.Int64ToStr(info.Uid)+",原支付宝:"+oldUserName+" "+oldOpenId, utils.SerializeStr(info)) |
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// UserManagementDelUserWechat |
|
|
|
// @Summary 制度中心-会员中心-用户管理-删除用户微信 |
|
|
|
// @Tags 会员中心 |
|
|
|
// @Description 用户微信 |
|
|
|
// @Accept json |
|
|
|
// @Produce json |
|
|
|
// @param Authorization header string true "验证参数Bearer和token空格拼接" |
|
|
|
// @Param req body md.UserReq true "分页信息必填" |
|
|
|
// @Success 200 {string} "具体数据" |
|
|
|
// @Failure 400 {object} md.Response "具体错误" |
|
|
|
// @Router /api/memberCenter/userManagement/delUserAlipay [post] |
|
|
|
func UserManagementDelUserWechat(c *gin.Context) { |
|
|
|
var req *md.UserReq |
|
|
|
if err := c.ShouldBindJSON(&req); err != nil { |
|
|
|
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
NewWxUserInfoDb := implement.NewWxUserInfoDb(db.Db) |
|
|
|
info, _ := NewWxUserInfoDb.GetWxUserInfo(utils.StrToInt64(req.Id)) |
|
|
|
if info == nil { |
|
|
|
e.OutErr(c, 400, e.NewErr(400, "微信信息不存在")) |
|
|
|
return |
|
|
|
} |
|
|
|
oldUserName := info.UserName |
|
|
|
oldOpenId := info.OpenId |
|
|
|
db.Db.Where("id=?", info.Id).Delete(&model.WxUserInfo{}) |
|
|
|
admin := svc2.GetUser(c) |
|
|
|
svc2.AddAdminLog(c, admin.AdmId, "用户解除微信", "用户id:"+utils.Int64ToStr(info.Uid)+",原微信:"+oldUserName+" "+oldOpenId, utils.SerializeStr(info)) |
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
return |
|
|
|
} |
|
|
@@ -333,12 +401,15 @@ func UserManagementSetCustomInviteCode(c *gin.Context) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
oldCode := user.CustomInviteCode |
|
|
|
user.CustomInviteCode = req.CustomInviteCode |
|
|
|
_, err = db.Db.Where("id=?", user.Id).Cols("custom_invite_code").Update(user) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, 400, e.NewErr(400, "修改失败")) |
|
|
|
return |
|
|
|
} |
|
|
|
admin := svc2.GetUser(c) |
|
|
|
svc2.AddAdminLog(c, admin.AdmId, "用户邀请码修改", "用户id:"+utils.Int64ToStr(user.Id)+",原邀请码:"+oldCode+",新邀请码"+user.CustomInviteCode, "") |
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
return |
|
|
|
} |
|
|
@@ -360,7 +431,7 @@ func UserManagementUpdateUserInfo(c *gin.Context) { |
|
|
|
e.OutErr(c, e.ERR_INVALID_ARGS, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
affected, err := svc.UserManagementUpdateUserInfo(db.Db, req) |
|
|
|
affected, err := svc.UserManagementUpdateUserInfo(c, db.Db, req) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err.Error()) |
|
|
|
return |
|
|
@@ -745,6 +816,19 @@ func UserManagementGetOneBasic(c *gin.Context) { |
|
|
|
CreateAt: user.CreateAt, |
|
|
|
}, |
|
|
|
} |
|
|
|
NewAlipayUserInfoDb := implement.NewAlipayUserInfoDb(db.Db) |
|
|
|
info, _ := NewAlipayUserInfoDb.GetAlipayUserInfo(user.Id) |
|
|
|
if info != nil { |
|
|
|
resp.BasicInfo.AlipayUserName = info.UserName |
|
|
|
resp.BasicInfo.AlipayOpenId = info.OpenId |
|
|
|
} |
|
|
|
NewWxUserInfoDb := implement.NewWxUserInfoDb(db.Db) |
|
|
|
wxInfo, _ := NewWxUserInfoDb.GetWxUserInfo(user.Id) |
|
|
|
if wxInfo != nil { |
|
|
|
resp.BasicInfo.WechatUserName = wxInfo.UserName |
|
|
|
resp.BasicInfo.WechatOpenId = wxInfo.OpenId |
|
|
|
} |
|
|
|
|
|
|
|
tagList := make([]md.TagNode, len(*userTagRecords)) |
|
|
|
if *userTagRecords != nil { |
|
|
|
for i, records := range *userTagRecords { |
|
|
|