import { get, post } from "@js/request";

let timer = 0;

export function startTime(scid){
    get('/kjy/mp/content/read', {
        scid: scid
    }).then(res => {
        if (res.success) {
            let visitId = res.data.visitId;
            timer = setInterval(() => {
                get('/kjy/mp/content/updateDuration', {visitId: visitId});
            }, 5000);
        }
    })
}

export function endTime(){
    clearInterval(timer);
}

export default {
    startTime,
    endTime
}