add: SMF CDR

This commit is contained in:
2024-05-28 10:15:41 +08:00
parent 053fe3c429
commit 83488d27d1
12 changed files with 640 additions and 15 deletions

View File

@@ -10,3 +10,12 @@ type ICDREvent interface {
// DeleteByIds 批量删除信息
DeleteByIds(cdrIds []string) (int64, error)
}
// CDR会话事件 服务层接口
type SMFCDREvent interface {
// SelectPage 根据条件分页查询
SelectPage(querys model.SMFCDREventQuery) map[string]any
// DeleteByIds 批量删除信息
DeleteByIds(cdrIds []string) (int64, error)
}

View File

@@ -12,12 +12,21 @@ var NewCDREventImpl = &CDREventImpl{
cdrEventRepository: repository.NewCDREventImpl,
}
var NewSMFCDREventImpl = &SMFCDREventImpl{
cdrEventRepository: repository.NewSMFCDREventImpl,
}
// CDREventImpl CDR会话事件 服务层处理
type CDREventImpl struct {
// CDR会话事件数据信息
cdrEventRepository repository.ICDREvent
}
type SMFCDREventImpl struct {
// CDR会话事件数据信息
cdrEventRepository repository.SMFCDREvent
}
// SelectPage 根据条件分页查询
func (r *CDREventImpl) SelectPage(querys model.CDREventQuery) map[string]any {
return r.cdrEventRepository.SelectPage(querys)
@@ -38,3 +47,23 @@ func (r *CDREventImpl) DeleteByIds(cdrIds []string) (int64, error) {
// 删除信息失败!
return 0, fmt.Errorf("delete fail")
}
func (r *SMFCDREventImpl) SelectPage(querys model.SMFCDREventQuery) map[string]any {
return r.cdrEventRepository.SelectPage(querys)
}
// DeleteByIds 批量删除信息
func (r *SMFCDREventImpl) DeleteByIds(cdrIds []string) (int64, error) {
// 检查是否存在
ids := r.cdrEventRepository.SelectByIds(cdrIds)
if len(ids) <= 0 {
return 0, fmt.Errorf("not data")
}
if len(ids) == len(cdrIds) {
rows := r.cdrEventRepository.DeleteByIds(cdrIds)
return rows, nil
}
// 删除信息失败!
return 0, fmt.Errorf("delete fail")
}