Merge branch 'xjjdev'
This commit is contained in:
commit
ef12a59096
@ -169,8 +169,8 @@ func (a *ArtistInfoUserProvider) GetUserMsg(ctx context.Context, req *artistInfo
|
|||||||
// 绑定邀请人和受邀请人的账号,并加入到次数统计
|
// 绑定邀请人和受邀请人的账号,并加入到次数统计
|
||||||
func (a *ArtistInfoUserProvider) BindInviteInvitedAccount(ctx context.Context, in *artistInfoUser.BindInviteInvitedAccountRequest) (res *artistInfoUser.BindInviteInvitedAccountRespond, err error) {
|
func (a *ArtistInfoUserProvider) BindInviteInvitedAccount(ctx context.Context, in *artistInfoUser.BindInviteInvitedAccountRequest) (res *artistInfoUser.BindInviteInvitedAccountRespond, err error) {
|
||||||
// 查询受邀请人是否存在
|
// 查询受邀请人是否存在
|
||||||
|
var thisUser model.User
|
||||||
if in.InvitedUserId == 0 {
|
if in.InvitedUserId == 0 {
|
||||||
var thisUser model.User
|
|
||||||
if err = db.DB.Where("id = ? AND invite_code = ?", in.InvitedUserId, in.InviteCode).First(&thisUser).Error; err != nil {
|
if err = db.DB.Where("id = ? AND invite_code = ?", in.InvitedUserId, in.InviteCode).First(&thisUser).Error; err != nil {
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
return nil, errors.New("受邀请人不存在")
|
return nil, errors.New("受邀请人不存在")
|
||||||
@ -186,6 +186,7 @@ func (a *ArtistInfoUserProvider) BindInviteInvitedAccount(ctx context.Context, i
|
|||||||
}
|
}
|
||||||
if data.ID == 0 {
|
if data.ID == 0 {
|
||||||
data = model.Invite{
|
data = model.Invite{
|
||||||
|
UserId: int32(thisUser.ID),
|
||||||
InvitedId: in.InvitedUserId,
|
InvitedId: in.InvitedUserId,
|
||||||
InvitedCode: in.InvitedCode,
|
InvitedCode: in.InvitedCode,
|
||||||
InviteCode: in.InviteCode,
|
InviteCode: in.InviteCode,
|
||||||
@ -202,6 +203,7 @@ func (a *ArtistInfoUserProvider) BindInviteInvitedAccount(ctx context.Context, i
|
|||||||
}
|
}
|
||||||
if countData.ID == 0 {
|
if countData.ID == 0 {
|
||||||
countData = model.UserInvited{
|
countData = model.UserInvited{
|
||||||
|
UserId: int32(thisUser.ID),
|
||||||
InvitedUserId: in.InvitedUserId, //受邀请人的画家宝用户id
|
InvitedUserId: in.InvitedUserId, //受邀请人的画家宝用户id
|
||||||
Count: 1,
|
Count: 1,
|
||||||
InvitedCode: in.InvitedCode,
|
InvitedCode: in.InvitedCode,
|
||||||
|
Loading…
Reference in New Issue
Block a user