|
@@ -54,14 +54,14 @@ func DocDownload(in *partnerlib.UserDownloadRequest) (res *partnerlib.UDRes, err
|
|
}
|
|
}
|
|
fileId := util.GetHashKey(b)
|
|
fileId := util.GetHashKey(b)
|
|
ossId := fmt.Sprintf("%s.%s", fileId, docInfo.DocFileSuffix)
|
|
ossId := fmt.Sprintf("%s.%s", fileId, docInfo.DocFileSuffix)
|
|
- go func(_ossId, _fileId string, _docInfo *model.Docin) {
|
|
|
|
|
|
+ fileUploadCache := fmt.Sprintf("file_upload_ing_%s", ossId)
|
|
|
|
+ redis.Put(entity.RedisCode, fileUploadCache, ossId, 60*60)
|
|
|
|
+ go func(_ossId, _fileId, fileUploadCache string, _docInfo *model.Docin) {
|
|
//并发ing
|
|
//并发ing
|
|
entity.FileUploadChanel <- true
|
|
entity.FileUploadChanel <- true
|
|
defer func() {
|
|
defer func() {
|
|
<-entity.FileUploadChanel
|
|
<-entity.FileUploadChanel
|
|
}()
|
|
}()
|
|
- fileUploadCache := fmt.Sprintf("file_upload_ing_%s", _ossId)
|
|
|
|
- redis.Put(entity.RedisCode, fileUploadCache, _ossId, 2*60*60)
|
|
|
|
defer func() {
|
|
defer func() {
|
|
redis.Del(entity.RedisCode, fileUploadCache)
|
|
redis.Del(entity.RedisCode, fileUploadCache)
|
|
}()
|
|
}()
|
|
@@ -80,7 +80,7 @@ func DocDownload(in *partnerlib.UserDownloadRequest) (res *partnerlib.UDRes, err
|
|
err = fmt.Errorf("文档上传失败")
|
|
err = fmt.Errorf("文档上传失败")
|
|
warn.SendMsgByWXURL(fmt.Sprintf("文档id:%s,文档名称:%s,上传到oss异常:%s", _docInfo.Id, _docInfo.DocName, err.Error()))
|
|
warn.SendMsgByWXURL(fmt.Sprintf("文档id:%s,文档名称:%s,上传到oss异常:%s", _docInfo.Id, _docInfo.DocName, err.Error()))
|
|
}
|
|
}
|
|
- }(ossId, fileId, docInfo)
|
|
|
|
|
|
+ }(ossId, fileId, fileUploadCache, docInfo)
|
|
//更新doc
|
|
//更新doc
|
|
if errUpdate := partner.DocsUpdate(0, model.Doc{
|
|
if errUpdate := partner.DocsUpdate(0, model.Doc{
|
|
Id: in.DocId,
|
|
Id: in.DocId,
|