ソースを参照

解除支付宝微信

master
huangjiajun 1日前
コミット
05d1faa0b0
4個のファイルの変更96行の追加3行の削除
  1. +85
    -1
      app/hdl/member_center/hdl_user_management.go
  2. +7
    -0
      app/md/member_center/md_user_management.go
  3. +2
    -0
      app/router/router.go
  4. +2
    -2
      app/svc/member_center/svc_user_management.go

+ 85
- 1
app/hdl/member_center/hdl_user_management.go ファイルの表示

@@ -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 {


+ 7
- 0
app/md/member_center/md_user_management.go ファイルの表示

@@ -16,6 +16,9 @@ type InviteCodeReq struct {
Id string `json:"id"`
CustomInviteCode string `json:"custom_invite_code"`
}
type UserReq struct {
Id string `json:"id"`
}
type UserManagementGetUserListReq struct {
ID int64 `json:"id"` // 会员 ID
Nickname string `json:"nickname" example:"会员昵称"`
@@ -137,6 +140,10 @@ type BasicInfoNode struct {
WechatAccount string `json:"wechat_account"`
SystemInviteCode string `json:"system_invite_code"`
CustomInviteCode string `json:"custom_invite_code"`
AlipayUserName string `json:"alipay_user_name"`
AlipayOpenId string `json:"alipay_open_id"`
WechatUserName string `json:"wechat_user_name"`
WechatOpenId string `json:"wechat_open_id"`
}

type OtherNode struct {


+ 2
- 0
app/router/router.go ファイルの表示

@@ -351,6 +351,8 @@ func rMemberCenter(r *gin.RouterGroup) { // 会员中心
{
rUserManagement.POST("/getUserList", member_center.UserManagementGetUserList)
rUserManagement.POST("/addUser", member_center.UserManagementAddUser)
rUserManagement.POST("/delUserAlipay", member_center.UserManagementDelUserAlipay)
rUserManagement.POST("/delUserWechat", member_center.UserManagementDelUserWechat)
rUserManagement.POST("/setCustomInviteCode", member_center.UserManagementSetCustomInviteCode)
rUserManagement.GET("/userData", member_center.UserManagementGetOneBasic)
rUserManagement.POST("/updateUserInfo", member_center.UserManagementUpdateUserInfo)


+ 2
- 2
app/svc/member_center/svc_user_management.go ファイルの表示

@@ -8,6 +8,7 @@ import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"errors"
"fmt"
"github.com/gin-gonic/gin"
"strings"
"time"
"xorm.io/xorm"
@@ -92,7 +93,7 @@ func userManagementGetUsersBindQuery(engine *xorm.Engine, req *md.UserManagement
}
return session
}
func UserManagementUpdateUserInfo(engine *xorm.Engine, req *md.UserManagementUpdateUserInfoReq) (int64, error) {
func UserManagementUpdateUserInfo(c *gin.Context, engine *xorm.Engine, req *md.UserManagementUpdateUserInfoReq) (int64, error) {
session := engine.NewSession()
defer session.Close()
session.Begin()
@@ -196,6 +197,5 @@ func UserManagementUpdateUserInfo(engine *xorm.Engine, req *md.UserManagementUpd
session.Rollback()
return 0, err3
}

return affected, nil
}

読み込み中…
キャンセル
保存