创建聊天组

This commit is contained in:
苏尹岚
2020-10-22 10:23:04 +08:00
parent bd1ae5558c
commit b8f18712a9
5 changed files with 15 additions and 30 deletions

View File

@@ -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)
}

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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"` // 内部唯一标识

View File

@@ -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
})
}