async def huiyong_zibiao_cha(ns={}): db = DBPools() async with db.sqlorContext('kboss') as sor: try: res_dict = {} res_sql = """select cy.*, te.id as rp_rebate_id, te.sale_amount, te.rebate_rate, te.del_flg as rp_rebate_del_flg from rebate_cycle as cy INNER JOIN rp_rebate as te on cy.id = te.rebatecycleid where cy.protocolid = '%s' and cy.del_flg = '0' and te.del_flg = '0';""" % ns.get('protocolid') res_sql_li = await sor.sqlExe(res_sql, {}) for res in res_sql_li: cycle = res['rebate_cycle'] if res_dict.get(cycle): res_dict[cycle].append(res) else: res_dict[cycle] = [res] return { 'status': True, 'msg': '回佣查找成功', 'data': res_dict } except Exception as e: raise e return { 'status': False, 'msg': '回佣查询失败' } ret = await huiyong_zibiao_cha(params_kw) return ret