Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/dms/service/company_notice.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ func (d *DMSService) GetCompanyNotice(ctx context.Context, currentUserUid string
}
if companyNotice != nil {
data.NoticeStr = companyNotice.NoticeStr
if companyNotice.CreateUserUID != "" {
users := d.UserUsecase.GetBizUserWithNameByUids(ctx, []string{companyNotice.CreateUserUID})
if len(users) > 0 {
data.CreateUserName = users[0].Name
}
}
data.StartTime = companyNotice.StartTime
data.ExpireTime = companyNotice.EndTime
}
Expand Down
6 changes: 6 additions & 0 deletions internal/dms/storage/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,17 +988,23 @@ func convertBizCompanyNotice(b *biz.CompanyNotice) (*model.CompanyNotice, error)
Model: model.Model{
UID: b.UID,
},
CreateUserUID: b.CreateUserUID,
NoticeStr: b.NoticeStr,
ReadUserIds: b.ReadUserIds,
StartTime: b.StartTime,
EndTime: b.EndTime,
}, nil
}

func convertModelCompanyNotice(m *model.CompanyNotice) (*biz.CompanyNotice, error) {
p := &biz.CompanyNotice{
Base: convertBase(m.Model),
UID: m.UID,
CreateUserUID: m.CreateUserUID,
NoticeStr: m.NoticeStr,
ReadUserIds: m.ReadUserIds,
StartTime: m.StartTime,
EndTime: m.EndTime,
}

return p, nil
Expand Down
3 changes: 3 additions & 0 deletions internal/dms/storage/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,11 @@ type BasicConfig struct {

type CompanyNotice struct {
Model
CreateUserUID string `json:"create_user_uid" gorm:"column:create_user_uid;size:32;comment:'创建人uid'"`
NoticeStr string `gorm:"type:mediumtext;comment:'企业公告'" json:"notice_str"`
ReadUserIds ReadUsers `gorm:"type:longtext" json:"read_user_ids"`
StartTime *time.Time `json:"start_time" gorm:"column:start_time;comment:'公告开始时间'"`
EndTime *time.Time `json:"end_time" gorm:"column:end_time;comment:'公告结束时间'"`
}

type ReadUsers []string
Expand Down