订单相关修改提测

This commit is contained in:
GaoHao
2024-09-09 11:08:04 +08:00
parent c2ff506543
commit 2dbcdf4300
45 changed files with 1377 additions and 3506 deletions

View File

@@ -11,14 +11,14 @@ function get(key) {
if (!res) {
return ''
}
// res = JSON.parse(res)
if (res.__expiretime && res.__expiretime < uni.utils.timestamp()) {
if (res.expire > 0 && res.expire < uni.utils.timestamp()) {
console.log(res)
remove(key)
return ''
} else {
return res
return res.data
}
} catch (e) {
return ''
@@ -56,15 +56,13 @@ function getStorageData(key) {
* @param {Number} expire 指定秒数后过期
* @return void
*/
function set(key, value, expire = uni.conf.default_expire) {
let cacheItem = {}
cacheItem = value
// console.log(cacheItem)
if (expire > 0) {
cacheItem.__expiretime = uni.utils.timestamp() + expire
function set(key, value, expire = 0) {
let obj = {
data: value, //存储的数据
time: Date.now() / 1000, //记录存储的时间戳
expire: expire //记录过期时间,单位秒
}
// uni.setStorageSync(key,JSON.stringify(cacheItem))
uni.setStorageSync(key,cacheItem)
uni.setStorageSync(key, obj)
}
/**