作者 陈志颖

fix:列校验

... ... @@ -743,6 +743,32 @@ func (c *OrderInfoController) ImportOrderFromExcel() {
return
}
// 文件列数据校验
overColumnLine := make([]interface{}, 0)
for i, row := range rows {
if i > 2 && row != nil {
if len(row) > constant.EXCEL_COLUMN {
var tmpRow []string
tmpRow = append(tmpRow, "存在无效的数据列,请删除无效的列数据") // 错误信息
s := strconv.Itoa(i + 1)
tmpRow = append(tmpRow, s) // 行号
tmpRow = append(tmpRow, row...) // 错误行数据
overColumnLine = append(overColumnLine, tmpRow)
}
}
}
if len(overColumnLine) > 0 {
ret = map[string]interface{}{
"successCount": 0,
"fail": map[string]interface{}{
"tableHeader": tableHeader,
"tableData": overColumnLine,
},
}
c.ResponseData(ret)
return
}
// 数据行计数
rowCnt := 0
... ...