From b8f18712a95da984cf34d1061ec4f5cd3733f861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 22 Oct 2020 10:23:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=81=8A=E5=A4=A9=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/user2.go | 2 +- business/jxstore/event/event.go | 7 ++++++- business/model/message.go | 1 + business/model/user.go | 32 +++++--------------------------- controllers/event.go | 3 ++- 5 files changed, 15 insertions(+), 30 deletions(-) diff --git a/business/jxstore/cms/user2.go b/business/jxstore/cms/user2.go index e04a5fc60..331914a38 100644 --- a/business/jxstore/cms/user2.go +++ b/business/jxstore/cms/user2.go @@ -251,7 +251,7 @@ func CreateUser(user *model.User, creatorName string) (err error) { dao.WrapAddIDCULDEntity(user, creatorName) user.UserID = utils.GetUUID() user.Status = model.UserStatusNormal - user.DividePercentage = 1 + // user.DividePercentage = 1 return dao.CreateEntity(nil, user) } diff --git a/business/jxstore/event/event.go b/business/jxstore/event/event.go index c4fca9423..df609e6ac 100644 --- a/business/jxstore/event/event.go +++ b/business/jxstore/event/event.go @@ -127,7 +127,7 @@ func GetOperateEvents(ctx *jxcontext.Context, name string, apiFunctions []string return pageInfo, err } -func CreateMessageGroup(ctx *jxcontext.Context, userID, userID2, groupName string, dividePercentage int) (messageGroupResult *dao.GetMessageGroupsResult, err error) { +func CreateMessageGroup(ctx *jxcontext.Context, userID, userID2, groupName string, dividePercentage, quitPrice int) (messageGroupResult *dao.GetMessageGroupsResult, err error) { var ( db = dao.GetDB() groupID int @@ -190,6 +190,11 @@ func CreateMessageGroup(ctx *jxcontext.Context, userID, userID2, groupName strin Type: model.GroupTypeMulit, MaxCount: 50, DividePercentage: dividePercentage, + QuitPrice: quitPrice, + } + user, err := dao.GetUserByID(db, "user_id", userID) + if groupName == "" { + messageGroup.Name = user.Name + "的集团" } dao.WrapAddIDCULDEntity(messageGroup, ctx.GetUserName()) dao.CreateEntity(db, messageGroup) diff --git a/business/model/message.go b/business/model/message.go index dd3ce41fa..f32e0e9cc 100644 --- a/business/model/message.go +++ b/business/model/message.go @@ -80,6 +80,7 @@ type MessageGroup struct { Type int `json:"type"` //组类型,1为单聊,2为群聊 MaxCount int `json:"maxCount"` //最大人数 DividePercentage int `json:"dividePercentage"` //分成比例 + QuitPrice int `json:"quitPrice"` //退出条件(金额) } func (*MessageGroup) TableIndex() [][]string { diff --git a/business/model/user.go b/business/model/user.go index 8c893e7f2..360e26662 100644 --- a/business/model/user.go +++ b/business/model/user.go @@ -57,11 +57,11 @@ type User struct { LastLoginIP string `orm:"size(64);column(last_login_ip)" json:"lastLoginIP"` LastLoginType string `orm:"size(16)" json:"lastLoginType"` - ParentMobile string `orm:"size(32)" json:"parentMobile"` - DividePercentage int `json:"dividePercentage"` - Profit int `json:"profit"` - ProfitSum int `json:"profitSum"` - Arrears int `json:"arrears"` + // ParentMobile string `orm:"size(32)" json:"parentMobile"` + // DividePercentage int `json:"dividePercentage"` + // Profit int `json:"profit"` + // ProfitSum int `json:"profitSum"` + // Arrears int `json:"arrears"` } func (*User) TableUnique() [][]string { @@ -98,28 +98,6 @@ func (user *User) GetAvatar() string { return user.Avatar } -type StoreBoss struct { - ModelIDCULD - UserID string `orm:"size(48);column(user_id);unique" json:"userID"` // 内部唯一标识 - BossName string `orm:"size(48);index" json:"bossName"` // 门店老板真实姓名 - StoreID int `orm:"column(store_id)" json:"storeID"` - ParentUserID string `orm:"size(48);column(parent_user_id)" json:"-"` - - ReferrerID string `orm:"size(48);index" json:"referrerID"` // 推荐人ID - ReferrerName string `orm:"size(48);index" json:"referrerName"` // 推荐人姓名 - - CityCode int `json:"cityCode"` // 期望开店所在的城市 - IDCardFront string `orm:"size(255);column(id_card_front)" json:"idCardFront"` - IDCardBack string `orm:"size(255);column(id_card_back)" json:"idCardBack"` - IDCardHand string `orm:"size(255);column(id_card_hand)" json:"idCardHand"` - Licence string `orm:"size(255)" json:"licence"` - LicenceCode string `orm:"size(32);index" json:"licenceCode"` - Remark string `orm:"type(text)" json:"-"` -} - -// const ( -// PaymentType -// ) type UserPayment struct { ModelIDCULD UserID string `orm:"size(48);column(user_id)" json:"userID"` // 内部唯一标识 diff --git a/controllers/event.go b/controllers/event.go index e972294bc..155ca3496 100644 --- a/controllers/event.go +++ b/controllers/event.go @@ -194,12 +194,13 @@ func (c *EventController) GetImMessageRecord() { // @Param userID2 formData string false "被拉的id 如果userID2为空就默认为是创建的群聊" // @Param name formData string false "如果是群聊,则要传入群名" // @Param dividePercentage formData int false "如果是群聊,则要传入分成比例" +// @Param quitPrice formData int false "如果是群聊,则要传入退团金额" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /CreateMessageGroup [post] func (c *EventController) CreateMessageGroup() { c.callCreateMessageGroup(func(params *tEventCreateMessageGroupParams) (retVal interface{}, errCode string, err error) { - retVal, err = event.CreateMessageGroup(params.Ctx, params.UserID, params.UserID2, params.Name, params.DividePercentage) + retVal, err = event.CreateMessageGroup(params.Ctx, params.UserID, params.UserID2, params.Name, params.DividePercentage, params.QuitPrice) return retVal, "", err }) }