import { ApiCall } from "tsrpc";
import { FriendManage } from '../../public/friend/manage';
import { ReqOpen, ResOpen } from "../../shared/protocols/friend/PtlOpen";
import { PublicShared } from '../../shared/public/public';

export default async function (call: ApiCall<ReqOpen, ResOpen>) {
    const my = await FriendManage.getFriend(call.uid);

    if (PublicShared.getToDayZeroTime() > my.data.refreshTime) {
        my.refreshTime();
    }

    call.succ(my.data);
}