25 lines
955 B
TypeScript
25 lines
955 B
TypeScript
import {ApiCall} from "tsrpc";
|
|
import {ReqOpen, ResOpen} from "../../../shared/protocols/event/huobanzhaomu/PtlOpen";
|
|
import {PayFun} from "../../../public/pay";
|
|
import {payLog} from "../../../shared/protocols/pay/PtlGetList";
|
|
|
|
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
|
|
|
let db = await G.mongodb.cEvent('huobanzhaomu').findOne({uid: call.uid, type: 'huobanzhaomu'});
|
|
|
|
let logs: payLog[];
|
|
let finish: { [k: number]: boolean } = {};
|
|
for (let i = 0; i < G.gc.huobanzhaomu.length; i++) {
|
|
let conf = G.gc.huobanzhaomu[i];
|
|
if (conf.gudKey == "zhizunyueka") {
|
|
if (!logs) {
|
|
logs = await PayFun.getPayLog(call.uid, "zhizunyueka");
|
|
}
|
|
finish[i] = !(logs.length <= 0 || logs.slice(-1)[0].eTime < G.time);
|
|
} else {
|
|
finish[i] = call.conn.gud[conf.gudKey] >= conf.total;
|
|
}
|
|
}
|
|
|
|
call.succ({finish: finish, rec: db?.rec || []});
|
|
} |