mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 03:52:07 +08:00
一些更新
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -13,9 +13,11 @@ yalc.lock
|
|||||||
go/public/
|
go/public/
|
||||||
build/extraResources/goapp.exe
|
build/extraResources/goapp.exe
|
||||||
go/go.sum
|
go/go.sum
|
||||||
|
go/tmp/
|
||||||
build/extraResources/java-app.jar
|
build/extraResources/java-app.jar
|
||||||
build/extraResources/jre1.8.0_201/
|
build/extraResources/jre1.8.0_201/
|
||||||
python/.venv/
|
python/.venv/
|
||||||
python/*.spec
|
python/*.spec
|
||||||
python/build/
|
python/build/
|
||||||
python/dist/
|
python/dist/
|
||||||
|
*DS_Store
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ class AutoUpdaterAddon {
|
|||||||
*/
|
*/
|
||||||
sendStatusToWindow(content = {}) {
|
sendStatusToWindow(content = {}) {
|
||||||
const textJson = JSON.stringify(content);
|
const textJson = JSON.stringify(content);
|
||||||
const channel = 'app.updater';
|
const channel = 'custom.app.updater';
|
||||||
const win = CoreWindow.getMainWindow();
|
const win = CoreWindow.getMainWindow();
|
||||||
win.webContents.send(channel, textJson);
|
win.webContents.send(channel, textJson);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,10 +130,13 @@ class FrameworkController extends Controller {
|
|||||||
if (!fs.existsSync(softwarePath)) {
|
if (!fs.existsSync(softwarePath)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 命令行字符串 并 执行
|
// 命令行字符串 并 执行, start 命令后面的路径要加双引号
|
||||||
let cmdStr = 'start ' + softwarePath;
|
let cmdStr = `start "${softwarePath}"`;
|
||||||
exec(cmdStr);
|
exec(cmdStr);
|
||||||
|
|
||||||
|
// 方法二
|
||||||
|
// 推荐使用cross模块
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 主进程与渲染进程通信频道定义
|
* 主进程与渲染进程通信频道定义
|
||||||
|
* 格式:控制器.文件名.方法
|
||||||
* Definition of communication channels between main process and rendering process
|
* Definition of communication channels between main process and rendering process
|
||||||
*/
|
*/
|
||||||
const ipcApiRoute = {
|
const ipcApiRoute = {
|
||||||
@@ -64,12 +65,13 @@ const ipcApiRoute = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义频道
|
* 自定义频道
|
||||||
|
* 格式:自定义(推荐添加一个前缀)
|
||||||
* custom chennel
|
* custom chennel
|
||||||
*/
|
*/
|
||||||
const specialIpcRoute = {
|
const specialIpcRoute = {
|
||||||
appUpdater: 'app.updater', // updater channel
|
appUpdater: 'custom.app.updater', // updater channel
|
||||||
window1ToWindow2: 'window1-to-window2', // windows channel
|
window1ToWindow2: 'custom.window1-to-window2', // windows channel
|
||||||
window2ToWindow1: 'window2-to-window1', // windows channel
|
window2ToWindow1: 'custom.window2-to-window1', // windows channel
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import (
|
|||||||
"github.com/wallace5303/ee-go/elog"
|
"github.com/wallace5303/ee-go/elog"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
//"electron-egg/demo/sql/sqlitelib"
|
||||||
"electron-egg/demo/sql/sqlitelib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 使用 router Ctx
|
// 使用 router Ctx
|
||||||
@@ -41,27 +40,27 @@ func SetValue(c *router.Ctx) {
|
|||||||
ret := ehelper.GetJson()
|
ret := ehelper.GetJson()
|
||||||
defer c.JSON(ret)
|
defer c.JSON(ret)
|
||||||
|
|
||||||
arg, ok := c.ArgJson()
|
// arg, ok := c.ArgJson()
|
||||||
if !ok {
|
// if !ok {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
keyName := arg["key"].(string)
|
// keyName := arg["key"].(string)
|
||||||
vallue := arg["value"]
|
// vallue := arg["value"]
|
||||||
|
|
||||||
sqlitelib.SetStatData(keyName, vallue)
|
// sqlitelib.SetStatData(keyName, vallue)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetValue(c *router.Ctx) {
|
func GetValue(c *router.Ctx) {
|
||||||
ret := ehelper.GetJson()
|
ret := ehelper.GetJson()
|
||||||
defer c.JSON(ret)
|
defer c.JSON(ret)
|
||||||
|
|
||||||
arg, ok := c.ArgJson()
|
// arg, ok := c.ArgJson()
|
||||||
if !ok {
|
// if !ok {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
keyName := arg["key"].(string)
|
// keyName := arg["key"].(string)
|
||||||
|
|
||||||
ret.Data = sqlitelib.GetStat(keyName)
|
// ret.Data = sqlitelib.GetStat(keyName)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package demo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"electron-egg/demo/job"
|
"electron-egg/demo/job"
|
||||||
"electron-egg/demo/sql/sqlitelib"
|
//"electron-egg/demo/sql/sqlitelib"
|
||||||
"electron-egg/demo/util"
|
"electron-egg/demo/util"
|
||||||
|
|
||||||
"github.com/wallace5303/ee-go/eapp"
|
"github.com/wallace5303/ee-go/eapp"
|
||||||
@@ -16,11 +16,11 @@ func Index() {
|
|||||||
// 初始化基础数据
|
// 初始化基础数据
|
||||||
util.Boot()
|
util.Boot()
|
||||||
// 初始化数据库
|
// 初始化数据库
|
||||||
sqlitelib.InitDB(false)
|
//sqlitelib.InitDB(false)
|
||||||
// 初始化任务
|
// 初始化任务
|
||||||
job.Boot()
|
job.Boot()
|
||||||
// 注册关闭前的处理函数
|
// 注册关闭前的处理函数
|
||||||
eapp.Register("beforeClose", func() {
|
eapp.Register("beforeClose", func() {
|
||||||
sqlitelib.CloseDatabase()
|
//sqlitelib.CloseDatabase()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ go 1.20
|
|||||||
require (
|
require (
|
||||||
github.com/gin-gonic/gin v1.9.1
|
github.com/gin-gonic/gin v1.9.1
|
||||||
github.com/glebarez/go-sqlite v1.22.0
|
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 (
|
require (
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
"build-l-arm64": "electron-builder --config=./electron/config/builder.json -l=deb --arm64",
|
"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-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-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",
|
"build-lp-64": "electron-builder --config=./electron/config/builder.json -l=pacman --x64",
|
||||||
"test": "set DEBUG=* && electron . --env=local"
|
"test": "set DEBUG=* && electron . --env=local"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user