1bae443d-c40c-4240-a0ae-deac558116e1.js
1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"use strict";
cc._RF.push(module, '1bae4Q9xAxCQKCu3qxVgRbh', 'HttpRequests');
// script/game/network/HttpRequests.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpRequests = void 0;
const GameConfig_1 = require("../../GameConfig");
const simba_sdk_1 = require("simba-sdk");
var HttpRequests;
(function (HttpRequests) {
// 检查敏感词
async function hasDirtyWords(msg) {
if (GameConfig_1.channel !== "dummy") {
let data = `game_id=${GameConfig_1.GameConfig.gameId}&game_channel=${GameConfig_1.channel}&nickname=${msg}`;
let ret = JSON.parse(await GameConfig_1.GameConfig.iwpServerUrl.post("/wechat/checknickname", 5000, data, "application/x-www-form-urlencoded"));
console.log("校验返回的数据 ", ret);
if (ret.code === "0") {
return ret.obj.is_sensitive;
}
else {
throw new Error("校验错误");
}
}
else {
return false;
}
}
HttpRequests.hasDirtyWords = hasDirtyWords;
// 获取公告
async function getNotice() {
try {
let str = await GameConfig_1.GameConfig.cdnServer.get(`/notice/notice_${GameConfig_1.GameConfig.gameVersion}.json`);
return JSON.parse(str);
}
catch (e) {
return "";
}
}
HttpRequests.getNotice = getNotice;
// 兑换 CDKEY
async function exchangeCDKEY(key) {
let ret = await GameConfig_1.GameConfig.iwpServerUrl.post("/client/v1/cdkey/exchange", 5000, `cdkey=${key}&user_id=${simba_sdk_1.SDK.getLoginInfo().playerId}&game_id=${GameConfig_1.GameConfig.gameId}`);
return JSON.parse(ret);
}
HttpRequests.exchangeCDKEY = exchangeCDKEY;
})(HttpRequests = exports.HttpRequests || (exports.HttpRequests = {}));
cc._RF.pop();