增加项目导出目录配置,可自定义导出的缓存目录

This commit is contained in:
lifei6671
2018-07-11 11:30:48 +08:00
parent 449fecd4eb
commit ebf36e6146
6 changed files with 24 additions and 10 deletions

View File

@@ -216,9 +216,12 @@ func (m *BookResult) ToBookResult(book Book) *BookResult {
//后台转换
func BackgroupConvert(sessionId string,bookResult *BookResult){
exportLimitWorkerChannel.LoadOrStore(bookResult.Identify, func() {
err := exportLimitWorkerChannel.LoadOrStore(bookResult.Identify, func() {
bookResult.Converter(sessionId)
})
if err != nil {
beego.Error("将导出任务加入任务队列失败 -> ",err)
}
exportLimitWorkerChannel.Start()
}
@@ -227,7 +230,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
convertBookResult := ConvertBookResult{}
outputPath := filepath.Join(conf.WorkingDirectory, "uploads", "books", strconv.Itoa(m.BookId))
outputPath := filepath.Join(conf.GetExportOutputPath(), strconv.Itoa(m.BookId))
viewPath := beego.BConfig.WebConfig.ViewsPath
pdfpath := filepath.Join(outputPath, "book.pdf")