feat: UDM鉴权用户记录加载数据的时间

This commit is contained in:
TsMask
2025-08-14 20:25:32 +08:00
parent bd6ee1bc26
commit 6c72cd2964
5 changed files with 29 additions and 22 deletions

View File

@@ -2,13 +2,14 @@ package model
// UDMAuthUser UDM鉴权用户 u_auth_user
type UDMAuthUser struct {
ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 默认ID
IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID
NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识
Amf string `json:"amf" gorm:"column:amf"` // AMF
Ki string `json:"ki" gorm:"column:ki"` // ki
AlgoIndex string `json:"algoIndex" gorm:"column:algo_index"` // algoIndex
Opc string `json:"opc" gorm:"column:opc"` // OPC
ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"` // 默认ID
IMSI string `json:"imsi" gorm:"column:imsi"` // SIM卡/USIM卡ID
NeId string `json:"neId" gorm:"column:ne_id"` // UDM网元标识
Amf string `json:"amf" gorm:"column:amf"` // AMF
Ki string `json:"ki" gorm:"column:ki"` // ki
AlgoIndex string `json:"algoIndex" gorm:"column:algo_index"` // algoIndex
Opc string `json:"opc" gorm:"column:opc"` // OPC
CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间
}
// TableName 表名称

View File

@@ -13,17 +13,18 @@ import (
// 实例化数据层 UDMAuthUser 结构体
var NewUDMAuthUser = &UDMAuthUser{
selectSql: `select id, imsi, ne_id, amf, status, ki, algo_index, opc from u_auth_user`,
selectSql: `select id, imsi, ne_id, amf, status, ki, algo_index, opc, create_time from u_auth_user`,
resultMap: map[string]string{
"id": "ID",
"imsi": "IMSI",
"ne_id": "NeId",
"amf": "Amf",
"status": "Status",
"ki": "Ki",
"algo_index": "AlgoIndex",
"opc": "Opc",
"id": "ID",
"imsi": "IMSI",
"ne_id": "NeId",
"amf": "Amf",
"status": "Status",
"ki": "Ki",
"algo_index": "AlgoIndex",
"opc": "Opc",
"create_time": "CreateTime",
},
}

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"strconv"
"strings"
"time"
"be.ems/src/framework/database/redis"
"be.ems/src/modules/network_data/model"
@@ -64,12 +65,13 @@ func (r *UDMAuthUser) dataByRedis(imsi, neId string) []model.UDMAuthUser {
amf = strings.Replace(v, "\r\n", "", 1)
}
a := model.UDMAuthUser{
IMSI: imsi,
Amf: amf,
Ki: m["ki"],
AlgoIndex: m["algo"],
Opc: m["opc"],
NeId: neId,
IMSI: imsi,
Amf: amf,
Ki: m["ki"],
AlgoIndex: m["algo"],
Opc: m["opc"],
NeId: neId,
CreateTime: time.Now().UnixMilli(),
}
arr = append(arr, a)
}