def _escape(value): if value is None: return None return str(value).replace("'", "''") async def model_management_list(ns={}): """上架:listing_status 置为 1""" model_id = ns.get('id') if not model_id: return {'status': False, 'msg': 'id is required'} db = DBPools() async with db.sqlorContext('kboss') as sor: try: update_sql = """ UPDATE model_management SET listing_status = 1 WHERE id = '%s'; """ % _escape(model_id) await sor.sqlExe(update_sql, {}) return {'status': True, 'msg': 'model listed success'} except Exception as e: await sor.rollback() return {'status': False, 'msg': 'model list failed, %s' % str(e)} ret = await model_management_list(params_kw) return ret