group add field

pull/255/head
Gordon 2 years ago
parent 504e4cc6a3
commit adb7da7aaf

@ -779,12 +779,7 @@ func SetGroupInfo(c *gin.Context) {
req := &rpc.SetGroupInfoReq{GroupInfoForSet: &open_im_sdk.GroupInfoForSet{}}
utils.CopyStructFields(req.GroupInfoForSet, &params)
req.OperationID = params.OperationID
if params.NeedVerification != nil {
req.GroupInfoForSet.NeedVerification = &wrappers.Int32Value{Value: *params.NeedVerification}
log.NewInfo(req.OperationID, "NeedVerification ", req.GroupInfoForSet.NeedVerification)
}
argsHandle(&params, req)
var ok bool
var errInfo string
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
@ -815,6 +810,20 @@ func SetGroupInfo(c *gin.Context) {
c.JSON(http.StatusOK, resp)
log.NewInfo(req.OperationID, "SetGroupInfo api return ", resp)
}
func argsHandle(params *api.SetGroupInfoReq, req *rpc.SetGroupInfoReq) {
if params.NeedVerification != nil {
req.GroupInfoForSet.NeedVerification = &wrappers.Int32Value{Value: *params.NeedVerification}
log.NewInfo(req.OperationID, "NeedVerification ", req.GroupInfoForSet.NeedVerification)
}
if params.LookMemberInfo != nil {
req.GroupInfoForSet.LookMemberInfo = &wrappers.Int32Value{Value: *params.LookMemberInfo}
log.NewInfo(req.OperationID, "LookMemberInfo ", req.GroupInfoForSet.LookMemberInfo)
}
if params.ApplyMemberFriend != nil {
req.GroupInfoForSet.ApplyMemberFriend = &wrappers.Int32Value{Value: *params.ApplyMemberFriend}
log.NewInfo(req.OperationID, "ApplyMemberFriend ", req.GroupInfoForSet.ApplyMemberFriend)
}
}
// @Summary 转让群主
// @Description 转让群主

@ -1092,7 +1092,24 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, http.WrapError(constant.ErrDB)
}
}
if req.GroupInfoForSet.LookMemberInfo != nil {
changedType = changedType | (1 << 5)
m := make(map[string]interface{})
m["look_member_info"] = req.GroupInfoForSet.LookMemberInfo.Value
if err := imdb.UpdateGroupInfoDefaultZero(req.GroupInfoForSet.GroupID, m); err != nil {
log.NewError(req.OperationID, "UpdateGroupInfoDefaultZero failed ", err.Error(), m)
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, http.WrapError(constant.ErrDB)
}
}
if req.GroupInfoForSet.ApplyMemberFriend != nil {
changedType = changedType | (1 << 6)
m := make(map[string]interface{})
m["apply_member_friend"] = req.GroupInfoForSet.ApplyMemberFriend.Value
if err := imdb.UpdateGroupInfoDefaultZero(req.GroupInfoForSet.GroupID, m); err != nil {
log.NewError(req.OperationID, "UpdateGroupInfoDefaultZero failed ", err.Error(), m)
return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, http.WrapError(constant.ErrDB)
}
}
//
//if req.RoleLevel != nil {
//

@ -178,14 +178,16 @@ type QuitGroupResp struct {
}
type SetGroupInfoReq struct {
GroupID string `json:"groupID" binding:"required"`
GroupName string `json:"groupName"`
Notification string `json:"notification"`
Introduction string `json:"introduction"`
FaceURL string `json:"faceURL"`
Ex string `json:"ex"`
OperationID string `json:"operationID" binding:"required"`
NeedVerification *int32 `json:"needVerification" binding "oneof=0 1 2"`
GroupID string `json:"groupID" binding:"required"`
GroupName string `json:"groupName"`
Notification string `json:"notification"`
Introduction string `json:"introduction"`
FaceURL string `json:"faceURL"`
Ex string `json:"ex"`
OperationID string `json:"operationID" binding:"required"`
NeedVerification *int32 `json:"needVerification" binding:"oneof=0 1 2"`
LookMemberInfo *int32 `json:"lookMemberInfo" binding:"oneof=0 1"`
ApplyMemberFriend *int32 `json:"applyMemberFriend" binding:"oneof=0 1"`
}
type SetGroupInfoResp struct {

@ -77,17 +77,19 @@ func (FriendRequest) TableName() string {
type Group struct {
//`json:"operationID" binding:"required"`
//`protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` `json:"operationID" binding:"required"`
GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"`
GroupName string `gorm:"column:name;size:255" json:"groupName"`
Notification string `gorm:"column:notification;size:255" json:"notification"`
Introduction string `gorm:"column:introduction;size:255" json:"introduction"`
FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"`
CreateTime time.Time `gorm:"column:create_time"`
Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"`
Status int32 `gorm:"column:status"`
CreatorUserID string `gorm:"column:creator_user_id;size:64"`
GroupType int32 `gorm:"column:group_type"`
NeedVerification int32 `gorm:"column:need_verification"`
GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"`
GroupName string `gorm:"column:name;size:255" json:"groupName"`
Notification string `gorm:"column:notification;size:255" json:"notification"`
Introduction string `gorm:"column:introduction;size:255" json:"introduction"`
FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"`
CreateTime time.Time `gorm:"column:create_time"`
Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"`
Status int32 `gorm:"column:status"`
CreatorUserID string `gorm:"column:creator_user_id;size:64"`
GroupType int32 `gorm:"column:group_type"`
NeedVerification int32 `gorm:"column:need_verification"`
LookMemberInfo int32 `gorm:"column:look_member_info" json:"lookMemberInfo"`
ApplyMemberFriend int32 `gorm:"column:apply_member_friend" json:"applyMemberFriend"`
}
//message GroupMemberFullInfo {

File diff suppressed because it is too large Load Diff

@ -21,6 +21,8 @@ message GroupInfo{
string creatorUserID = 11;
int32 groupType = 12;
int32 needVerification = 13;
int32 lookMemberInfo =14;
int32 applyMemberFriend = 15;
}
message GroupInfoForSet{
@ -31,6 +33,8 @@ message GroupInfoForSet{
string faceURL = 5;
string ex = 6;
google.protobuf.Int32Value needVerification = 7;
google.protobuf.Int32Value lookMemberInfo = 8;
google.protobuf.Int32Value applyMemberFriend = 9;
}

Loading…
Cancel
Save