Commit bbd96593 authored by chenweijian's avatar chenweijian

邀请派对

parent b16be92c
...@@ -12,6 +12,7 @@ type InviteApply struct { ...@@ -12,6 +12,7 @@ type InviteApply struct {
UserId uint64 `json:"user_id"` UserId uint64 `json:"user_id"`
NewUserId uint64 `json:"new_user_id"` NewUserId uint64 `json:"new_user_id"`
Platform string `json:"platform"` Platform string `json:"platform"`
PlatformId string `json:"platform_id"`
RechargeInfo string `json:"recharge_info"` RechargeInfo string `json:"recharge_info"`
Status uint8 `json:"status"` // 状态0.未审核1.已通过2.已拒绝 Status uint8 `json:"status"` // 状态0.未审核1.已通过2.已拒绝
VideoUrl string `json:"video_url"` VideoUrl string `json:"video_url"`
...@@ -19,9 +20,9 @@ type InviteApply struct { ...@@ -19,9 +20,9 @@ type InviteApply struct {
CreatedTime time.Time `json:"created_time"` CreatedTime time.Time `json:"created_time"`
} }
func CreateInviteApply(model *domain.Model, userId, newUserId uint64, platform, recharge, videoUrl string) error { func CreateInviteApply(model *domain.Model, userId, newUserId uint64, platform, platformId, recharge, videoUrl string) error {
err := model.DB().Create(&InviteApply{ err := model.DB().Create(&InviteApply{
UserId: userId, NewUserId: newUserId, Platform: platform, RechargeInfo: recharge, VideoUrl: videoUrl, UserId: userId, NewUserId: newUserId, Platform: platform, PlatformId: platformId, RechargeInfo: recharge, VideoUrl: videoUrl,
CreatedTime: time.Now()}).Error CreatedTime: time.Now()}).Error
if err != nil { if err != nil {
model.Log.Errorf("CreateInviteApply err:%v", err) model.Log.Errorf("CreateInviteApply err:%v", err)
......
...@@ -2,7 +2,8 @@ CREATE TABLE `invite_apply` ( ...@@ -2,7 +2,8 @@ CREATE TABLE `invite_apply` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`user_id` bigint NOT NULL COMMENT '发起申请者', `user_id` bigint NOT NULL COMMENT '发起申请者',
`new_user_id` bigint NOT NULL COMMENT '被邀请的人', `new_user_id` bigint NOT NULL COMMENT '被邀请的人',
`platform` varchar(20) NOT NULL COMMENT '从那个平台过来', `platform` varchar(20) NOT NULL COMMENT '来自平台',
`platform_id` varchar(150) NOT NULL COMMENT '平台id',
`recharge_info` varchar(50) NOT NULL COMMENT '新用户在其它平台充值的标志', `recharge_info` varchar(50) NOT NULL COMMENT '新用户在其它平台充值的标志',
`status` tinyint unsigned NOT NULL COMMENT '状态0.未审核1.已通过2.已拒绝', `status` tinyint unsigned NOT NULL COMMENT '状态0.未审核1.已通过2.已拒绝',
`level` varchar(5) NOT NULL DEFAULT '' COMMENT '申请等级(S,A,B,C)', `level` varchar(5) NOT NULL DEFAULT '' COMMENT '申请等级(S,A,B,C)',
......
...@@ -21,6 +21,7 @@ import ( ...@@ -21,6 +21,7 @@ import (
// @Summary 提交申请 // @Summary 提交申请
// @Param newUserCode formData string true "被邀请人id" // @Param newUserCode formData string true "被邀请人id"
// @Param platform formData string true "平台" // @Param platform formData string true "平台"
// @Param platformId formData string true "平台Id"
// @Param recharge formData string true "充值金额" // @Param recharge formData string true "充值金额"
// @Param userCode formData string true "邀请人id" // @Param userCode formData string true "邀请人id"
// @Param videoUrl formData string true "充值金额" // @Param videoUrl formData string true "充值金额"
...@@ -32,6 +33,7 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -32,6 +33,7 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) {
type paramStr struct { type paramStr struct {
NewUserCode string `form:"newUserCode" binding:"required"` NewUserCode string `form:"newUserCode" binding:"required"`
Platform string `form:"platform" binding:"required"` Platform string `form:"platform" binding:"required"`
PlatformId string `form:"platformId" binding:"required"`
Recharge string `form:"recharge" binding:"required"` Recharge string `form:"recharge" binding:"required"`
UserCode string `form:"userCode" binding:"required"` UserCode string `form:"userCode" binding:"required"`
VideoUrl string `form:"videoUrl" binding:"required"` VideoUrl string `form:"videoUrl" binding:"required"`
...@@ -104,7 +106,7 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -104,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.Recharge, param.VideoUrl) err = invite_m.CreateInviteApply(model, user.ID, newUser.ID, 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