32 lines
1.1 KiB
Plaintext
32 lines
1.1 KiB
Plaintext
async def news_article_detail(ns={}):
|
|
if not ns.get('id'):
|
|
return {
|
|
'status': False,
|
|
'msg': '请传递id'
|
|
}
|
|
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
search_sql = """select * from enterprise_news_article where id = '%s' and del_flg = '0';""" % ns.get('id')
|
|
result = await sor.sqlExe(search_sql, {})
|
|
if not result:
|
|
return {
|
|
'status': False,
|
|
'msg': '文章不存在'
|
|
}
|
|
result[0]['status_name'] = {'0': '草稿', '1': '已发布'}.get(str(result[0].get('status')), result[0].get('status'))
|
|
return {
|
|
'status': True,
|
|
'msg': 'search news article detail success',
|
|
'data': result[0]
|
|
}
|
|
except Exception as e:
|
|
return {
|
|
'status': False,
|
|
'msg': 'search news article detail failed, %s' % str(e)
|
|
}
|
|
|
|
ret = await news_article_detail(params_kw)
|
|
return ret
|