Files
chain33-dtalk/service/group/model/db/groupapply.go
2022-03-17 15:59:24 +08:00

60 lines
1.5 KiB
Go

package db
import (
"gitlab.33.cn/chat/dtalk/service/group/model/biz"
"gitlab.33.cn/utils/go-kit/convert"
)
type GroupApply struct {
// 审批 ID
Id int64
// 群 ID
GroupId int64
// 邀请人 ID, 空表示是自己主动申请的
InviterId string
// 申请加入人 ID
MemberId string
// 申请备注
ApplyNote string
// 审批人 ID
OperatorId string
// 审批情况 0=待审批, 1=审批通过, 2=审批不通过, 10=审批忽略
ApplyStatus int32
// 拒绝原因
RejectReason string
// 创建时间 ms
CreateTime int64
// 修改时间 ms
UpdateTime int64
}
func ConvertGroupApply(res map[string]string) *GroupApply {
return &GroupApply{
Id: convert.ToInt64(res["id"]),
GroupId: convert.ToInt64(res["group_id"]),
InviterId: convert.ToString(res["inviter_id"]),
MemberId: convert.ToString(res["member_id"]),
ApplyNote: convert.ToString(res["apply_note"]),
OperatorId: convert.ToString(res["operator_id"]),
ApplyStatus: convert.ToInt32(res["apply_status"]),
RejectReason: convert.ToString(res["reject_reason"]),
CreateTime: convert.ToInt64(res["create_time"]),
UpdateTime: convert.ToInt64(res["update_time"]),
}
}
func (a *GroupApply) ToBiz() *biz.GroupApplyBiz {
return &biz.GroupApplyBiz{
ApplyId: a.Id,
GroupId: a.GroupId,
InviterId: a.InviterId,
MemberId: a.MemberId,
ApplyNote: a.ApplyNote,
OperatorId: a.OperatorId,
ApplyStatus: a.ApplyStatus,
RejectReason: a.RejectReason,
CreateTime: a.CreateTime,
UpdateTime: a.UpdateTime,
}
}