async def uppromote_discount(ns): """修改促销产品折扣""" db = DBPools() async with db.sqlorContext('kboss') as sor: try: promote_discount = await sor.R('promote_discount',{'id':ns.get('id')}) providerid = (await sor.R('product', {'id': promote_discount[0]['productid']}))[0]['providerid'] protocolid = (await sor.R('saleprotocol', {'offer_orgid': providerid}))[0]['id'] product_discount = (await sor.R('product_salemode', {'protocolid': protocolid, 'productid': promote_discount[0]['productid']}))[0]['discount'] if float(ns['discount']) <= float(product_discount): return {'status': False, 'msg': '折扣率不能小于供应商折扣'} await sor.U('promote_discount', ns) return {'status': True, 'msg': '修改成功'} except: return {'status': False, 'msg': '修改失败'} ret = await uppromote_discount(params_kw) return ret