const AV = require('../lib/av-live-query-weapp-min'); class Presence extends AV.Object{ set user(value){ this.set("user", value); } get user(){ return this.get("user"); } set class(value){ this.set("class", value); } get class(){ return this.get("class"); } set isasking(value){ this.set("isasking", value); } get isasking(){ return this.get("isasking"); } get present(){ return this.get("present"); } set present(value){ this.set("present", value); } get mark() { return this.get('mark'); } set mark(value) { this.set('mark', value); } add_mark(value) { this.increment(value); } get edu_account_login() { return this.get("edu_account_login"); } set edu_account_login(value) { this.set("edu_account_login", value); } enter(){ console.log("presence.enter"); console.log(this); this.set("present", true).set("isasking", 0).save().catch(error=>console.error(error.message)); } leave(){ this.set("present", false).set("isasking", 0).save(); } } AV.Object.register(Presence, "Presence"); module.exports = Presence;