|
@@ -86,23 +86,25 @@ func (this *ResourcePack) ConsumePack() {
|
|
|
return map[string]interface{}{"code": Code}, ""
|
|
|
}
|
|
|
//P228发送文件与文件下载需求文档
|
|
|
- var (
|
|
|
- uid = uuid.New().String()
|
|
|
- ossAddr = gconv.String(Ret["downUrl"])
|
|
|
+ if g.Cfg().MustGet(this.Request.Context(), "ossProxy.open", false).Bool() {
|
|
|
+ var (
|
|
|
+ uid = uuid.New().String()
|
|
|
+ ossAddr = gconv.String(Ret["downUrl"])
|
|
|
|
|
|
- fileName = filepath.Base(ossAddr)
|
|
|
- fileExt = filepath.Ext(fileName)
|
|
|
- cacheKey = fmt.Sprintf("attachment_%s%s", uid, fileExt)
|
|
|
- )
|
|
|
- cacheMap := map[string]interface{}{
|
|
|
- "userId": userId, //可下载文件用户职位id
|
|
|
- "source": ossAddr, //oss文件地址
|
|
|
- "noPower": fmt.Sprintf("%s/nologin/content/%s.html", config.Config.WebDomain, this.GetString("id")), //未登录或无权限跳转地址
|
|
|
- }
|
|
|
- if !redis.Put("newother", cacheKey, cacheMap, 60*60*24*30) {
|
|
|
- return map[string]interface{}{"code": -2}, "缓存异常"
|
|
|
+ fileName = filepath.Base(ossAddr)
|
|
|
+ fileExt = filepath.Ext(fileName)
|
|
|
+ cacheKey = fmt.Sprintf("attachment_%s%s", uid, fileExt)
|
|
|
+ )
|
|
|
+ cacheMap := map[string]interface{}{
|
|
|
+ "userId": userId, //可下载文件用户职位id
|
|
|
+ "source": ossAddr, //oss文件地址
|
|
|
+ "noPower": fmt.Sprintf("%s/nologin/content/%s.html", config.Config.WebDomain, this.GetString("id")), //未登录或无权限跳转地址
|
|
|
+ }
|
|
|
+ if !redis.Put("newother", cacheKey, cacheMap, 60*60*24*30) {
|
|
|
+ return map[string]interface{}{"code": -2}, "缓存异常"
|
|
|
+ }
|
|
|
+ Ret["downUrl"] = fmt.Sprintf("%s/jyoss/attachment/%s%s", g.Cfg().MustGet(this.Request.Context(), "ossProxy.addr", config.Config.WebDomain), uid, fileExt)
|
|
|
}
|
|
|
- Ret["downUrl"] = fmt.Sprintf("%s/jyoss/attachment/%s%s", g.Cfg().MustGet(this.Request.Context(), "ossProxyAddr", config.Config.WebDomain), uid, fileExt)
|
|
|
return Ret, ""
|
|
|
}()
|
|
|
if errMsg != "" {
|