Files
JianMiauandClaude Fable 5 ebe8c3caca 初始化 Line_Project_Bot:LP_Bot 重構版(介面重設計+平台環境改讀試算表)
根本原因:
LP_Bot 介面老舊且環境設定寫死在程式內,新增平台或環境都要改碼重建。

影響:
全新深色控制台介面;首頁改為「平台+環境+Token」,平台清單與連線設定
即時讀取 Google 試算表(quickopen 同款資料來源),選擇與 Token 會記憶於
localStorage;支援「開遊戲」直開跳過維護網址;SD 機台自製 Spin 面板
(押注/延遲/倍率停/轉數停+Log 終端)。

修法:
- 底層引擎(Engine/Common/define/FormTable*)自 LP_Bot 原封搬移
- UI 層全部重寫(Login/Lobby/SlotList/SDGame),antd 深色主題
- 新增 GoogleSheetService:service account 簽 JWT 讀 Sheets API,
  非安全來源 fallback jsrsasign
- 移除 React.StrictMode(雙重掛載會讓 NetManagerSD 單例連線互蓋)
- SD socket 依 gameUrl 協定強制 wss
- 機台 1310/1311/1801/1803/1804/1805 Spin 帶 mode:0 特例
  (依 SD3 客戶端 MainState 原始碼)
- credentials.json 不進版控,附 credentials.example.json 範本

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-03 11:04:49 +08:00

124 lines
3.5 KiB
JavaScript

//build.js文件
// let exec = require('child_process').exec // 异步子进程
let fs = require('fs')
const path = "./build-templates/version.json"
let packageJSON = require(path)
/** package.json文件的version参数 */
let version = packageJSON.version
// /** 命令行的所有参数 */
// let options = process.argv
// /** 命令行的type参数 */
// let type = null
// /** 新的version参数 */
// let newVersion = null
const dt = new Date();
const Year = +((dt.getFullYear() + "")[2] + (dt.getFullYear() + "")[3]);
const Month = +(dt.getMonth() + 1);
const Day = +(dt.getDate());
let MajorVersion = +(version.MajorVersion);
let MinorVersion = +(version.MinorVersion);
let BuildVersion = +(version.BuildVersion);
let Revision = +(version.Revision);
if (!MajorVersion || !MinorVersion || !BuildVersion || !Revision || Year != MajorVersion) {
MajorVersion = Year;
MinorVersion = Month;
BuildVersion = Day;
Revision = 1;
} else if (Month != MinorVersion) {
MinorVersion = Month;
BuildVersion = Day;
Revision = 1;
} else if (Day != BuildVersion) {
BuildVersion = Day;
Revision = 1;
} else {
Revision++;
}
var data_new = {
version: {
MajorVersion,
MinorVersion,
BuildVersion,
Revision
}
}
let VersionNew = JSON.stringify(data_new);
console.log(`version: ${MajorVersion}.${MinorVersion}.${BuildVersion}.${Revision}`)
//同步寫入package.json文件
fs.writeFileSync(path, VersionNew)
return;
// //判断命令行是否存在type参数或version参数进行逻辑处理
// for (let i = 0; i < options.length; i++) {
// if (options[i].indexOf('type') > -1) {
// //存在type参数
// type = options[i].split('=')[1]
// } else if (options[i].indexOf('version') > -1) {
// //存在version参数
// newVersion = options[i].split('=')[1]
// } else {
// //code
// }
// }
// if (newVersion) {
// //存在设置version参数则改变原来的version
// version = newVersion
// } else if (type) {
// //不设置version则根据type来进行修改version
// version = handleType(version, type)
// } else {
// version = null
// console.log('-----------没有改变version-----------')
// }
// //修改了version则写入
// if (version) {
// packageJSON.version = version
// //同步写入package.json文件
// fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2))
// console.log('-----------更新package的version为:%s参数成功-----------', version)
// // handleGitAdd('./package.json')
// // pullRemote()
// }
// /**
// * 根据分支类型处理版本号version
// * @param {string} oldVersion 旧的版本号
// * @param {string} type 分支类型
// * @private
// */
// function handleType(oldVersion, type) {
// let oldVersionArr = oldVersion.split('.')
// //版本号第一位 如:1.2.3 则为 1
// let firstNum = +oldVersionArr[0]
// //版本号第二位 如:1.2.3 则为 2
// let secondNum = +oldVersionArr[1]
// //版本号第三位 如:1.2.3 则为 3
// let thirdNum = +oldVersionArr[2]
// switch (type) {
// case 'release':
// //release分支的处理逻辑
// ++secondNum
// thirdNum = 0
// break
// case 'hotfix':
// //hotfix分支的处理逻辑
// ++thirdNum
// break
// default:
// // 默认按照最小版本处理
// ++thirdNum
// break
// }
// return firstNum + '.' + secondNum + '.' + thirdNum
// }