天天看点

laya 阿拉丁自定义统计

主要实现跑酷游戏中分段达到用户数,之前想的是直接通过调用接口是否能实现,但接口能提供的方法有限,最后只能以段位修为参数名,用户openid作为值,然后可以通过参数名导出很多张表,最后通过VB代码,对导出的多张表再进行一次算理,就能统计出想要的数据。

        //取得跑到哪一段

        private GetSection(dis){

            var section = 0;

            var t =Math.floor(dis/100);

            section = (t + 1)*100;

            return section;

        }

 函数内调用

if (dis > parseInt(max)) {

                    max = dis.toString();

                    Laya.LocalStorage.setItem("maxdistance", max);

                    var section = this.GetSection(dis).toString();

                    console.log("openid =" + this.wx.openid);

                    console.log("section =" + section);

                    this.wx.aldSendEvent('历史最佳', { section : max });

                }