当前位置:网站首页>Sign in function of Taobao applet
Sign in function of Taobao applet
2022-06-10 02:12:00 【weixin_ forty-four million three hundred and eighty-seven thous】
my.getStorage({
key: gdc.userId + gameName,
success: function (res) {
// console.log(!res.data)
// Determine whether it is the first time to load the game
if (!res.data) {
my.setStorage({
key: gdc.userId + gameName,
data: {
timer: timer,
list: self.data.list,
current: 0,
golds: 0,
flag: false
},
success: function () {
}
});
} else if (res.data != '') {
// Check in on the eighth day after seven consecutive days , Judge whether to sign in the next day
if (res.data.timer - newDateTime < -86400000 || res.data.current == 6) {
my.getStorage({
key: gdc.userId + gameName,
success: function (res) {
let list = [true, true, true, true, true, true, true]
my.setStorage({
key: gdc.userId + gameName,
data: {
list: list,
current: 0,
golds: res.data.golds,
timer: timer,
flag: false
},
success: function () {
self.setData({
list: list,
current: 0,
golds: res.data.golds,
flag: false
})
}
});
},
fail: function (res) {
my.alert({ content: res.errorMessage });
}
});
} else {
self.setData({
list: res.data.list,
current: res.data.current,
golds: res.data.golds,
flag: false
})
}
}
},
fail: function (res) {
my.alert({ content: res.errorMessage });
}
});
Sign in
report(e) {
let self = this
const { gdc = {}, mds = {}, modUtils } = this.props.data;
//3.26 23.59.59 Time stamp 1616774399999 1616860799999, 1616947199999
let timer = new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1 // Get the day 23:59:59 Time stamp
// Get the current timestamp
var newDateTime = Date.parse(new Date())
my.getStorage({
key: gdc.userId + gameName,
success: function (res) {
if (res.data.timer - newDateTime > 0) {
// console.log(" On the same day ")
let list1 = self.data.list[self.data.current] = false
let list = self.data.list
if (res.data.flag == false) {
let golds = res.data.golds + self.data.goldsList[self.data.current]
my.setStorage({
key: gdc.userId + gameName,
data: {
list: list,
timer: res.data.timer,
current: self.data.current,
golds: golds,
flag: true
},
success: function () {
self.setData({
list: list,
golds: golds,
flag: true
})
}
});
} else {
let golds = res.data.golds
my.setStorage({
key: gdc.userId + gameName,
data: {
list: list,
timer: res.data.timer,
current: self.data.current,
golds: golds,
flag: true
},
success: function () {
self.setData({
list: list,
golds: golds,
flag: true
})
}
});
}
} else if (res.data.timer - newDateTime < 0 && res.data.timer - newDateTime > -86400000) {
console.log("diertian")
// No sign in on the first day , Sign in the next day
if (self.data.current > 0) {
if (self.data.current > 6) {
self.setData({
current: 0
})
} else {
self.setData({
current: ++self.data.current
})
}
} else if (self.data.current == 0) {
self.setData({
current: 0
})
}
let list1 = self.data.list[self.data.current] = false
let list = self.data.list
let golds = res.data.golds + self.data.goldsList[self.data.current]
my.setStorage({
key: gdc.userId + gameName,
data: {
list: list,
timer: timer,
current: self.data.current,
golds: golds
},
success: function () {
self.setData({
list: list,
golds: golds
})
}
});
}
},
fail: function (res) {
}
});
},
边栏推荐
- [group planning final review iv] input / output system
- How to replace or disable the default blue favicon ICO Icon
- Deepin compiles VirtualBox records and resolves compilation errors
- Smart Cloud Light Gateway Service pour améliorer l'efficacité de la gestion de la production
- Leetcode 98: validate binary search tree
- Full score after 5 years of "research" and 3 years of "actual combat"
- 餐饮电子采购方案:采购全周期管理,节省30%成本
- Free batch import software for generating sitemap maps
- Brief introduction to Allan variance definition and calculation method
- 1、pytorch入门
猜你喜欢

CSP 202112-1 序列查询(详解)

10个常见触发IO瓶颈的高频业务场景

51 single chip microcomputer learning record (VI) IIC, ADC part

Environment configuration and initial compilation of source code analysis of virtual engine ue4.26

多任务学习

(w10)Prtsc截图键无法正常使用——解决办法

3. NLP model

步进电机总结

Phantom engine plug-in - Maya LIVELINK - install and use

Smart Cloud Light Gateway Service pour améliorer l'efficacité de la gestion de la production
随机推荐
Is it appropriate for novice investors to buy financial products with a rate of return?
Chicken and rabbit in the same cage
服务器停止响应是什么意思,该如何排查?
Boundary problems of regular expressions.
[email protected] Project training
MySQL installation + test connection + common terminal MySQL commands (super detailed)
Dry goods | touch screen operation automation of mobile app automation
Stepper motor summary
Detailed billing information tables of cptevents and drgcodes (XIII)
10个常见触发IO瓶颈的高频业务场景
機智雲輕網關服務,提昇生產管理效率
Data product learning - real time computing platform
[experience sharing] summary of database operations commonly used in Django development
Apache POI learning notes - Excel
Phantom engine plug-in - Maya LIVELINK - install and use
程序员日常开发的八荣八耻
latex怎么也不换行,奇怪
Webmaster Tools browser SEO plug-in - Webmaster Essential Tools SEO website ranking quick view website data
“无法访问 您可能没有权限使用网络资源”解决办法
Metauniverse can open a new thinking window for the Internet which is falling into a bottleneck period