import TableHelper from './lib/TableHelper' class Session extends TableHelper { constructor () { super('session') } async getSortList () { let objTable = await this.getObjTable() let cursor = await objTable.index('pin_time_int').openCursor(null, 'prev') let list = [] // let list2 = [] while (cursor && cursor.value) { let value = cursor.value list.push(value) cursor = await cursor.continue() } return list } async setUnread (sessionId, unreadNum) { this.updateObject({ unread: unreadNum }, { session_id: sessionId }) } async setPin (sessionId, isPin) { let pinTime = isPin ? (new Date()).getTime() : 0 this.updateObject({ is_pin: isPin, pin_time_int: pinTime }, { session_id: sessionId }) } async setMute (sessionId, isMute) { this.updateObject({ is_mute: isMute }, { session_id: sessionId }) } } export default Session