main #155

Merged
charles merged 5 commits from main into prod 2026-08-06 11:33:24 +08:00
5 changed files with 34 additions and 14 deletions

View File

@ -449,7 +449,7 @@ async def get_baidu_orderlist(ns={}):
# 获取余额
user_balance = await getCustomerBalance(sor, orgid[0]['id'])
# 判断余额是否大于50
if user_balance < 5000000:
if user_balance < 500:
await sor.rollback()
paydata = {'queryAccountId': baidu_users[0]['baidu_id'], 'orderIds': [ns.get('order_id')]}
ns_format = '&'.join(['%s=%s' % (k, v) for k, v in ns.items()])

View File

@ -34,10 +34,7 @@ async def front_news_search(ns={}):
publish_time_zh, publish_time_en, read_count
from enterprise_news_article
where %s
order by greatest(
ifnull(publish_time_zh, '1000-01-01'),
ifnull(publish_time_en, '1000-01-01')
) desc, update_time desc
order by publish_time_zh desc, update_time desc
limit %s offset %s;
""" % (where_clause, page_size, offset)
result = await sor.sqlExe(search_sql, {})

View File

@ -88,7 +88,7 @@ async def news_article_search(ns={}):
'status': True,
'msg': 'search news article success',
'data': result,
'article_type_summary_zh': article_type_summary_zh,
'article_type_summary': article_type_summary_zh,
'article_type_summary_en': article_type_summary_en,
'pagination': {
'total': total_count,

View File

@ -15,7 +15,7 @@
</article>
</section>
</main>
</template>
</template>
<script>
import docs from './agreementDocs'

View File

@ -190,7 +190,9 @@ export default {
status: '',
keyword: ''
},
articleList: []
articleList: [],
articleTypeSummary: [],
articleTypeSummaryEn: []
}
},
computed: {
@ -215,12 +217,18 @@ export default {
行业洞察: { label: '行业洞察', type: '行业洞察', icon: 'el-icon-data-analysis', iconClass: 'amber' },
活动资讯: { label: '活动资讯', type: '活动资讯', icon: 'el-icon-date', iconClass: 'purple' }
}
const summaryMap = {}
this.articleTypeSummary.forEach(item => {
if (item && item.article_type) {
summaryMap[item.article_type] = item
}
})
return Object.values(map).map(item => {
const list = this.articleList.filter(article => article.type === item.type)
const summary = summaryMap[item.type] || {}
return {
...item,
count: list.length,
views: list.reduce((total, article) => total + Number(article.views || 0), 0)
count: Number(summary.article_count || 0),
views: Number(summary.read_count || 0)
}
})
}
@ -312,6 +320,18 @@ export default {
}
}
},
getArticleTypeSummary(res) {
if (Array.isArray(res.article_type_summary)) return res.article_type_summary
const data = res.data && !Array.isArray(res.data) ? res.data : {}
if (Array.isArray(data.article_type_summary)) return data.article_type_summary
return []
},
getArticleTypeSummaryEn(res) {
if (Array.isArray(res.article_type_summary_en)) return res.article_type_summary_en
const data = res.data && !Array.isArray(res.data) ? res.data : {}
if (Array.isArray(data.article_type_summary_en)) return data.article_type_summary_en
return []
},
getResponseList(res) {
//
if (Array.isArray(res.data)) return res.data
@ -384,16 +404,19 @@ export default {
const list = this.getResponseList(res)
//
this.articleList = list.map(item => this.normalizeArticle(item))
//
this.articleTypeSummary = this.getArticleTypeSummary(res)
this.articleTypeSummaryEn = this.getArticleTypeSummaryEn(res)
this.total = this.getResponseTotal(res, list)
return
}
//
this.articleList = []
this.articleTypeSummary = []
this.articleTypeSummaryEn = []
this.total = 0
} catch (error) {
//
this.articleList = []
this.articleTypeSummary = []
this.articleTypeSummaryEn = []
this.total = 0
this.$message.error('文章列表加载失败')
} finally {