async def discount_guanli_shan(ns={}): """ 折扣管理删除 :param ns: :return: """ db = DBPools() async with db.sqlorContext('kboss') as sor: try: await sor.U('product_salemode', {'id': ns.get('zi_biao_id'), 'del_flg': '1'}) if ns.get('productid'): await sor.U('product', {'id': ns.get('productid'), 'del_flg': '1'}) # 如果产品已经被分配了 应该删除协议子表所有相关产品 relate_product_sql = """UPDATE product_salemode SET del_flg = '1' WHERE productid = '%s';""" % ns.get('productid') await sor.sqlExe(relate_product_sql, {}) promote_sql = """UPDATE promote_discount SET del_flg = '1' WHERE productid = '%s';""" % ns.get('productid') await sor.sqlExe(promote_sql, {}) return { 'status': True, 'msg': '删除成功' } except Exception as e: raise e return { 'status': False, 'msg': '删除失败' } ret = await discount_guanli_shan(params_kw) return ret