c端当前套餐开始时间过期时间,以及excel导入字段
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m55s

This commit is contained in:
2026-05-06 09:57:58 +08:00
parent ee7bfb81f0
commit 21b73a750d
9 changed files with 109 additions and 83 deletions

View File

@@ -42,6 +42,7 @@ type DeviceParseResult struct {
type DeviceRow struct {
Line int
VirtualNo string
SN string
IMEI string // 设备IMEI对应 Excel IMEI 列,用于 Gateway API 调用
DeviceName string
DeviceModel string
@@ -132,8 +133,8 @@ func ParseDeviceExcel(filePath string) (*DeviceParseResult, error) {
}
// 按固定列位置读取第1行为表头跳过
// col0=虚拟号 col1=设备名称 col2=设备型号 col3=设备型 col4=IMEI
// col5=制造商 col6=最大SIM槽数 col7~10=卡1~4 ICCID
// col0=虚拟号 col1=SN col2=设备名称 col3=设备型 col4=设备类型
// col5=IMEI col6=制造商 col7=最大SIM槽数 col8~11=卡1~4 ICCID
for i := 1; i < len(rows); i++ {
record := rows[i]
lineNum := i + 1
@@ -148,26 +149,27 @@ func ParseDeviceExcel(filePath string) (*DeviceParseResult, error) {
}
row.VirtualNo = getCol(0)
row.DeviceName = getCol(1)
row.DeviceModel = getCol(2)
row.DeviceType = getCol(3)
row.IMEI = getCol(4)
row.Manufacturer = getCol(5)
maxSimSlotsStr := getCol(6)
row.SN = getCol(1)
row.DeviceName = getCol(2)
row.DeviceModel = getCol(3)
row.DeviceType = getCol(4)
row.IMEI = getCol(5)
row.Manufacturer = getCol(6)
maxSimSlotsStr := getCol(7)
row.SlotICCIDs = make([]DeviceSlotICCID, 0, 4)
for j := 7; j <= 10; j++ {
for j := 8; j <= 11; j++ {
iccid := getCol(j)
if iccid != "" {
row.SlotICCIDs = append(row.SlotICCIDs, DeviceSlotICCID{
SlotPosition: j - 6,
SlotPosition: j - 7,
ICCID: iccid,
})
}
}
// 整行目标列皆为空,视为空行跳过,不计入 total
if row.VirtualNo == "" && row.DeviceName == "" && row.DeviceModel == "" &&
if row.VirtualNo == "" && row.SN == "" && row.DeviceName == "" && row.DeviceModel == "" &&
row.DeviceType == "" && row.IMEI == "" && row.Manufacturer == "" &&
maxSimSlotsStr == "" && len(row.SlotICCIDs) == 0 {
continue