xuguohong

提交js对接资料

1 +<!DOCTYPE html>
2 +<html>
3 +
4 +<head>
5 + <meta charset="utf-8">
6 + <title>H5SDK测试</title>
7 + <script type="text/javascript" src="game_Simulate.js"></script>
8 + <script type="text/javascript" src="https://static.public.sdk.guangkatf.com/h5_sdk/guangkaH5SDK.js?" + new Date().getTime().toString()></script>
9 +
10 + <script type="text/javascript">
11 + </script>
12 +</head>
13 +
14 +<body>
15 +<center>
16 + <h1>H5SDK测试页面</h1>
17 +</center>
18 +<hr>
19 +<center>
20 + <table>
21 + <tr>
22 + <td>
23 + <pre><button type="button" onclick="game.init()"> 初 始 化 </button></pre>
24 + </td>
25 + <td>
26 + <pre><button type="button" onclick="game.submitInfo()">提交角色信息</button></pre>
27 + </td>
28 + </tr>
29 + <tr>
30 + <td>
31 + <pre><button type="button" onclick="game.login()"> 登 录 </button></pre>
32 + </td>
33 + <td>
34 + <pre><button type="button" onclick="game.logout()"> 注 销 </button></pre>
35 + </td>
36 + </tr>
37 + <tr>
38 + <td>
39 + <pre><button type="button" onclick="game.pay()"> 支 付 </button></pre>
40 + </td>
41 + <td>
42 + <pre><button type="button" onclick="game.switchAccount()"> 切换账号 </button></pre>
43 + </td>
44 + </tr>
45 + <tr>
46 + <td>
47 + <pre><button type="button" onclick="game.statistics()"> 统 计 </button></pre>
48 + </td>
49 + <td>
50 + <pre><button type="button" onclick="game.showExitDialog()"> 退出游戏 </button></pre>
51 + </td>
52 + </tr>
53 + <tr>
54 + <td>
55 + <pre><button type="button" onclick="game.expansionInterface()"> 扩展接口 </button></pre>
56 + </td>
57 + </tr>
58 + </table>
59 +</center>
60 +<hr>
61 +
62 +
63 +</body>
64 +
65 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +//另一种在代码中引入JS文件的方式
2 +// var newScript = document.createElement('script');
3 +// newScript.setAttribute('type', 'text/javascript');
4 +// newScript.setAttribute('src', 'Test2.js');
5 +// document.getElementsByTagName('head')[0].appendChild(newScript);
6 +
7 +document.write("<script type=\"text\/javascript\" src=\"youaiH5SDK.js\"><\/script>");
8 +
9 +var game = {
10 + /**
11 + * code: {
12 + INIT_SUCCESS: 1,
13 + INIT_FAIL: -1,
14 + LOGIN_SUCCESS: 10,
15 + LOGIN_FAIL: -10,
16 + LOGOUT_SUCCESS: 100,
17 + LOGOUT_FAIL: -100,
18 + SWITCH_SUCCESS: 1000,
19 + SWITCH_FAIL: -1000,
20 + PAY_SUCCESS: 2,//充值以服务端回调结果为准
21 + PAY_FAIL: -2,
22 + PAY_CANCEL:-3,//支付取消
23 + EXIT_SUCCESS = 4,//退出成功
24 + EXIT_CANCEL = -4//取消退出
25 + }
26 + * @param {*} code 为youaiH5SDK.code中对应值
27 + * @param {*} msg
28 + */
29 + callback: function (code, msg) {
30 + console.log(code, msg);
31 + switch (code) {
32 + case youaiH5SDK.code.INIT_SUCCESS:
33 + console.log("game init success")
34 + break;
35 + case youaiH5SDK.code.LOGIN_SUCCESS:
36 + console.log("game login success")
37 + console.log("openId:" + msg.openId + "custom:" + msg.custom + "serverSign:" + msg.serverSign + "timestamp:" + msg.timestamp);
38 + break;
39 + case youaiH5SDK.code.LOGOUT_SUCCESS:
40 + console.log("game logout success")
41 + break;
42 + case youaiH5SDK.code.SWITCH_SUCCESS:
43 + console.log("game switch account success")
44 + break;
45 + case youaiH5SDK.code.PAY_SUCCESS:
46 + console.log("game pay success")
47 + break;
48 + case youaiH5SDK.code.EXIT_SUCCESS:
49 + //游戏处理退出逻辑
50 + break;
51 + }
52 + },
53 +
54 + init: function () {
55 + var SDKInfo = {
56 + "gameSimpleName": "fytx_test",
57 + "sdkSimpleName": "huoshu_h5",
58 + "sdkClientVersion": "1.0",
59 + "sdkVersionCode": "V1_0",
60 + "statisticsUrl": "",
61 + "channelParameter1": "yy",
62 + "channelParameter2": "yy2"
63 + };
64 + var param = window.location.search.substring(1);
65 + console.log(param);
66 + var params = param.split("&");
67 + console.log(params);
68 + for (var i = 0; i < params.length; i++) {
69 + console.log(params[i]);
70 + var values = params[i].split("=");
71 + console.log(values);
72 + switch (values[0]) {
73 + case "ya_game":
74 + SDKInfo.gameSimpleName = values[1];
75 + break;
76 + case "ya_sn":
77 + SDKInfo.sdkSimpleName = values[1];
78 + break;
79 + case "ya_ssv":
80 + SDKInfo.sdkVersionCode = values[1];
81 + break;
82 + case "ya_sv":
83 + SDKInfo.sdkClientVersion = values[1];
84 + break;
85 + default:
86 + break;
87 + }
88 + }
89 + youaiH5SDK.init(SDKInfo, this.callback);
90 + },
91 +
92 + login: function () {
93 + var param = "test";
94 + youaiH5SDK.login(param);
95 + },
96 +
97 + logout: function () {
98 + if (youaiH5SDK.hasLogout()) {
99 + youaiH5SDK.logout();
100 + }
101 + },
102 +
103 + switchAccount: function () {
104 + if (youaiH5SDK.hasSwitchAccount()) {
105 + console.log("end switch account");
106 + youaiH5SDK.switchAccount();
107 + }
108 + },
109 +
110 + submitInfo: function () {
111 + /**
112 + * 为youaiH5SDK.type中对应类型值
113 + type: {
114 + arriveEntrance: 1,//首屏日志
115 + arriveLoadingZero: 2,//刚开始加载资源类型
116 + arriveLoadingFinish: 3,//资源加载完成
117 + arriveCreateRolePage: 4,//到达创建角色页面
118 + arriveServerSelectPage: 5,//到达选服页面
119 + enterServer: 6,//选服完成,点击进入对应服时
120 + arriveFirstScene: 7,//到达游戏内第一场景时调用
121 + enterGame: 8,//进入游戏时调用
122 + createRole: 9,//创建角色时调用
123 + upRoleLevel: 10//角色升级日志
124 + }
125 + */
126 + var submitType = youaiH5SDK.type.enterGame;
127 + var roleInfo = {
128 + "roleID": "15",
129 + "roleName": "test",
130 + "roleLevel": "15",
131 + "roleSex": "test",
132 + "serverID": "15",
133 + "serverName": "test",
134 + "roleCTime": "15",
135 + "partyName": "test",
136 + "roleType": "test",
137 + "roleChangeTime": "test",
138 + "vipLevel": "15",
139 + "diamond": "15",
140 + "moneyType": "test",
141 + "custom": "test"
142 + };
143 + youaiH5SDK.submitData(submitType, roleInfo);
144 + },
145 +
146 + pay: function () {
147 + var payInfo = {
148 + "serverId": "15",
149 + "serverName": "test",
150 + "playerId": "15",
151 + "playerName": "test",
152 + "playerLevel": "15",
153 + "postAmount": "15",
154 + "openId":"123643",
155 + "productId": "15",
156 + "productName": "test",
157 + "productDesc": "test",
158 + "custom": "test",
159 + "exchange": "15",
160 + "otherInfo": "15",
161 + "timeStamp": "15"
162 + };
163 + youaiH5SDK.pay(payInfo);
164 + },
165 +
166 + showExitDialog: function () {
167 + if (youaiH5SDK.hasShowExitDialog()) {
168 + youaiH5SDK.showExitDialog();
169 + } else {
170 + //游戏自己处理退出逻辑
171 + youaiH5SDK.exitGame();
172 + }
173 + },
174 +
175 + statistics: function () {
176 + var data = [{ "headers": { "product": "roh5" }, "body": "2018-03-14 17:57:21|test|5|qd|dqd|xqd|22222|20qd|10|1050055" }];
177 + var statisticsListener = {
178 + onStatisticsSuccess: function () {
179 + alert("Statistic success!");
180 + },
181 + onStatisticsFail: function () {
182 + alert("Statistic fail!");
183 + }
184 + };
185 + youaiH5SDK.statistics(data, statisticsListener);
186 + },
187 +
188 + expansionInterface: function () {
189 + /**
190 + * 传公共sdk扩展类型
191 + * {
192 + gameSetting:100,//功能设置
193 + downloadMicroClent:101,//下载微端
194 + share:102,//分享
195 + focus:103,//关注
196 + save2Desktop:104,//保存到桌面
197 + realVerify:105,//实名认证
198 + back2Game:106,//返回游戏
199 + bindPhone:107,//绑定手机有奖接口
200 + }
201 + */
202 + var expansion_type = youaiH5SDK.expansion_type.gameSetting;//功能设置
203 + /**
204 + * {
205 + code:0,//0:成功 其他为失败
206 + message:"success",//返回描述
207 + data:{//除了gameSetting类型,其他功能暂时不返回data字段
208 + has_micro_client:0,//是否有微端 0:没有,1:有,2已经在微端中
209 + is_share:0,//是否有分享接口 0:没有,1:有
210 + is_focus:0,//是否有关注 0:没,1:有,2:已经关注
211 + is_apple_pay:0,//是否开启苹果支付 0:不开启 1:开启
212 + is_desktop:0,//是否有保存桌面 0:没有 1:有
213 + is_switch_account:0,//是否有切换账号 0:没有 1有
214 + is_realverify:0,//是否有实名认证 0:没有 1:有 2:已认证
215 + is_super_kefu:0,//是否有超级客服 0:没 1:有
216 + is_backtogame:0,//是否有返回按钮 0:没有,1:有
217 + is_lock:0,//是否竖屏 0:研发默认样式 1:强制竖屏
218 + is_focus_gift:0,//关注有礼 0:关闭 1:开启
219 + is_bindphone:0//绑定手机 0:关闭 1:开启 2:已绑定手机
220 + }
221 + }
222 + * @param {*} result
223 + */
224 + var expansionCallBack = function(result){
225 + }
226 + youaiH5SDK.expansionInterface(expansion_type,"",expansionCallBack);
227 + }
228 +};
...\ No newline at end of file ...\ No newline at end of file
1 +http://gitlab.9133.com:10080/sdk_9133/sdk_public_android/edit/master/doc/%E5%85%AC%E5%85%B1SDK%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%8E%A5%E5%85%A5%E6%96%87%E6%A1%A3.md
...\ No newline at end of file ...\ No newline at end of file
1 +# **公共SDK-H5 JS接入文档** #
2 +
3 +>版本:**1.1**
4 +>
5 +>最后修改:**2019年9月17日**
6 +
7 +## **一、接入准备** ##
8 +
9 +游戏页面引入公共SDK-H5相关JS文件(防止缓存游戏可加个版本或时间戳控制)
10 +
11 +- 接公共平台的引入下面js
12 +- https://static.public.sdk.gzyouai.com/h5_sdk/youaiH5SDK.js
13 +- 接入光卡的引入下面js
14 +- https://static.public.sdk.guangkatf.com/h5_sdk/guangkaH5SDK.js
15 +
16 +```
17 +注意:壳包的话需要在给定的链接上添加一个uuid参数用来传机身码(ios:传IDFA,Android:imei)
18 +例子:http://game.html?uuid=idfa
19 +```
20 +## **二、JS接口(对接可参考Demo中的game_Simulate.js中的例子)** ##
21 +
22 +1. **初始化SDK(必接)**
23 +
24 + ![Alt text](1.png)
25 +
26 + //CP在公共平台填写SDK信息后,我方会生成带有参数的游戏链接(如上图所示),例如:http://gameURL?ya_game=游戏项目代号&ya_sn=SDK代号&ya_sv=SDK客户端版本号&ya_ssv=SDK服务端版本号
27 +
28 + //设置公共sdk回调方法
29 + /**
30 + code: {
31 + INIT_SUCCESS: 1,
32 + INIT_FAIL: -1,
33 + LOGIN_SUCCESS: 10,
34 + LOGIN_FAIL: -10,
35 + LOGOUT_SUCCESS: 100,
36 + LOGOUT_FAIL: -100,
37 + SWITCH_SUCCESS: 1000,
38 + SWITCH_FAIL: -1000,
39 + PAY_SUCCESS: 2,//充值以服务端回调结果为准
40 + PAY_FAIL: -2,
41 + PAY_CANCEL:-3,//支付取消
42 + EXIT_SUCCESS: 4,//退出成功
43 + EXIT_CANCEL: -4//取消退出
44 + }
45 + @param {*} code 为youaiH5SDK.code中对应值
46 + @param {*} msg
47 + */
48 + callback: function (code, msg) {
49 + console.log(code, msg);
50 + switch (code) {
51 + case youaiH5SDK.code.INIT_SUCCESS://初始化成功 msg为描述
52 + console.log("game init success")
53 + break;
54 + case youaiH5SDK.code.LOGIN_SUCCESS://登录成功
55 + /**
56 + *custom: "test"//透传参数
57 + *openId: "x1111dc104b800724d112195b61e1ff5"
58 + *serverSign: "ccb0488a46be85b9fc1b5bd55b532376"//签名校验sign
59 + *timestamp: "1554174508038"
60 + **/
61 + console.log("game login success");
62 + console.log("openId:" + msg.openId + "custom:" + msg.custom + "serverSign:" + msg.serverSign + "timestamp:" + msg.timestamp);
63 + break;
64 + case youaiH5SDK.code.LOGOUT_SUCCESS:
65 + console.log("game logout success")
66 + //回到游戏登录入口,然后调用登录接口
67 + login();
68 + break;
69 + case youaiH5SDK.code.SWITCH_SUCCESS:
70 + console.log("game switch account success")
71 + //游戏处理切换账号成功逻辑
72 + break;
73 + case youaiH5SDK.code.PAY_SUCCESS:
74 + console.log("game pay success")
75 + break;
76 + case youaiH5SDK.code.EXIT_SUCCESS:
77 + //游戏处理退出逻辑
78 + break;
79 + }
80 + },
81 + youaiH5SDK.init(this.callback);
82 +
83 +2. **账号登录**
84 +
85 + var param = "test";//透传参数
86 + //启用账号登录接口
87 + youaiH5SDK.login(param);
88 +
89 +3. **注销账号/切换账号**
90 +
91 + //注销接口
92 + if(youaiH5SDK.hasLogout()){//判断是否存在注销接口
93 + youaiH5SDK.logout();
94 + }
95 + //切换账号接口
96 + if(youaiH5SDK.hasSwitchAccount()){//判断是否存在切换账号接口
97 + youaiH5SDK.switchAccount();
98 + }
99 +
100 + 例子:
101 + /**
102 + * youaiH5SDK.hasLogout()
103 + * youaiH5SDK.hasSwitchAccount()
104 + * 游戏可以根据上面两个接口判断是否提供切换账号接口
105 + */
106 + switchAccount: function () {
107 + if (youaiH5SDK.hasLogout()) {//存在注销接口,注销后会回调到初始化接口的注销类型的回调中
108 + youaiH5SDK.logout();
109 + }else if (youaiH5SDK.hasSwitchAccount()) {//存在切换账号接口,切换账号成功后会回调到初始化接口中的切换账号类型回调中
110 + console.log("end switch account");
111 + youaiH5SDK.switchAccount();
112 + }else{//不存在切换账号接口,游戏自己处理
113 +
114 + }
115 + }
116 +
117 +4. **提交数据信息**
118 +
119 + 在游戏中对应点根据不同的type进行调用
120 + /**
121 + * 为youaiH5SDK.type中对应类型值
122 + type: {
123 + arriveServerSelectPage: 1,//到达选服页面
124 + createRole: 2,//创建角色时调用
125 + enterGame: 3,//进入游戏时调用
126 + upRoleLevel: 4,//角色升级日志
127 + arriveEntrance: 5,//首屏日志
128 + enterServer: 6,//选服完成,点击进入对应服时
129 + arriveFirstScene: 7,//到达游戏内第一场景时调用
130 + arriveLoadingFinish: 8,//资源加载完成
131 + arriveLoadingZero: 9,//刚开始加载资源类型
132 + arriveCreateRolePage: 10//到达创建角色页面
133 + }
134 + */
135 + var submitType = youaiH5SDK.type.enterGame;//进入游戏
136 + //设置角色信息
137 + var roleInfo = {
138 + "roleId": "角色ID",
139 + "roleName": "角色名称",
140 + "roleLevel": "角色等级",
141 + "roleSex": "角色性别 1:男 0:女",
142 + "serverId": "服务器ID",
143 + "serverName": "服务器名称",
144 + "roleCTime": "角色创建时间",
145 + "partyName": "工会名字",
146 + "roleType": "角色类型",
147 + "roleChangeTime": "角色更新时间",
148 + "vipLevel": "VIP等级",
149 + "diamond": "角色金币数量",
150 + "moneyType": "商品单位",
151 + "custom": "扩展参数",
152 + "isNew":"新创建角色第一次登录进游戏为1,其他为0",
153 + "score":"战力",
154 + "roleLevelReborn":"转生等级,没有传0"
155 + };
156 + //以上信息中,游戏如没有传空值即可
157 + //启用提交信息接口
158 + youaiH5SDK.submitData(submitType, roleInfo);
159 +
160 +5. **支付**
161 +
162 + //设置订单参数
163 + var payInfo = {
164 + "serverId": "服务器ID",
165 + "serverName": "服务器名字",
166 + "playerId": "角色ID",
167 + "openId":"渠道用户ID",
168 + "playerName": "角色名字",
169 + "playerLevel": "角色等级",
170 + "postAmount": "金额",
171 + "productId": "商品ID",
172 + "productName": "商品名称",
173 + "productDesc": "商品描述",
174 + "custom": "自定义透传参数",
175 + "exchange": "游戏币与人民币(元)的兑换比例",
176 + "otherInfo": "额外信息",
177 + "timestamp": "时间戳"
178 + };
179 + //以上信息中,游戏如没有传空值即可
180 + //启用支付接口
181 + youaiH5SDK.pay(payInfo);
182 +
183 +6. **退出游戏**
184 +
185 + if(youaiH5SDK.hasShowExitDialog()){//渠道含有退出框,游戏在回调中处理退出逻辑
186 + youaiH5SDK.showExitDialog();
187 + }else{
188 + //游戏自己处理退出逻辑后调用exitGame()接口
189 + youaiH5SDK.exitGame();
190 + }
191 +
192 +7. **获取公共层参数接口**
193 +
194 + 说明:本接口通过键获取对应的参数值,需要在初始化成功后才能调用
195 + /**
196 + 获取公共层参数
197 + @param {string} key
198 + */
199 + getParamValueByKey:function (key)
200 +
201 + 例子:
202 + youaiH5SDK.getParamValueByKey("custom");//获取公共后台的自定义参数
203 + youaiH5SDK.getParamValueByKey("channelParameter1");//渠道标识1
204 + youaiH5SDK.getParamValueByKey("channelParameter2");//渠道标识2
205 + youaiH5SDK.getParamValueByKey("channelId");//渠道号
206 +
207 +8. **扩展接口(游戏可根据渠道要求看是否接入)**
208 +
209 + /**
210 + 扩展接口
211 + @param {*} type 扩展类型
212 + @param {*} data 传递数据(当type为queryProductsInfo时传递充值项ID数据(具体值与渠道沟通)(eg:["test1","test2"]),其他类型暂时不传)
213 + @param {*} callback 回调方法
214 + */
215 + expansionInterface: function (type, data, callback);
216 +
217 + 示例:
218 + /**
219 + * 传公共sdk扩展类型
220 + * {
221 + gameSetting:100,//功能设置
222 + downloadMicroClent:101,//下载微端
223 + share:102,//分享
224 + focus:103,//关注
225 + save2Desktop:104,//保存到桌面
226 + realVerify:105,//实名认证
227 + back2Game:106,//返回游戏
228 + bindPhone:107,//绑定手机有奖接口
229 + score:108,//评分
230 + kefu:109,//客服接口
231 + queryProductsInfo:110,//根据sku(商品ID)查询商品信息
232 + eventTrack:111//事件上报接口
233 + }
234 + */
235 + var expansion_type = youaiH5SDK.expansion_type.gameSetting;//功能设置
236 + /**
237 + * {
238 + code:0,//0:成功 其他为失败
239 + message:"success",//返回描述
240 + data:{//gameSetting时返回下面数据
241 + has_micro_client:0,//是否有微端 0:没有,1:有,2已经在微端中
242 + is_share:0,//是否有分享接口 0:没有,1:有
243 + is_focus:0,//是否有关注 0:没,1:有,2:已经关注
244 + is_apple_pay:0,//是否开启苹果支付 0:不开启 1:开启
245 + is_desktop:0,//是否有保存桌面 0:没有 1:有
246 + is_switch_account:0,//是否有切换账号 0:没有 1有
247 + is_realverify:0,//是否有实名认证 0:没有 1:有 2:已认证
248 + is_super_kefu:0,//是否有超级客服 0:没 1:有
249 + is_backtogame:0,//是否有返回按钮 0:没有,1:有
250 + is_lock:0,//是否竖屏 0:研发默认样式 1:强制竖屏
251 + is_focus_gift:0,//关注有礼 0:关闭 1:开启
252 + is_bindphone:0,//绑定手机 0:关闭 1:开启 2:已绑定手机
253 + is_kefu:0,//是否有客服 0:没有,1:有(调用对应的客服类型接口(kefu))
254 + is_score:0,//是否有评分接口 0:没有,1:有(调用对应的评分类型接口(score))
255 + is_query_products_info:0,//是否有查询商品信息接口 0:没有 1:有(调用对应的查询商品信息接口(queryProductsInfo))
256 + is_event_track:0// 0:没有 1:有 是否有事件上报接口
257 + }
258 + [//查询商品信息返回数据(queryProductsInfo)
259 + {
260 + "displayPrice": "₩1159.69",//商品显示的价格
261 + "price": "₩1,160",
262 + "priceAmountMicros": 1159687601,
263 + "priceCurrencyCode": "KRW",
264 + "sku": "android.test.purchased",
265 + "title": "名称示例"
266 + },
267 + {
268 + "displayPrice": "₩1159.69",
269 + "price": "₩1,160",
270 + "priceAmountMicros": 1159687601,
271 + "priceCurrencyCode": "KRW",
272 + "sku": "android.test.purchased",
273 + "title": "名称示例"
274 + }
275 + ]
276 + }
277 + * @param {*} result
278 + */
279 + var expansionCallBack = function(result){
280 + }
281 + youaiH5SDK.expansionInterface(expansion_type,"",expansionCallBack);
282 +
283 +
284 +9. **统计(大数据小组要求游戏接入)**
285 +
286 + 客户端日志接入说明
287 +
288 + 接入方式:HTTP
289 + 数据格式:JSON
290 +
291 + 格式说明:
292 + 一条完整的日志,json格式为:
293 + {
294 + “headers” : {"product" : "roh5"}, //头信息
295 + “body” : “2017-12-19 12:19:07|click|1|qd|dqd|xqd” //日志内容
296 + }
297 + 一次请求发送的格式必须是以上json的数组格式的字符串形式,如:
298 + [
299 + {
300 + “headers” : {"product" : "roh5"},
301 + “body” : “2017-12-19 12:19:07|click|1|qd|dqd|xqd”
302 + }, //发送的第一条日志
303 + {
304 + “headers” : {"product" : "roh5"},
305 + “body” : “2017-12-19 12:19:07|click|1|qd|dqd|xqd”
306 + }, //发送的第二条日志
307 + …… //第三条……
308 + ]
309 +
310 + 如果一次只发一条记录,也需要用长度为1的数组,如:
311 + [
312 + {
313 + “headers” : {"product" : "roh5"},
314 + “body” : “2017-12-19 12:19:07|click|1|qd|dqd|xqd”
315 + }
316 + ]
317 +
318 + 其他说明:
319 + Json中的headers暂时先传一个产品代号,后续有需要再扩展日志中,头两个字段是固定的,第一个字段必须是“yyyy-MM-dd HH:mm:ss”格式的时间戳,第二个字段是日志类型名称(如login,click等…),各个字段以“|”号进行分隔。
320 +
321 + 如果数据本身存在竖线,则需要使用中文竖线”丨”进行替换
322 +
323 + ---------------------------------
324 +
325 + //以上是大数据小组要的统计信息格式
326 + //设置信息
327 + var data = 统计信息,例如:[{ "headers": { "product": "roh5" }, "body": "2018-03-14 17:57:21|test|5|qd|dqd|xqd|22222|20qd|10|1050055" }];
328 + //设置统计监听
329 + var statisticsListener = {
330 + onStatisticsSuccess: function () {
331 + alert("Statistic success!");
332 + },
333 + onStatisticsFail: function () {
334 + alert("Statistic fail!");
335 + }
336 + };
337 + //启用统计接口
338 + youaiH5SDK.statistics(data, statisticsListener);