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('done'); } set mark(value) { this.set('mark', value); } add_mark(value) { this.increment(value); } enter(){ console.log("presence.enter"); console.log(this); this.set("present", true).save().catch(error=>console.error(error.message)); } leave(){ this.set("present", false).save() } } AV.Object.register(Presence, "Presence"); module.exports = Presence;