Commit 7ac87c4f authored by chenweijian's avatar chenweijian

派对申请

parent 5eac84d0
...@@ -19,12 +19,13 @@ type InviteApply struct { ...@@ -19,12 +19,13 @@ type InviteApply struct {
Level string `json:"level"` Level string `json:"level"`
CreatedTime time.Time `json:"created_time"` 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{ err := model.DB().Create(&InviteApply{
UserId: userId, NewUserId: newUserId, Platform: platform, PlatformId: platformId, RechargeInfo: recharge, VideoUrl: videoUrl, 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 { if err != nil {
model.Log.Errorf("CreateInviteApply err:%v", err) model.Log.Errorf("CreateInviteApply err:%v", err)
return err return err
......
...@@ -9,6 +9,7 @@ CREATE TABLE `invite_apply` ( ...@@ -9,6 +9,7 @@ CREATE TABLE `invite_apply` (
`level` varchar(5) NOT NULL DEFAULT '' COMMENT '申请等级(S,A,B,C)', `level` varchar(5) NOT NULL DEFAULT '' COMMENT '申请等级(S,A,B,C)',
`video_url` varchar(400) NOT NULL COMMENT '上传的视频url', `video_url` varchar(400) NOT NULL COMMENT '上传的视频url',
`reason` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '拒绝原因', `reason` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '拒绝原因',
`sub_user_id` bigint NOT NULL COMMENT '提交人',
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
......
...@@ -39,10 +39,10 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -39,10 +39,10 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) {
VideoUrl string `form:"videoUrl" binding:"required"` VideoUrl string `form:"videoUrl" binding:"required"`
} }
//myUserId, err := req.GetUserId(c) myUserId, err := req.GetUserId(c)
//if err != nil { if err != nil {
// return myCtx, err return myCtx, err
//} }
var param paramStr var param paramStr
if err := c.ShouldBind(&param); err != nil { if err := c.ShouldBind(&param); err != nil {
...@@ -106,7 +106,7 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -106,7 +106,7 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) {
return myCtx, bizerr.InviteApplyAlreadyInvited 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 { if err != nil {
model.Log.Errorf("InviteApply param:%v", param) model.Log.Errorf("InviteApply param:%v", param)
return myCtx, err return myCtx, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment