Commit 7ac87c4f authored by chenweijian's avatar chenweijian

派对申请

parent 5eac84d0
......@@ -19,12 +19,13 @@ type InviteApply struct {
Level string `json:"level"`
CreatedTime time.Time `json:"created_time"`
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
......
......@@ -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`),
......
......@@ -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(&param); 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
......
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