一些更新

This commit is contained in:
gaoshuaixing
2024-10-21 17:55:44 +08:00
parent 261bc27152
commit 4afbc02af0
8 changed files with 32 additions and 25 deletions

2
.gitignore vendored
View File

@@ -13,9 +13,11 @@ yalc.lock
go/public/
build/extraResources/goapp.exe
go/go.sum
go/tmp/
build/extraResources/java-app.jar
build/extraResources/jre1.8.0_201/
python/.venv/
python/*.spec
python/build/
python/dist/
*DS_Store

View File

@@ -135,7 +135,7 @@ class AutoUpdaterAddon {
*/
sendStatusToWindow(content = {}) {
const textJson = JSON.stringify(content);
const channel = 'app.updater';
const channel = 'custom.app.updater';
const win = CoreWindow.getMainWindow();
win.webContents.send(channel, textJson);
}

View File

@@ -130,10 +130,13 @@ class FrameworkController extends Controller {
if (!fs.existsSync(softwarePath)) {
return false;
}
// 命令行字符串 并 执行
let cmdStr = 'start ' + softwarePath;
// 命令行字符串 并 执行, start 命令后面的路径要加双引号
let cmdStr = `start "${softwarePath}"`;
exec(cmdStr);
// 方法二
// 推荐使用cross模块
return true;
}

View File

@@ -1,6 +1,7 @@
/**
* 主进程与渲染进程通信频道定义
* 格式:控制器.文件名.方法
* Definition of communication channels between main process and rendering process
*/
const ipcApiRoute = {
@@ -64,12 +65,13 @@ const ipcApiRoute = {
/**
* 自定义频道
* 格式:自定义(推荐添加一个前缀)
* custom chennel
*/
const specialIpcRoute = {
appUpdater: 'app.updater', // updater channel
window1ToWindow2: 'window1-to-window2', // windows channel
window2ToWindow1: 'window2-to-window1', // windows channel
appUpdater: 'custom.app.updater', // updater channel
window1ToWindow2: 'custom.window1-to-window2', // windows channel
window2ToWindow1: 'custom.window2-to-window1', // windows channel
}
export {

View File

@@ -9,8 +9,7 @@ import (
"github.com/wallace5303/ee-go/elog"
"github.com/gin-gonic/gin"
"electron-egg/demo/sql/sqlitelib"
//"electron-egg/demo/sql/sqlitelib"
)
// 使用 router Ctx
@@ -41,27 +40,27 @@ func SetValue(c *router.Ctx) {
ret := ehelper.GetJson()
defer c.JSON(ret)
arg, ok := c.ArgJson()
if !ok {
return
}
// arg, ok := c.ArgJson()
// if !ok {
// return
// }
keyName := arg["key"].(string)
vallue := arg["value"]
// keyName := arg["key"].(string)
// vallue := arg["value"]
sqlitelib.SetStatData(keyName, vallue)
// sqlitelib.SetStatData(keyName, vallue)
}
func GetValue(c *router.Ctx) {
ret := ehelper.GetJson()
defer c.JSON(ret)
arg, ok := c.ArgJson()
if !ok {
return
}
// arg, ok := c.ArgJson()
// if !ok {
// return
// }
keyName := arg["key"].(string)
// keyName := arg["key"].(string)
ret.Data = sqlitelib.GetStat(keyName)
// ret.Data = sqlitelib.GetStat(keyName)
}

View File

@@ -2,7 +2,7 @@ package demo
import (
"electron-egg/demo/job"
"electron-egg/demo/sql/sqlitelib"
//"electron-egg/demo/sql/sqlitelib"
"electron-egg/demo/util"
"github.com/wallace5303/ee-go/eapp"
@@ -16,11 +16,11 @@ func Index() {
// 初始化基础数据
util.Boot()
// 初始化数据库
sqlitelib.InitDB(false)
//sqlitelib.InitDB(false)
// 初始化任务
job.Boot()
// 注册关闭前的处理函数
eapp.Register("beforeClose", func() {
sqlitelib.CloseDatabase()
//sqlitelib.CloseDatabase()
})
}

View File

@@ -5,7 +5,7 @@ go 1.20
require (
github.com/gin-gonic/gin v1.9.1
github.com/glebarez/go-sqlite v1.22.0
github.com/wallace5303/ee-go v1.0.0
github.com/wallace5303/ee-go v1.2.1
)
require (

View File

@@ -41,6 +41,7 @@
"build-l-arm64": "electron-builder --config=./electron/config/builder.json -l=deb --arm64",
"build-l-armv7l": "electron-builder --config=./electron/config/builder.json -l=deb --armv7l",
"build-lr-64": "electron-builder --config=./electron/config/builder.json -l=rpm --x64",
"build-lr-arm64": "electron-builder --config=./electron/config/builder.json -l=rpm --arm64",
"build-lp-64": "electron-builder --config=./electron/config/builder.json -l=pacman --x64",
"test": "set DEBUG=* && electron . --env=local"
},