feat: 系统初始引导使用重置接口

This commit is contained in:
TsMask
2024-05-07 16:26:48 +08:00
parent a2a876434d
commit 31589ce234
5 changed files with 81 additions and 30 deletions

View File

@@ -8,6 +8,7 @@ import (
"runtime"
"time"
"be.ems/src/framework/constants/common"
"be.ems/src/framework/logger"
"be.ems/src/framework/utils/crypto"
"be.ems/src/framework/utils/parse"
@@ -98,11 +99,11 @@ func Launch() {
// 检查文件是否存在
if _, err := os.Stat(filePath()); err != nil {
LaunchInfo = map[string]any{
"code": Code, // 机器码
"firstTime": time.Now().UnixMilli(), // 首次启动使用时间
"code": Code, // 机器码
"useTime": time.Now().UnixMilli(), // 首次使用时间
"sysGuide": true, // 首次引导
"sysGuideTime": 0, // 引导完成时间
common.LAUNCH_BOOTLOADER: true, // 启动引导
common.LAUNCH_BOOTLOADER + "Time": 0, // 引导完成时间
}
codeFileWrite(LaunchInfo)
} else {
@@ -125,7 +126,7 @@ func SetLaunchInfo(info map[string]any) error {
}
// 固定值禁止变更
constKeys := []string{"code", "firstTime"}
constKeys := []string{"code", "useTime"}
for k, v := range info {
constKey := false
for _, ck := range constKeys {