添加错误输出

main
Administrator 2024-05-19 00:27:10 +08:00
parent b58b94d6f5
commit b874910cbe
2 changed files with 23 additions and 6 deletions

View File

@ -13,8 +13,8 @@ import (
"time"
)
const ToNginxFilepath = "C:\\Users\\wangaocean\\Desktop\\巡检\\"
const kimiUrl = "http://43.143.245.135:8000/v1/chat/completions"
const ToNginxFilepath = "/data/"
const kimiUrl = "http://127.0.0.1:8000/v1/chat/completions"
var liveMode bool
var operateTime = 1

View File

@ -106,19 +106,36 @@ func (e *Excel) CreateNewExcel(reply *Reply) { // 示例的 map
// 设置工作表的名称
index, err := f.NewSheet("Sheet1")
if err != nil {
log.Println("设置工作表名称失败,错误是:", err)
return
}
// 在第一行,第一列写入标题
f.SetCellValue("Sheet1", "A1", "工单id")
f.SetCellValue("Sheet1", "B1", "工单回复")
err = f.SetCellValue("Sheet1", "A1", "工单id")
if err != nil {
log.Println("写入A1标题失败错误是", err)
return
}
err = f.SetCellValue("Sheet1", "B1", "工单回复")
if err != nil {
log.Println("写入B1标题失败错误是", err)
return
}
//遍历 map将键和值写入 Excel 表格
row := 2
for key, value := range reply.replyContent {
log.Println(row, key, value)
f.SetCellValue("Sheet1", "A"+strconv.Itoa(row), key)
f.SetCellValue("Sheet1", "B"+strconv.Itoa(row), value)
err := f.SetCellValue("Sheet1", "A"+strconv.Itoa(row), key)
if err != nil {
log.Println("插入A行数据到excel实例中失败错误是", err)
return
}
err = f.SetCellValue("Sheet1", "B"+strconv.Itoa(row), value)
if err != nil {
log.Println("插入B行数据到excel实例中失败错误是", err)
return
}
row++
}