import { ApiCall } from 'tsrpc';
import { PayFun } from './pay';


export class TeQuanFun {
    static async getIsAcTive(call: ApiCall, payId: string) {
        let log = await PayFun.getPayLog(call.uid, payId);
        if (log.length < 1) return false;
        let last = log.slice(-1)[0];

        if (G.gc.pay[payId].time == -1) return last != undefined;
        else return G.time < last.time + G.gc.pay[payId].time;
    };
    static async getXsTaskNum(call: ApiCall) {
        return await this.getIsAcTive(call, 'qingbaotequan') ? 1 : 0;
    }
    static async getTxFreeNum(call: ApiCall) {
        return await this.getIsAcTive(call, 'zuozhantequan') ? 5 : 0;
    }
}