feat: 更新多个模块以支持新的数据结构和日志格式

This commit is contained in:
TsMask
2025-02-20 10:08:27 +08:00
parent 045a2b6b01
commit f3c33b31ac
272 changed files with 13246 additions and 15885 deletions

View File

@@ -22,21 +22,21 @@ type CDREventSMF struct {
cdrEventRepository *repository.CDREventSMF // CDR会话事件数据信息
}
// SelectPage 根据条件分页查询
func (r *CDREventSMF) SelectPage(querys model.CDREventSMFQuery) ([]model.CDREventSMF, int64) {
// FindByPage 根据条件分页查询
func (r *CDREventSMF) FindByPage(querys model.CDREventSMFQuery) ([]model.CDREventSMF, int64) {
return r.cdrEventRepository.SelectByPage(querys)
}
// DeleteByIds 批量删除信息
func (r *CDREventSMF) DeleteByIds(cdrIds []string) (int64, error) {
func (r *CDREventSMF) DeleteByIds(ids []int64) (int64, error) {
// 检查是否存在
ids := r.cdrEventRepository.SelectByIds(cdrIds)
if len(ids) <= 0 {
rows := r.cdrEventRepository.SelectByIds(ids)
if len(rows) <= 0 {
return 0, fmt.Errorf("not data")
}
if len(ids) == len(cdrIds) {
rows := r.cdrEventRepository.DeleteByIds(cdrIds)
if len(rows) == len(ids) {
rows := r.cdrEventRepository.DeleteByIds(ids)
return rows, nil
}
// 删除信息失败!
@@ -77,7 +77,7 @@ func (r CDREventSMF) ExportXlsx(rows []model.CDREventSMF, fileName string) (stri
idx := strconv.Itoa(i + 2)
// 解析 JSON 字符串为 map
var cdrJSON map[string]interface{}
err := json.Unmarshal([]byte(row.CDRJSONStr), &cdrJSON)
err := json.Unmarshal([]byte(row.CdrJson), &cdrJSON)
if err != nil {
logger.Warnf("CDRExport Error parsing JSON: %s", err.Error())
continue
@@ -204,7 +204,7 @@ func (r CDREventSMF) ExportXlsx(rows []model.CDREventSMF, fileName string) (stri
"A" + idx: row.ID,
"B" + idx: chargingID,
"C" + idx: row.NeName,
"D" + idx: row.RmUID,
"D" + idx: row.RmUid,
"E" + idx: subscriptionIDData,
"F" + idx: subscriptionIDType,
"G" + idx: dataVolumeUplink,