package service import ( "iot_manager_service/app/warn/dao" "iot_manager_service/app/warn/model" ) var NoticeRecordService = new(noticeRecordService) type noticeRecordService struct{} func (s noticeRecordService) List(tenantId string, filter model.RequestNoticeRecordFilter) ([]model.ResposeNoticeRecordData, int64, error) { var list []model.ResposeNoticeRecordData dao := dao.NoticeRecord{} records, total, err := dao.GetList(filter) for _, record := range records { var SendUser, ArmClassifyName string if record.ArmClassify == 1 { SendUser = record.NoticeSet.DevUserIdsName ArmClassifyName = "运维" } else { SendUser = record.NoticeSet.BusinessUserIdsName ArmClassifyName = "业务" } status := record.Status sendStatusName := "失败" if status == 1 { sendStatusName = "成功" } list = append(list, model.ResposeNoticeRecordData{ ID: int(record.ID), RecordID: int(record.ID), SendUser: SendUser, SendTime: record.CreatedAt.Format("2006-01-02 15:04:05"), SendType: record.SendType, SendValue: record.SendValue, ClassifyName: ArmClassifyName, TenantID: record.NoticeSet.TenantId, ArmContend: record.Content, SendName: record.SendName, SendTypeName: record.SendTypeName, SendStatusName: sendStatusName, }) } return list, total, err }