From 7ac87c4fab55d8e3bacda3f82f7fe3e25f70e10f Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Tue, 11 Jul 2023 16:54:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BE=E5=AF=B9=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/model/invite_m/invite_apply.go | 7 ++++--- ...46\264\276\345\257\271\347\224\263\350\257\267.sql" | 1 + route/invite_r/party_invite.go | 10 +++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/domain/model/invite_m/invite_apply.go b/domain/model/invite_m/invite_apply.go index cb31a56..66189cc 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 84f24f4..f5993d3 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 2578e77..3d5640e 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 -- 2.22.0