1 Star 0 Fork 0

xiaoSM/BuildingAndCraftingAndTowerDefenseGame

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
proactively_update_global_conf_in_redis.js 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
genxium_af3a 提交于 2020-01-10 12:17 . Initial commit.
const baseAbsPath = __dirname + '/';
const request = require('request');
const fs = require('fs');
const sioConfFilePath = baseAbsPath + './battle_srv/configs/sio.json';
const origSioConfJsonStr = fs.readFileSync(sioConfFilePath, "utf8");
const sioConfJsonObj = JSON.parse(origSioConfJsonStr);
const serverPort = sioConfJsonObj.port;
const globalConfFilePath = baseAbsPath + './battle_srv/configs/global_conf.json';
const origGlobalConfJsonStr = fs.readFileSync(globalConfFilePath, "utf8");
const globalConfJsonObj = JSON.parse(origGlobalConfJsonStr);
const reqFormObj = {};
for (let k in globalConfJsonObj) {
const candidate = globalConfJsonObj[k];
if (typeof candidate == 'number' || typeof candidate == 'string') {
reqFormObj[k] = candidate;
}
}
console.log("reqFormObj is ", reqFormObj);
request.post('http://localhost:' + serverPort + '/api/v1/Global/Conf/Modify', {
form: reqFormObj
}, function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the HTML for the Google homepage.
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/SMxiaoyao/BuildingAndCraftingAndTowerDefenseGame.git
[email protected]:SMxiaoyao/BuildingAndCraftingAndTowerDefenseGame.git
SMxiaoyao
BuildingAndCraftingAndTowerDefenseGame
BuildingAndCraftingAndTowerDefenseGame
master

搜索帮助