import { ApiCall } from "tsrpc";
import { WangZheRongYaofun } from "../../public/wzry";
import { ReqJingCaiOpen, ResJingCaiOpen } from "../../shared/protocols/wzry/PtlJingCaiOpen";

export default async function (call: ApiCall<ReqJingCaiOpen, ResJingCaiOpen>) {
    let status = await WangZheRongYaofun.getWangZheStatus();
    // if (status.status != 6) {
    //     // 未到时间
    //     return call.error('', { code: -2, message: globalThis.lng.wzry_11 })
    // }
    let _jcList = await WangZheRongYaofun.getFightGroup(call, { deep: { $gte: 6 } });
    if (!_jcList) {
        // 未到时间
        return call.error('', { code: -3/* , message: globalThis.lng.wzry_11 */ });
    }
    let _jcAllNum = await (await G.clientCross.callApi('wzry/getJingCai', {})).res.num;

    call.succ({
        jclist: _jcList,
        jcallnum: _jcAllNum
    });
}