import { ApiCall } from "tsrpc";
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/shouchong/PtlOpen";
import {PayFun} from "../../../public/pay";

export default async function (call: ApiCall<ReqOpen, ResOpen>) {
    let data = await G.mongodb.cEvent('shouchongzhigou').findOne({uid: call.uid, type: 'shouchongzhigou'})

    let payIds = R.compose(R.map(i=>i.payid),R.values())(G.gc.shouchong)

    call.succ({
        receive: data?.receive || {},
        buyLog: await PayFun.getPayLogs(call.uid, payIds)
    })
}