// Learn cc.Class: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html // Learn Attribute: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html //var httpclient = require("httpclient"); //var urlbuilder = require("urlbuilder"); var httpclient = require('httpclient'); var urlbuilder = require('urlbuilder'); const BaseNet = require('../../BaseNet'); module.exports = { // LIFE-CYCLE CALLBACKS: // onLoad () {}, // start () {}, // update (dt) {}, _heart() { this.urlbd.clear(); this.urlbd .addKV('c', 'Stat') .addKV('a', 'updateSession') .addKV('session_id', this.sessionid) .addKV('account_id', this.accountid); httpclient.httpGet( this.urlbd.baseurl, (res) => { if (!this.isoffical) { console.log('[stat.heart]' + res); } }, (err, errmsg) => { if (!this.isoffical) { console.log('[stat.heart]Err:' + err + '|' + errmsg); } } ); }, init(channelid, gameid, isoffical, owner) { this.owner = owner; this.gameid = gameid; this.channelid = channelid; this.isoffical = isoffical; this.urlbd = new urlbuilder(BaseNet.getNormalApiUrl('stat')); console.log( '[jcstat]init:' + gameid + '|' + channelid + '|' + isoffical ); }, setAccountID(accountid, sessionid) { this.accountid = accountid; this.sessionid = sessionid; this._heart(); setInterval(() => { this._heart(); }, 60000); }, setNickName(nickname) { this.nickname = nickname; }, setFromAppID(appid) { this.fromid = appid; }, setLocalUUID(uuid) { this.localid = uuid; }, setSystemInfo(info) {}, };