diff --git a/domain/model/invite_m/invite_apply.go b/domain/model/invite_m/invite_apply.go index cb31a562c20b20e97e26f3be57066db12eea68e3..66189cc5c80555c6dd824bfed7862c9dbd7ea45e 100644 --- a/domain/model/invite_m/invite_apply.go +++ b/domain/model/invite_m/invite_apply.go @@ -18,13 +18,14 @@ type InviteApply struct { VideoUrl string `json:"video_url"` Level string `json:"level"` CreatedTime time.Time `json:"created_time"` - Reason int `json:"reason"` // 1.已申请2.待审核3.已通过4.已拒绝" + Reason int `json:"reason"` // 1.已申请2.待审核3.已通过4.已拒绝" + SubUserId uint64 `json:"sub_user_id"` // 提交人 } -func CreateInviteApply(model *domain.Model, userId, newUserId uint64, platform, platformId, recharge, videoUrl string) error { +func CreateInviteApply(model *domain.Model, userId, newUserId, subUserId uint64, platform, platformId, recharge, videoUrl string) error { err := model.DB().Create(&InviteApply{ UserId: userId, NewUserId: newUserId, Platform: platform, PlatformId: platformId, RechargeInfo: recharge, VideoUrl: videoUrl, - CreatedTime: time.Now()}).Error + CreatedTime: time.Now(), SubUserId: subUserId}).Error if err != nil { model.Log.Errorf("CreateInviteApply err:%v", err) return err diff --git "a/mysql/\346\226\260\344\272\272\346\264\276\345\257\271\347\224\263\350\257\267.sql" "b/mysql/\346\226\260\344\272\272\346\264\276\345\257\271\347\224\263\350\257\267.sql" index 84f24f43766e39c3e9b8d41679d8233c7999811b..f5993d3f63fe8e285a0418db2437c1c23a866cfb 100644 --- "a/mysql/\346\226\260\344\272\272\346\264\276\345\257\271\347\224\263\350\257\267.sql" +++ "b/mysql/\346\226\260\344\272\272\346\264\276\345\257\271\347\224\263\350\257\267.sql" @@ -9,6 +9,7 @@ CREATE TABLE `invite_apply` ( `level` varchar(5) NOT NULL DEFAULT '' COMMENT '申请等级(S,A,B,C)', `video_url` varchar(400) NOT NULL COMMENT '上传的视频url', `reason` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '拒绝原因', + `sub_user_id` bigint NOT NULL COMMENT '提交人', `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), diff --git a/route/invite_r/party_invite.go b/route/invite_r/party_invite.go index 2578e779f07aae35e17a8c94b530f2643c53c261..3d5640ea9d14e0a91f6a66d6ac738234d9c1471e 100644 --- a/route/invite_r/party_invite.go +++ b/route/invite_r/party_invite.go @@ -39,10 +39,10 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) { VideoUrl string `form:"videoUrl" binding:"required"` } - //myUserId, err := req.GetUserId(c) - //if err != nil { - // return myCtx, err - //} + myUserId, err := req.GetUserId(c) + if err != nil { + return myCtx, err + } var param paramStr if err := c.ShouldBind(¶m); err != nil { @@ -106,7 +106,7 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) { return myCtx, bizerr.InviteApplyAlreadyInvited } // 插入邀请表 - err = invite_m.CreateInviteApply(model, user.ID, newUser.ID, param.Platform, param.PlatformId, param.Recharge, param.VideoUrl) + err = invite_m.CreateInviteApply(model, user.ID, newUser.ID, myUserId, param.Platform, param.PlatformId, param.Recharge, param.VideoUrl) if err != nil { model.Log.Errorf("InviteApply param:%v", param) return myCtx, err