fix: 调整跟踪任务数据属性字段

This commit is contained in:
TsMask
2024-09-20 17:27:25 +08:00
parent 7fab266d20
commit 08dee2a3c2
3 changed files with 15 additions and 15 deletions

View File

@@ -16,7 +16,7 @@ var NewTraceData = &TraceDataController{
traceDataService: traceService.NewTraceData,
}
// 跟踪任务
// 跟踪任务数据
//
// PATH /data
type TraceDataController struct {
@@ -24,7 +24,7 @@ type TraceDataController struct {
traceDataService *traceService.TraceData
}
// 跟踪任务列表
// 跟踪任务数据列表
//
// GET /list
func (s *TraceDataController) List(c *gin.Context) {
@@ -35,7 +35,7 @@ func (s *TraceDataController) List(c *gin.Context) {
c.JSON(200, result.Ok(data))
}
// 跟踪任务删除
// 跟踪任务数据删除
//
// DELETE /:ids
func (s *TraceDataController) Remove(c *gin.Context) {

View File

@@ -4,8 +4,8 @@ package model
type TraceData struct {
ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
TaskId int64 `json:"taskId" gorm:"task_id"` // 任务ID
Imsi string `json:"imsi" gorm:"imsi"`
Msisdn string `json:"msisdn" gorm:"msisdn"` // 可能存在
IMSI string `json:"imsi" gorm:"imsi"`
MSISDN string `json:"msisdn" gorm:"msisdn"` // 可能存在
SrcAddr string `json:"srcAddr" gorm:"src_addr"` // 源地址带端口
DstAddr string `json:"dstAddr" gorm:"dst_addr"` // 目标地址带端口
IfType int64 `json:"ifType" gorm:"if_type"` // 接口类型,未分类

View File

@@ -17,8 +17,8 @@ var NewTraceData = &TraceData{
resultMap: map[string]string{
"id": "ID",
"task_id": "TaskId",
"imsi": "Imsi",
"msisdn": "Msisdn",
"imsi": "IMSI",
"msisdn": "MSISDN",
"src_addr": "SrcAddr",
"dst_addr": "DstAddr",
"if_type": "IfType",
@@ -124,13 +124,13 @@ func (r *TraceData) SelectList(data model.TraceData) []model.TraceData {
// 查询条件拼接
var conditions []string
var params []any
if data.Imsi != "" {
if data.IMSI != "" {
conditions = append(conditions, "imsi = ?")
params = append(params, data.Imsi)
params = append(params, data.IMSI)
}
if data.Msisdn != "" {
if data.MSISDN != "" {
conditions = append(conditions, "msisdn = ?")
params = append(params, data.Msisdn)
params = append(params, data.MSISDN)
}
// 构建查询条件语句
@@ -171,11 +171,11 @@ func (r *TraceData) Insert(data model.TraceData) string {
if data.TaskId > 0 {
params["task_id"] = data.TaskId
}
if data.Imsi != "" {
params["imsi"] = data.Imsi
if data.IMSI != "" {
params["imsi"] = data.IMSI
}
if data.Msisdn != "" {
params["msisdn"] = data.Msisdn
if data.MSISDN != "" {
params["msisdn"] = data.MSISDN
}
if data.SrcAddr != "" {
params["src_addr"] = data.SrcAddr