正在显示
4 个修改的文件
包含
15 行增加
和
29 行删除
@@ -39,7 +39,7 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | @@ -39,7 +39,7 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | ||
39 | if err != nil { | 39 | if err != nil { |
40 | return nil, xerr.NewErrMsgErr("帖子不存在", err) | 40 | return nil, xerr.NewErrMsgErr("帖子不存在", err) |
41 | } | 41 | } |
42 | - //获取图片的尺寸大小 | 42 | + // 获取图片的尺寸大小 |
43 | images := []domain.Image{} | 43 | images := []domain.Image{} |
44 | for _, val := range req.Images { | 44 | for _, val := range req.Images { |
45 | fInfo, _ := oss.GetImageInfo(val) | 45 | fInfo, _ := oss.GetImageInfo(val) |
@@ -136,8 +136,7 @@ func (repository *ArticleAndTagRepository) DomainModelToModel(from *domain.Artic | @@ -136,8 +136,7 @@ func (repository *ArticleAndTagRepository) DomainModelToModel(from *domain.Artic | ||
136 | // 以TagId作为分组,统计所有已有标签的文章和人员已读的文章 | 136 | // 以TagId作为分组,统计所有已有标签的文章和人员已读的文章 |
137 | func (repository *ArticleAndTagRepository) CountArticleReadGroupByTag(ctx context.Context, conn transaction.Conn, userId int64, companyId int64) ([]*domain.CountArticleTagRead, error) { | 137 | func (repository *ArticleAndTagRepository) CountArticleReadGroupByTag(ctx context.Context, conn transaction.Conn, userId int64, companyId int64) ([]*domain.CountArticleTagRead, error) { |
138 | 138 | ||
139 | - sqlStr := ` | ||
140 | --- 首页统计数据 | 139 | + sqlStr := `-- 首页统计数据 |
141 | with | 140 | with |
142 | -- 按查看权限查询文章 | 141 | -- 按查看权限查询文章 |
143 | -- 获取有标签的文章 | 142 | -- 获取有标签的文章 |
@@ -278,27 +278,11 @@ func NewArticleRepository(cache *cache.CachedRepository) domain.ArticleRepositor | @@ -278,27 +278,11 @@ func NewArticleRepository(cache *cache.CachedRepository) domain.ArticleRepositor | ||
278 | return &ArticleRepository{CachedRepository: cache} | 278 | return &ArticleRepository{CachedRepository: cache} |
279 | } | 279 | } |
280 | 280 | ||
281 | -// -- 首页统计数据 | ||
282 | -// with | ||
283 | -// -- 按查看权限查询文章 | ||
284 | -// -- 获取有标签的文章 | ||
285 | -// -- 过滤出可展示的文章id | ||
286 | -// t_article_and_tag_2 as ( | ||
287 | -// select article_and_tag.article_id , article_and_tag.tag_id | ||
288 | -// from article_and_tag | ||
289 | -// join article on article_and_tag.article_id = article.id | ||
290 | -// where article.deleted_at=0 | ||
291 | -// and article.company_id =1598224576532189184 | ||
292 | -// and article."show" =0 | ||
293 | -// and (article.target_user =0 or article.who_read @>'[1]') | ||
294 | -// ), | ||
295 | -// -- 查询人员已查看的文章 | ||
296 | -// t_user_read as( | ||
297 | -// select user_read_article.article_id from user_read_article where user_read_article.user_id =1 | ||
298 | -// ) | ||
299 | -// -- 汇总统计 cnt_1符合条件的文章总数,cnt_2 已浏览的数量 | ||
300 | -// select count(t_article_and_tag_2.article_id) as cnt_1 ,count(t_user_read.article_id) as cnt_2, t_article_and_tag_2.tag_id | ||
301 | -// from t_article_and_tag_2 | ||
302 | -// left join t_user_read on t_article_and_tag_2.article_id=t_user_read.article_id | ||
303 | -// group by t_article_and_tag_2.tag_id | ||
304 | -// ; | 281 | +// select * |
282 | +// from article | ||
283 | +// join article_and_tag on article.id = article_and_tag.article_id | ||
284 | +// where article."show" =1 | ||
285 | +// and article_and_tag.tag_id =any(select article_tag.id from article_tag where category ='分组三' ) | ||
286 | +// and article_and_tag.tag_id =0 | ||
287 | +// and article.created_at >=0 and article.created_at <=9000000000 | ||
288 | +// and article.title like '%%' |
@@ -41,7 +41,7 @@ func GetImageInfo(url string) (info FileInfo, err error) { | @@ -41,7 +41,7 @@ func GetImageInfo(url string) (info FileInfo, err error) { | ||
41 | return info, err | 41 | return info, err |
42 | } | 42 | } |
43 | httpclient := http.Client{ | 43 | httpclient := http.Client{ |
44 | - Timeout: 30 * time.Second, | 44 | + Timeout: 5 * time.Second, |
45 | } | 45 | } |
46 | resp, err := httpclient.Do(req) | 46 | resp, err := httpclient.Do(req) |
47 | if err != nil { | 47 | if err != nil { |
@@ -70,7 +70,10 @@ func GetVideoCover(videoUrl string) (coverUrl string, w int, h int, err error) { | @@ -70,7 +70,10 @@ func GetVideoCover(videoUrl string) (coverUrl string, w int, h int, err error) { | ||
70 | return | 70 | return |
71 | } | 71 | } |
72 | videoUrl = videoUrl + "?x-oss-process=video/snapshot,t_100,f_jpg,m_fast" | 72 | videoUrl = videoUrl + "?x-oss-process=video/snapshot,t_100,f_jpg,m_fast" |
73 | - res, err := http.Get(videoUrl) | 73 | + httpclient := http.Client{ |
74 | + Timeout: 5 * time.Second, | ||
75 | + } | ||
76 | + res, err := httpclient.Get(videoUrl) | ||
74 | if err != nil || res.StatusCode != http.StatusOK { | 77 | if err != nil || res.StatusCode != http.StatusOK { |
75 | return videoUrl, 600, 600, fmt.Errorf("获取图片失败:%s", err) | 78 | return videoUrl, 600, 600, fmt.Errorf("获取图片失败:%s", err) |
76 | } | 79 | } |
-
请 注册 或 登录 后发表评论