import APP from '@/services';
import { commonSearch_go } from "@/services/go";
import * as type from './interface';

/**
 * 查询掉期报价列表  /Tjmd/QueryQuoteGoodsList
 */
export function queryQuoteGoodsList(req: type.QueryQuoteGoodsListReq): Promise<type.QueryQuoteGoodsListRsp[]> {
    return commonSearch_go('/Tjmd/QueryQuoteGoodsList', req).catch((err) => {
        throw new Error(`查询掉期报价列表 : ${err}`);
    });
}

/**
 * 查询今日账户保证金配置  /Tjmd/QueryTjmdTodayAccountMargin
 */
export function queryTjmdTodayAccountMargin(req: type.QueryTjmdTodayAccountMarginReq): Promise<type.TjmdTodayAccountMarginReq[]> {
    return commonSearch_go('/Tjmd/QueryTjmdTodayAccountMargin', req).catch((err) => {
        throw new Error(`查询今日账户保证金配置 : ${err}`);
    });
}

/**
 * 查询掉期买卖大厅  /Tjmd/QueryTjmdTradeOrderDetail
 */
export function queryTjmdTradeOrderDetail(req: type.QueryTjmdTradeOrderDetailReq): Promise<type.QueryTjmdTradeOrderDetailRsp[]> {
    return commonSearch_go('/Tjmd/QueryTjmdTradeOrderDetail', req).catch((err) => {
        throw new Error(`查询掉期买卖大厅 : ${err}`);
    });
}

/**
 * 查询掉期协议单  /Tjmd/QueryTjmdTransferApply
 */
export function queryTjmdTransferApply(req: type.QueryTjmdTransferApplyReq): Promise<type.QueryTjmdTransferApplyRsp[]> {
    return commonSearch_go('/Tjmd/QueryTjmdTransferApply', req).catch((err) => {
        throw new Error(`查询掉期协议单 : ${err}`);
    });
}


/**
 * 查询市场板块  /Tjmd/QueryTjmdMarketSection
 */
export function queryTjmdMarketSection(): Promise<type.TjmdMarketSection[]> {
    return commonSearch_go('/Tjmd/QueryTjmdMarketSection', {}).then(res => {
        console.log('查询市场板块:  ', res)
        APP.set('marketsSection', res);
        return res
    }).catch((err) => {
        throw new Error(`查询市场板块 : ${err}`);
    });
}



