3232
This commit is contained in:
parent
f88977c98f
commit
d23a7fa6f9
|
|
@ -19,6 +19,7 @@ type Collect struct {
|
||||||
Platform string `gorm:"column:platform;not null" json:"platform"`
|
Platform string `gorm:"column:platform;not null" json:"platform"`
|
||||||
Question string `gorm:"column:question;not null" json:"question"`
|
Question string `gorm:"column:question;not null" json:"question"`
|
||||||
Progress int32 `gorm:"column:progress;not null" json:"progress"`
|
Progress int32 `gorm:"column:progress;not null" json:"progress"`
|
||||||
|
ReportStatus int32 `gorm:"column:report_status;not null" json:"report_status"`
|
||||||
EndFile string `gorm:"column:end_file;not null" json:"end_file"`
|
EndFile string `gorm:"column:end_file;not null" json:"end_file"`
|
||||||
CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP" json:"created_at"`
|
CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP" json:"updated_at"`
|
UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||||
|
|
|
||||||
|
|
@ -283,6 +283,7 @@ func (c *CollectService) CollectAan(ctx *fiber.Ctx, req *entitys.CollectAnaReque
|
||||||
if collectInfo.ID == 0 {
|
if collectInfo.ID == 0 {
|
||||||
return errcode.NotFound("为找到收录计划")
|
return errcode.NotFound("为找到收录计划")
|
||||||
}
|
}
|
||||||
|
err = c.collect.UpdateByKey(ctx.UserContext(), c.collect.PrimaryKey(), req.CollectId, map[string]interface{}{"report_status": 2})
|
||||||
var tasks []model.CollectTask
|
var tasks []model.CollectTask
|
||||||
taskCond := builder.NewCond().And(builder.In("collect_code", collectInfo.CollectCode))
|
taskCond := builder.NewCond().And(builder.In("collect_code", collectInfo.CollectCode))
|
||||||
_, err = c.collectTask.GetListToStruct(ctx.UserContext(), &taskCond, nil, &tasks, "created_at ASC")
|
_, err = c.collectTask.GetListToStruct(ctx.UserContext(), &taskCond, nil, &tasks, "created_at ASC")
|
||||||
|
|
@ -310,12 +311,13 @@ func (c *CollectService) CollectAan(ctx *fiber.Ctx, req *entitys.CollectAnaReque
|
||||||
}
|
}
|
||||||
|
|
||||||
docxPath, err := pkg.Md2wordFix(mdAbs, c.cfg.Sys.MdDir, nil)
|
docxPath, err := pkg.Md2wordFix(mdAbs, c.cfg.Sys.MdDir, nil)
|
||||||
defer os.Remove(docxPath)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
docxName := fmt.Sprintf("%s.docx", fileBaseName)
|
docxName := fmt.Sprintf("%s.docx", fileBaseName)
|
||||||
docxAbs := filepath.Join(docxPath, docxName)
|
docxAbs := filepath.Join(docxPath, docxName)
|
||||||
|
defer os.Remove(docxAbs)
|
||||||
fileByte, err := pkg.ReadDocxToBytes(docxAbs)
|
fileByte, err := pkg.ReadDocxToBytes(docxAbs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -325,7 +327,7 @@ func (c *CollectService) CollectAan(ctx *fiber.Ctx, req *entitys.CollectAnaReque
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("上传文件失败: %w", err)
|
return fmt.Errorf("上传文件失败: %w", err)
|
||||||
}
|
}
|
||||||
err = c.collect.UpdateByKey(ctx.UserContext(), c.collect.PrimaryKey(), req.CollectId, map[string]interface{}{"end_file": url})
|
err = c.collect.UpdateByKey(ctx.UserContext(), c.collect.PrimaryKey(), req.CollectId, map[string]interface{}{"end_file": url, "report_status": 3})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue