裂变星小程序-25.03.04
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

41 lines
647 B

import fetch from '@/api/fetch.js'
const get = () => {
try {
return JSON.parse(uni.getStorageSync('shareLog')) || {}
} catch (err) {
return {}
}
}
const insert = (id) => {
const log = get()
let bef = log[id] || 0
log[id] = bef + 1
uni.setStorageSync('shareLog', JSON.stringify(log))
}
const check = async (id, need_num) => {
try {
const log = get()
const num = log[id] || 0
const open = num >= need_num
return { open, need_num, num, title: `已转发${num}` }
} catch (err) {
console.error('--校验达标异常', err)
return {}
}
}
export default {
get,
insert,
check,
}