作者 tangxvhui

暂存

... ... @@ -39,7 +39,7 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU
if err != nil {
return nil, xerr.NewErrMsgErr("帖子不存在", err)
}
//获取图片的尺寸大小
// 获取图片的尺寸大小
images := []domain.Image{}
for _, val := range req.Images {
fInfo, _ := oss.GetImageInfo(val)
... ...
... ... @@ -136,8 +136,7 @@ func (repository *ArticleAndTagRepository) DomainModelToModel(from *domain.Artic
// 以TagId作为分组,统计所有已有标签的文章和人员已读的文章
func (repository *ArticleAndTagRepository) CountArticleReadGroupByTag(ctx context.Context, conn transaction.Conn, userId int64, companyId int64) ([]*domain.CountArticleTagRead, error) {
sqlStr := `
-- 首页统计数据
sqlStr := `-- 首页统计数据
with
-- 按查看权限查询文章
-- 获取有标签的文章
... ...
... ... @@ -278,27 +278,11 @@ func NewArticleRepository(cache *cache.CachedRepository) domain.ArticleRepositor
return &ArticleRepository{CachedRepository: cache}
}
// -- 首页统计数据
// with
// -- 按查看权限查询文章
// -- 获取有标签的文章
// -- 过滤出可展示的文章id
// t_article_and_tag_2 as (
// select article_and_tag.article_id , article_and_tag.tag_id
// from article_and_tag
// join article on article_and_tag.article_id = article.id
// where article.deleted_at=0
// and article.company_id =1598224576532189184
// and article."show" =0
// and (article.target_user =0 or article.who_read @>'[1]')
// ),
// -- 查询人员已查看的文章
// t_user_read as(
// select user_read_article.article_id from user_read_article where user_read_article.user_id =1
// )
// -- 汇总统计 cnt_1符合条件的文章总数,cnt_2 已浏览的数量
// 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
// from t_article_and_tag_2
// left join t_user_read on t_article_and_tag_2.article_id=t_user_read.article_id
// group by t_article_and_tag_2.tag_id
// ;
// select *
// from article
// join article_and_tag on article.id = article_and_tag.article_id
// where article."show" =1
// and article_and_tag.tag_id =any(select article_tag.id from article_tag where category ='分组三' )
// and article_and_tag.tag_id =0
// and article.created_at >=0 and article.created_at <=9000000000
// and article.title like '%%'
... ...
... ... @@ -41,7 +41,7 @@ func GetImageInfo(url string) (info FileInfo, err error) {
return info, err
}
httpclient := http.Client{
Timeout: 30 * time.Second,
Timeout: 5 * time.Second,
}
resp, err := httpclient.Do(req)
if err != nil {
... ... @@ -70,7 +70,10 @@ func GetVideoCover(videoUrl string) (coverUrl string, w int, h int, err error) {
return
}
videoUrl = videoUrl + "?x-oss-process=video/snapshot,t_100,f_jpg,m_fast"
res, err := http.Get(videoUrl)
httpclient := http.Client{
Timeout: 5 * time.Second,
}
res, err := httpclient.Get(videoUrl)
if err != nil || res.StatusCode != http.StatusOK {
return videoUrl, 600, 600, fmt.Errorf("获取图片失败:%s", err)
}
... ...