22feb3c9-d174-4ea1-bad7-145b283af0de.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. "use strict";
  2. cc._RF.push(module, '22febPJ0XROobrXFFsoOvDe', 'YZ_Tool_QTT');
  3. // common-plugin/Scripts/YZ_Tool_QTT.ts
  4. "use strict";
  5. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  9. return c > 3 && r && Object.defineProperty(target, key, r), r;
  10. };
  11. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  13. return new (P || (P = Promise))(function (resolve, reject) {
  14. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  15. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  16. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  17. step((generator = generator.apply(thisArg, _arguments || [])).next());
  18. });
  19. };
  20. var __generator = (this && this.__generator) || function (thisArg, body) {
  21. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  22. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  23. function verb(n) { return function (v) { return step([n, v]); }; }
  24. function step(op) {
  25. if (f) throw new TypeError("Generator is already executing.");
  26. while (_) try {
  27. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  28. if (y = 0, t) op = [op[0] & 2, t.value];
  29. switch (op[0]) {
  30. case 0: case 1: t = op; break;
  31. case 4: _.label++; return { value: op[1], done: false };
  32. case 5: _.label++; y = op[1]; op = [0]; continue;
  33. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  34. default:
  35. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  36. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  37. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  38. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  39. if (t[2]) _.ops.pop();
  40. _.trys.pop(); continue;
  41. }
  42. op = body.call(thisArg, _);
  43. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  44. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  45. }
  46. };
  47. Object.defineProperty(exports, "__esModule", { value: true });
  48. exports.QTT_REPORT_TYPE = void 0;
  49. var PlatUtils_1 = require("./PlatUtils");
  50. var Utils_1 = require("./Utils");
  51. var YZ_Constant_1 = require("./YZ_Constant");
  52. var YZ_LocalStorage_1 = require("./YZ_LocalStorage");
  53. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  54. var ST_DefaultServerConfig = "";
  55. var ST_ServerUrl = "http://apps.youlesp.com/gss?";
  56. var POST_ServerUrl = "http://report.youlesp.com/gss?";
  57. //@ts-ignore
  58. var md5 = require('./md5.js');
  59. var QTT_ServerUrl = "https://newidea4-gamecenter-backend.1sapp.com/x/open/user/ticket?";
  60. var QTT_Report = "https://newidea4-gamecenter-backend.1sapp.com/x/open/report/round";
  61. /**
  62. * 趣头条工具类
  63. */
  64. var YZ_Tool_QTT = /** @class */ (function () {
  65. function YZ_Tool_QTT() {
  66. /**
  67. * 平台标示
  68. */
  69. this.platForm = "";
  70. //@ts-ignore
  71. this.qttGame = window.qttGame;
  72. this._serverConfig = null;
  73. /**
  74. * 用户临时标示
  75. */
  76. this.ticket = "";
  77. this._ip = "192.168.0.1";
  78. this._sign = "";
  79. /**
  80. * 服务器地址
  81. */
  82. this.serverPath = "http://apps.youlesp.com/gss?";
  83. //设备UID
  84. this._uid = "0";
  85. //服务器返回UID
  86. this._service_uid = "0";
  87. this._loginTime = 0;
  88. this._loginInterval = 30;
  89. this._reportLoginTime = 0;
  90. this._reportLoginInterval = 30;
  91. this.isReport = false;
  92. this.iframe = null;
  93. this.form = null;
  94. this._isReady = false;
  95. this._isLogin = false;
  96. this._isLoad = false;
  97. this._isStart = false;
  98. }
  99. Object.defineProperty(YZ_Tool_QTT.prototype, "ServerConfig", {
  100. get: function () {
  101. return this._serverConfig;
  102. },
  103. enumerable: false,
  104. configurable: true
  105. });
  106. Object.defineProperty(YZ_Tool_QTT.prototype, "uid", {
  107. get: function () {
  108. if (this._service_uid != "0")
  109. return this._uid;
  110. this._login();
  111. return "0";
  112. },
  113. enumerable: false,
  114. configurable: true
  115. });
  116. Object.defineProperty(YZ_Tool_QTT.prototype, "serviceId", {
  117. /**
  118. * 服务器返回UID
  119. */
  120. get: function () {
  121. if (this._service_uid != "0")
  122. return this._service_uid;
  123. this.reportLogin();
  124. return "0";
  125. },
  126. enumerable: false,
  127. configurable: true
  128. });
  129. YZ_Tool_QTT.prototype._login = function () {
  130. return __awaiter(this, void 0, void 0, function () {
  131. var curTime, interval, self, url, xhr;
  132. return __generator(this, function (_a) {
  133. curTime = new Date().getTime();
  134. interval = (curTime - this._loginTime) / 1000;
  135. if (interval > 0 && interval < 30) {
  136. Utils_1.utils.showLog("\u767B\u5F55\u8BF7\u6C42\u95F4\u9694\u5C0F\u4E8E\uFF1A" + this._loginInterval + "\u79D2");
  137. return [2 /*return*/];
  138. }
  139. this._loginTime = curTime;
  140. self = this;
  141. Utils_1.utils.showLog("qtt暂时不获取uid,uid全部为0");
  142. this._uid = "0";
  143. url = this.getUrl();
  144. console.log("qtt获取用户的地址为:" + url);
  145. xhr = new XMLHttpRequest();
  146. xhr.timeout = 6000; // 单位毫秒
  147. xhr.open('get', url);
  148. xhr.send();
  149. xhr.onreadystatechange = function () {
  150. Utils_1.utils.showLog("请求状态改变, reaedyState=", xhr.readyState, "; status=", xhr.status);
  151. if (xhr.readyState == 4 && xhr.status == 200) {
  152. console.log("请求成功");
  153. console.log(xhr.responseText);
  154. var msg = xhr.responseText;
  155. var result = JSON.parse(msg);
  156. console.log(result);
  157. Utils_1.utils.showLog("获取数据成功1");
  158. self._uid = result.data.open_id;
  159. self.postServerData(QTT_REPORT_TYPE.ready);
  160. YZ_LocalStorage_1.default.setItem(YZ_Constant_1.default.ST_UID, self._uid);
  161. console.log(self._uid);
  162. }
  163. if (xhr.status != 200) {
  164. }
  165. };
  166. xhr.ontimeout = function () {
  167. Utils_1.utils.showLog("请求超时!");
  168. };
  169. xhr.onerror = function (err) {
  170. Utils_1.utils.showLog("请求出错! err=", JSON.stringify(err));
  171. };
  172. return [2 /*return*/];
  173. });
  174. });
  175. };
  176. /**
  177. * 上报登录接口获取UID
  178. */
  179. YZ_Tool_QTT.prototype.reportLogin = function () {
  180. var _this = this;
  181. if (this.isReport)
  182. return;
  183. this.isReport = true;
  184. var self = this;
  185. var curTime = new Date().getTime();
  186. var interval = (curTime - self._reportLoginTime) / 1000;
  187. if (interval > 0 && interval < 30) {
  188. Utils_1.utils.showLog("\u4E0A\u62A5\u767B\u5F55\u83B7\u53D6UID\u5C0F\u4E8E\uFF1A" + self._reportLoginInterval + "\u79D2");
  189. return;
  190. }
  191. self._reportLoginTime = curTime;
  192. var method = "m=login";
  193. var url = ST_ServerUrl + method + "&device_data=0";
  194. Utils_1.utils.commomHttpRequest(url, function (ret, data) {
  195. if (ret) {
  196. if (data) {
  197. var result = JSON.parse(data);
  198. Utils_1.utils.showLog("data=" + data);
  199. Utils_1.utils.showLog("result=" + result);
  200. Utils_1.utils.showLog("result.uid=" + result.uid);
  201. if (result.ip) {
  202. _this._ip = result.ip;
  203. }
  204. if (result.uid) {
  205. self._service_uid = "" + result.uid;
  206. Utils_1.utils.showLog("服务器请求登录成功! _service_uid=" + self._service_uid);
  207. YZ_LocalStorage_1.default.setItem(YZ_Constant_1.default.ST_SERVICE_UID, self._service_uid);
  208. }
  209. }
  210. }
  211. else {
  212. Utils_1.utils.showLog("获取数据失败1");
  213. }
  214. _this.isReport = false;
  215. });
  216. };
  217. /**
  218. * 初始化
  219. * @param data 配置数据
  220. */
  221. YZ_Tool_QTT.prototype.init = function (data) {
  222. var _this = this;
  223. Utils_1.utils.showLog("qtt 初始化>>", data);
  224. if (data) {
  225. var configObj = JSON.parse(data);
  226. if (configObj && configObj.qutoutiao) {
  227. ST_DefaultServerConfig = JSON.stringify(configObj.qutoutiao);
  228. }
  229. }
  230. cc.game.on(QTT_REPORT_TYPE.ready, function () {
  231. _this.postServerData(QTT_REPORT_TYPE.login);
  232. }, this);
  233. cc.game.on(QTT_REPORT_TYPE.login, function () {
  234. _this.postServerData(QTT_REPORT_TYPE.load);
  235. }, this);
  236. this._uid = YZ_LocalStorage_1.default.getItem(YZ_Constant_1.default.ST_UID);
  237. this._uid = this._uid ? this._uid : "0";
  238. this.postServerData(QTT_REPORT_TYPE.ready);
  239. this._service_uid = YZ_LocalStorage_1.default.getItem(YZ_Constant_1.default.ST_SERVICE_UID);
  240. this._service_uid = this._service_uid ? this._service_uid : "0";
  241. this.platForm = this.GetRequest("platform");
  242. this.ticket = this.GetRequest("ticket");
  243. if (this.ticket && this.platForm) {
  244. // this.getUserInfo();
  245. // new QTTHELP().g
  246. // let qttHelp = new QTTHELP();
  247. // QTTHelp();
  248. // QTTHelp().then((res) => {
  249. // utils.showLog(">>>>>>>>>>>");
  250. // }).catch(() => {
  251. // })
  252. }
  253. this.loadServerData();
  254. };
  255. /**
  256. * 每局结束上报数据
  257. */
  258. YZ_Tool_QTT.prototype.postGameOverData = function (level) {
  259. if (PlatUtils_1.default.IsQTT) {
  260. this.qttGame.completeTask();
  261. this.qttGame.userInfo({ role: '趣头条', region: '区域1', level: level, ce: '1000000', round: '1', revenue: '100000', extend_info: { age: '18' } });
  262. }
  263. // Sys
  264. var time = Math.floor(new Date().getTime() / 1000);
  265. var values = {
  266. app_id: Utils_1.utils.config.qttconfig.appID,
  267. open_id: this.uid,
  268. ip: this._ip,
  269. round: level,
  270. game_time: time,
  271. };
  272. this.getSign(values);
  273. var formData = new FormData();
  274. formData.append("app_id", values.app_id);
  275. formData.append("open_id", values.open_id);
  276. formData.append("ip", values.ip);
  277. formData.append("round", values.round);
  278. formData.append("game_time", values.game_time);
  279. formData.append("sign", this._sign);
  280. this.post(values);
  281. };
  282. YZ_Tool_QTT.prototype.post = function (values) {
  283. if (!this.form) {
  284. this.form = document.createElement("form");
  285. }
  286. else {
  287. this.form.innerHTML = "";
  288. }
  289. if (!this.iframe) {
  290. this.iframe = document.createElement("iframe");
  291. }
  292. this.form.action = QTT_Report;
  293. this.form.enctype = "application/x-www-form-urlencoded";
  294. this.form.method = "post";
  295. this.iframe.name = "form";
  296. this.iframe.id = "form";
  297. this.form.target = "form";
  298. for (var item in values) {
  299. var opt = document.createElement("textarea");
  300. opt.name = item;
  301. opt.value = values[item];
  302. this.form.appendChild(opt);
  303. }
  304. document.body.appendChild(this.iframe);
  305. this.iframe.appendChild(this.form);
  306. this.form.submit();
  307. };
  308. /**
  309. * 获取用户信息
  310. */
  311. YZ_Tool_QTT.prototype.getUserInfo = function () {
  312. this.qttGame.getUserInfo(Utils_1.utils.config.qttconfig.appKey, Utils_1.utils.config.qttconfig.appID, this.ticket, this.platForm).then(function (res) {
  313. // 成功
  314. Utils_1.utils.showLog("获取用户信息成功 #userInfo=", JSON.stringify(res));
  315. }).catch(function (err) {
  316. // 失败
  317. });
  318. };
  319. /**
  320. * 通过参数名称获取链接里的值
  321. * @param key 参数名称
  322. */
  323. YZ_Tool_QTT.prototype.GetRequest = function (key) {
  324. var url = location.search;
  325. var theRequest = new Object();
  326. if (url.indexOf("?") != -1) {
  327. var str = url.substr(1);
  328. var strs = str.split("&");
  329. for (var i = 0; i < strs.length; i++) {
  330. theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
  331. }
  332. }
  333. var value = theRequest[key];
  334. return value;
  335. };
  336. /**
  337. * 请求服务器数据
  338. */
  339. YZ_Tool_QTT.prototype.loadServerData = function () {
  340. var _this = this;
  341. if (!this.uid) {
  342. cc.error("用户ID为空>>>");
  343. this._uid = "0";
  344. }
  345. var method = "m=g";
  346. Utils_1.utils.commomHttpRequest(ST_ServerUrl + method, function (ret, data) {
  347. Utils_1.utils.showLog("loadServerUserdate #ret=", ret, " #data=", data);
  348. if (ret) {
  349. if (data) {
  350. Utils_1.utils.showLog("qtt服务器配置数据获取成功: data = ", data);
  351. var result = JSON.parse(data);
  352. if (result) {
  353. if (!Utils_1.utils.DebugLoacalConfig) {
  354. _this._serverConfig = result;
  355. if (_this._serverConfig.is_show_log_view && _this._serverConfig.is_show_log_view == "true") {
  356. Utils_1.utils.showLogView = true;
  357. Utils_1.utils.showLog();
  358. }
  359. }
  360. else {
  361. cc.warn("开启了本地数据测试,使用本地配置!");
  362. }
  363. }
  364. else {
  365. Utils_1.utils.showLog("qtt服务器配置数据不是合法的JSON数据, 使用本地配置!");
  366. }
  367. }
  368. else {
  369. Utils_1.utils.showLog("qtt服务器配置数据获取失败, 使用本地配置!");
  370. }
  371. }
  372. else {
  373. }
  374. if (!_this._serverConfig) {
  375. _this._serverConfig = JSON.parse(ST_DefaultServerConfig);
  376. }
  377. else {
  378. if (_this._serverConfig.is_local_pos_id
  379. && _this._serverConfig.is_local_pos_id == "false") {
  380. // 使用服务器下发的广告id
  381. Utils_1.utils.showLog("使用服务器下发的广告id");
  382. Utils_1.utils.showLog("趣头条没有广告id");
  383. }
  384. else {
  385. Utils_1.utils.showLog("使用本地配置的广告ID");
  386. }
  387. }
  388. Utils_1.utils.emitServerInitEvent();
  389. });
  390. };
  391. /**
  392. * 上报关卡数据
  393. * @param level 当前关卡ID
  394. * @param levelName 关卡名称
  395. * @param status 状态
  396. */
  397. YZ_Tool_QTT.prototype.postLevel = function (level, status, levelName) {
  398. if (PlatUtils_1.default.IsQTT) {
  399. var method = "m=rlevel";
  400. var url = POST_ServerUrl + method + ("&level_id=" + level + "&level_name=" + encodeURI(levelName) + "&status=" + status);
  401. Utils_1.utils.commomHttpRequest(url, function (ret, data) {
  402. if (ret) {
  403. Utils_1.utils.showLog("关卡数据上报成功!");
  404. }
  405. else {
  406. Utils_1.utils.showLog("关卡数据上报失败!");
  407. }
  408. }.bind(this));
  409. if (status == YZ_Constant_1.LevelStatus.GameStart) {
  410. this.postServerData(QTT_REPORT_TYPE.start);
  411. }
  412. //上报到qtt的官方服务器
  413. if (status == YZ_Constant_1.LevelStatus.GameWin) {
  414. this.postGameOverData(Number(level));
  415. }
  416. }
  417. };
  418. YZ_Tool_QTT.prototype.getSign = function (values) {
  419. var s = this.sign(values);
  420. values.sign = s;
  421. this.checkSign(values);
  422. this._sign = s;
  423. };
  424. YZ_Tool_QTT.prototype.getUrl = function () {
  425. var params = this.getParams();
  426. var values = {
  427. app_id: Utils_1.utils.config.qttconfig.appID,
  428. platform: params.platform,
  429. ticket: params.ticket,
  430. time: Math.floor(new Date().getTime() / 1000)
  431. };
  432. var s = this.sign(values);
  433. values.sign = s;
  434. this._sign = s;
  435. return QTT_ServerUrl + "app_id=" + values.app_id + "&platform=" + params.platform + "&ticket=" + params.ticket + "&time=" + values.time + "&sign=" + values.sign;
  436. };
  437. YZ_Tool_QTT.prototype.getParams = function () {
  438. var url = window.location.href;
  439. var paramArr = url.split("&");
  440. var platform;
  441. var ticket;
  442. paramArr.forEach(function (str) {
  443. if (str.indexOf("platform") != -1) {
  444. platform = str.split("=")[1];
  445. }
  446. if (str.indexOf("ticket") != -1) {
  447. ticket = str.split("=")[1];
  448. }
  449. });
  450. return { platform: platform, ticket: ticket };
  451. };
  452. YZ_Tool_QTT.prototype.sign = function (values) {
  453. delete values.sign;
  454. values.app_key = Utils_1.utils.config.qttconfig.appKey;
  455. var keysArr = [];
  456. for (var key in values) {
  457. keysArr.push(key);
  458. }
  459. keysArr.sort();
  460. var keys = '';
  461. keysArr.forEach(function (e) {
  462. keys += e;
  463. keys += values[e];
  464. });
  465. console.log("原串:" + keys);
  466. delete values.app_key;
  467. var sign = md5(keys);
  468. return sign;
  469. };
  470. YZ_Tool_QTT.prototype.checkSign = function (values) {
  471. var sign1 = values.sign;
  472. if (!sign1) {
  473. console.log('sign error');
  474. return false;
  475. }
  476. var sign2 = this.sign(values);
  477. if (sign1 !== sign2) {
  478. console.log("sign error");
  479. return false;
  480. }
  481. console.log('ok');
  482. return true;
  483. };
  484. /**
  485. * 趣头条服务器上报
  486. *
  487. * 参数为object对象, 根据type 属性传入对应字段
  488. * @param type {String} ready 游戏资源加载完毕 login 用户成功登陆 load 成功进入游戏界面/主页 start 开始游戏
  489. * @param app_id { String} [必填]
  490. * @param open_id {String} 参考具体上报说明
  491. * @param game_name {String} 参考具体上报说明
  492. * @param extend_info [选填] json对象 {}
  493. *
  494. **/
  495. YZ_Tool_QTT.prototype.postServerData = function (type, info) {
  496. console.log("趣头条数据上报:" + type, this._uid);
  497. if (!this.uid && this._uid != "0") {
  498. cc.error("用户ID不存在 ,不上报数据>>>");
  499. return;
  500. }
  501. switch (type) {
  502. case QTT_REPORT_TYPE.ready:
  503. if (this._isReady) {
  504. console.log("已经上传过资源加载完毕事件");
  505. return;
  506. }
  507. break;
  508. case QTT_REPORT_TYPE.login:
  509. if (this._isLogin) {
  510. console.log("以及上传过资源加载完毕事件");
  511. return;
  512. }
  513. break;
  514. case QTT_REPORT_TYPE.load:
  515. if (this._isLoad) {
  516. console.log("以及上传过资源加载完毕事件");
  517. return;
  518. }
  519. break;
  520. case QTT_REPORT_TYPE.start:
  521. if (this._isStart) {
  522. console.log("以及上传过资源加载完毕事件");
  523. return;
  524. }
  525. break;
  526. default:
  527. break;
  528. }
  529. var app_id = Utils_1.utils.config.qttconfig.appID;
  530. var game_name = Utils_1.utils.config.qttconfig.gamename;
  531. var extend_info = info ? info : {};
  532. if (this.qttGame && this.qttGame.reportData) {
  533. switch (type) {
  534. case QTT_REPORT_TYPE.ready:
  535. this._isReady = true;
  536. break;
  537. case QTT_REPORT_TYPE.login:
  538. this._isLogin = true;
  539. break;
  540. case QTT_REPORT_TYPE.load:
  541. this._isLoad = true;
  542. break;
  543. case QTT_REPORT_TYPE.start:
  544. this._isStart = true;
  545. break;
  546. }
  547. this.qttGame.reportData({ "type": type, "open_id": this.uid, "app_id": app_id, "game_name": game_name, "extend_info": extend_info });
  548. console.log("趣头条成功发送事件:" + type);
  549. cc.game.emit(type);
  550. }
  551. else {
  552. var self_1 = this;
  553. console.log("趣头条发送:" + type + "失败");
  554. setTimeout(function () {
  555. self_1.postServerData(type, info);
  556. }, 100);
  557. }
  558. };
  559. /**
  560. * 上报自定义事件
  561. * @param level 当前关卡ID
  562. * @param levelName 关卡名称
  563. * @param status 状态
  564. */
  565. YZ_Tool_QTT.prototype.sendEvent = function (eventName) {
  566. if (PlatUtils_1.default.IsQTT) {
  567. var method = "m=revent";
  568. var url = POST_ServerUrl + method + ("&event=" + encodeURI(eventName));
  569. Utils_1.utils.commomHttpRequest(url, function (ret, data) {
  570. if (ret) {
  571. Utils_1.utils.showLog("上报自定义事件成功!");
  572. }
  573. else {
  574. Utils_1.utils.showLog("上报自定义事件失败!");
  575. }
  576. }.bind(this));
  577. }
  578. };
  579. YZ_Tool_QTT = __decorate([
  580. ccclass
  581. ], YZ_Tool_QTT);
  582. return YZ_Tool_QTT;
  583. }());
  584. exports.default = YZ_Tool_QTT;
  585. var QTT_REPORT_TYPE;
  586. (function (QTT_REPORT_TYPE) {
  587. QTT_REPORT_TYPE["ready"] = "ready";
  588. QTT_REPORT_TYPE["login"] = "login";
  589. QTT_REPORT_TYPE["load"] = "load";
  590. QTT_REPORT_TYPE["start"] = "start";
  591. QTT_REPORT_TYPE["newRole"] = "newRole";
  592. QTT_REPORT_TYPE["newUser"] = "newUser";
  593. QTT_REPORT_TYPE["upgrade"] = "upgrade";
  594. QTT_REPORT_TYPE["userInfo"] = "userInfo";
  595. QTT_REPORT_TYPE["abnormal"] = "abnormal";
  596. })(QTT_REPORT_TYPE = exports.QTT_REPORT_TYPE || (exports.QTT_REPORT_TYPE = {}));
  597. cc._RF.pop();