import { getXZX, post } from "@/common/httpRequest.js"; //用于计算积分时的调用定时时间规则 const getCountIntegralRangeTimeNum = () => { let countIntegralRangeInterval = 600000; getXZX("/app/artificer/integral/time").then( res => { if (res && res.data) { let formatData = Number(res.data) * 60 * 1000; countIntegralRangeInterval = formatData; } else { countIntegralRangeInterval = 600000; } setInterval(() => { let userIdInfo = uni.getStorageSync("userId"); let artificerId = JSON.parse(uni.getStorageSync("artificerId")); let onlineStatus = uni.getStorageSync("onlineStatus"); console.log(userIdInfo, onlineStatus, artificerId, "00oodd"); if (userIdInfo && artificerId && onlineStatus && onlineStatus == 1) { //技师登录&&拥有技师ID&&在线时才调用 sendIntegral(artificerId); } }, countIntegralRangeInterval) }); } //后台根据在线时长计算积分的接口 const sendIntegral = (artificerId) => { return new Promise((resolve) => { post("/app/artificer/timing/?artificerId=" + artificerId, ).then( res => {}); }) } //调用用于计算积分时的调用定时时间规则 let token = uni.getStorageSync("token"); let userId = uni.getStorageSync("userId"); if (token && userId) { getCountIntegralRangeTimeNum(); }