You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
556 B
32 lines
556 B
package test
|
|
|
|
import (
|
|
"github.com/360EntSecGroup-Skylar/excelize/v2"
|
|
"hudongzhuanjia/models"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestAddSensitive(t *testing.T) {
|
|
f, err := excelize.OpenFile("敏感词汇.xlsx")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
rows, err := f.GetRows("big_audit_keyword")
|
|
for i, row := range rows {
|
|
if i == 0 {
|
|
continue
|
|
}
|
|
|
|
if err := models.Save(nil, &models.Sensitive{
|
|
Keyword: row[1],
|
|
Category: row[2],
|
|
Host: row[3],
|
|
CreateAt: time.Now(),
|
|
UpdateAt: time.Now(),
|
|
}, nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
}
|