async def getcp_discountrecord(ns): """ 查看历史客户折扣 """ db = DBPools() async with db.sqlorContext('kboss') as sor: if ns: ns['del_flg'] = '0' ns['sort'] = 'start_date desc' cp_discount = await sor.R('discount', ns) ns.pop('id') ns['customerid'] = cp_discount[0]['customerid'] ns['productid'] = cp_discount[0]['productid'] cp_discount = await sor.R('discount', ns) return {'status': True, 'data': cp_discount} return {'status': False, 'msg': '获取失败'} ret = await getcp_discountrecord(params_kw) return ret