marvzhang
2020-03-28 12:33:20 +08:00
parent 62ccbd2087
commit d9880a2687
2 changed files with 7 additions and 7 deletions

View File

@@ -441,12 +441,12 @@ func UploadSpider(c *gin.Context) {
}
}
// 发起同步
services.PublishAllSpiders()
// 获取爬虫
spider = model.GetSpiderByName(spiderName)
// 发起同步
services.PublishSpider(spider)
c.JSON(http.StatusOK, Response{
Status: "ok",
Message: "success",

View File

@@ -149,10 +149,9 @@ func DeCompress(srcFile *os.File, dstPath string) error {
}
// 如果文件目录不存在,则创建一个
dirPath := filepath.Dir(innerFile.Name)
dirPath := filepath.Join(dstPath, filepath.Dir(innerFile.Name))
if !Exists(dirPath) {
err = os.MkdirAll(filepath.Join(dstPath, dirPath), os.ModeDir|os.ModePerm)
if err != nil {
if err = os.MkdirAll(dirPath, os.ModeDir|os.ModePerm); err != nil {
log.Errorf("Unzip File Error : " + err.Error())
debug.PrintStack()
return err
@@ -168,7 +167,8 @@ func DeCompress(srcFile *os.File, dstPath string) error {
}
// 创建新文件
newFile, err := os.OpenFile(filepath.Join(dstPath, innerFile.Name), os.O_RDWR|os.O_CREATE|os.O_TRUNC, info.Mode())
newFilePath := filepath.Join(dstPath, innerFile.Name)
newFile, err := os.OpenFile(newFilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, info.Mode())
if err != nil {
log.Errorf("Unzip File Error : " + err.Error())
debug.PrintStack()