import * as AV from 'leancloud-storage' ; import AVProperty from './AVProperty' ; import QqGroup from './QqGroup' ; import L8Meetup from './L8Meetup' ; export default class AgentQq extends AV . Object { @ AVProperty ( ) Qq : string ; @ AVProperty ( ) AgentId : string ; @ AVProperty ( ) LastAp : number ; @ AVProperty ( ) LastMu : number ; public static async checkUserByQq ( qq ) { const q = new AV . Query ( AgentQq ) ; q . equalTo ( 'Qq' , qq . toString ( ) ) ; return await q . first ( ) as AgentQq ; } public static async checkUserByAgentId ( agentId ) { const q = new AV . Query ( AgentQq ) ; q . equalTo ( 'AgentId' , agentId ) ; return await q . first ( ) as AgentQq ; } public async unbind ( ) { await QqGroup . destroyQq ( this ) ; await L8Meetup . destoryQq ( this ) ; return await this . destroy ( ) ; } public static async bindUserByQq ( qq , agentId ) { const obj = new AgentQq ( ) ; obj . Qq = qq . toString ( ) ; obj . AgentId = agentId ; return await obj . save ( ) as AgentQq ; } public static async fetchAllAgentQqs ( ) { const q = new AV . Query ( AgentQq ) ; return await q . find ( ) as Array < AgentQq > ; } } AV . Object . register ( AgentQq ) ;