Update cron.go
This commit is contained in:
parent
acfe5f9d3c
commit
0f52c6d265
@ -252,11 +252,11 @@ func GetImportData(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
//去重操作
|
//去重操作
|
||||||
m := make(map[string]struct{})
|
set := make(map[string]struct{})
|
||||||
var uniqueExcelData []excelData
|
var uniqueExcelData []excelData
|
||||||
for _, data := range readExcelResult {
|
for _, data := range readExcelResult {
|
||||||
if _, exists := m[data.SubName]; !exists {
|
if _, exists := set[data.SubName]; !exists {
|
||||||
m[data.SubName] = struct{}{}
|
set[data.SubName] = struct{}{}
|
||||||
uniqueExcelData = append(uniqueExcelData, data)
|
uniqueExcelData = append(uniqueExcelData, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -267,11 +267,11 @@ func GetImportData(c *gin.Context) {
|
|||||||
service.Error(c, errors.New("用户查询失败"))
|
service.Error(c, errors.New("用户查询失败"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//检查subname是否正确是否存在
|
||||||
subNames := make(map[string]struct{}, len(res.UserList))
|
subNames := make(map[string]struct{}, len(res.UserList))
|
||||||
for _, v := range res.UserList {
|
for _, v := range res.UserList {
|
||||||
subNames[v.SubNum] = struct{}{}
|
subNames[v.SubNum] = struct{}{}
|
||||||
}
|
}
|
||||||
//检查subname是否正确是否存在
|
|
||||||
for _, v := range uniqueExcelData {
|
for _, v := range uniqueExcelData {
|
||||||
if _, ok := subNames[v.SubName]; !ok {
|
if _, ok := subNames[v.SubName]; !ok {
|
||||||
service.Error(c, errors.New(fmt.Sprintf("第 %d 行数据错误,请检查数据!", v.Line)))
|
service.Error(c, errors.New(fmt.Sprintf("第 %d 行数据错误,请检查数据!", v.Line)))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user