This commit is contained in:
陈景阳
2019-09-26 21:13:25 +08:00
parent f14085666b
commit 412e0fd983
3 changed files with 2 additions and 3 deletions

View File

@@ -116,7 +116,7 @@ func PublishSpider(spider model.Spider) {
// 查询gf file不存在则删除
gfFile := model.GetGridFs(spider.FileId)
if gfFile == nil {
_ = model.RemoveSpider(spider.FileId)
_ = model.RemoveSpider(spider.Id)
return
}
spiderSync := spider_handler.SpiderSync{

View File

@@ -93,7 +93,6 @@ func (s *SpiderSync) Download() {
}
}
// 创建临时文件
tmpFilePath := filepath.Join(tmpPath, randomId.String()+".zip")
tmpFile := utils.OpenFile(tmpFilePath)
defer tmpFile.Close()

View File

@@ -25,7 +25,7 @@ func ReadFile(fileName string) string {
// 创建文件
func OpenFile(fileName string) *os.File {
file, err := os.OpenFile(fileName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, os.ModePerm)
file, err := os.OpenFile(fileName, os.O_CREATE|os.O_RDWR, os.ModePerm)
if err != nil {
log.Errorf("create file error: %s, file_name: %s", err.Error(), fileName)
debug.PrintStack()