kboss/b/news/news_article_publish.dspy
2026-07-14 15:22:23 +08:00

30 lines
1.0 KiB
Plaintext

async def news_article_publish(ns={}):
if not ns.get('id'):
return {
'status': False,
'msg': '请传递id'
}
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
publish_time = ns.get('publish_time')
if publish_time:
publish_sql = """update enterprise_news_article set status = '1', publish_time = '%s' where id = '%s' and del_flg = '0';""" % (publish_time, ns.get('id'))
else:
publish_sql = """update enterprise_news_article set status = '1' where id = '%s' and del_flg = '0';""" % ns.get('id')
await sor.sqlExe(publish_sql, {})
return {
'status': True,
'msg': 'publish news article success'
}
except Exception as e:
await sor.rollback()
return {
'status': False,
'msg': 'publish news article failed, %s' % str(e)
}
ret = await news_article_publish(params_kw)
return ret