import { ApiCall } from "tsrpc";
import { ReqAutoApply, ResAutoApply } from "../../shared/protocols/kbzz/PtlAutoApply";

export default async function (call: ApiCall<ReqAutoApply, ResAutoApply>) {

    if (call.conn.gud.vip < G.gc.kbzz.autoApplyNeedVip) return call.error('', { code: -1 });

    G.mongodb.cPlayerInfo('kbzzApply').updateOne({ uid: call.uid, type: 'kbzzApply' }, { $set: { autoApply: call.req.auto } }, { upsert: true });

    call.succ({});
}