34 lines
1.2 KiB
Plaintext
34 lines
1.2 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_zh = "'%s'" % ns.get('publish_time_zh') if ns.get('publish_time_zh') else "ifnull(publish_time_zh, current_date())"
|
|
publish_time_en = "'%s'" % ns.get('publish_time_en') if ns.get('publish_time_en') else "ifnull(publish_time_en, current_date())"
|
|
publish_sql = """
|
|
update enterprise_news_article
|
|
set status = '1',
|
|
publish_time_zh = %s,
|
|
publish_time_en = %s
|
|
where id = '%s' and del_flg = '0';
|
|
""" % (publish_time_zh, publish_time_en, 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
|