mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
feat(app): 添加版本信息,为更新推送做准备
- 在应用启动时打印版本号
This commit is contained in:
parent
8afc26badb
commit
1628381295
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build wails
|
||||
uses: ArvinLovegood/wails-build-action@v2.3
|
||||
uses: ArvinLovegood/wails-build-action@v2.4
|
||||
id: build
|
||||
with:
|
||||
build-name: ${{ matrix.build.name }}
|
||||
|
13
app.go
13
app.go
@ -37,6 +37,7 @@ func NewApp() *App {
|
||||
|
||||
// startup is called at application startup
|
||||
func (a *App) startup(ctx context.Context) {
|
||||
logger.SugaredLogger.Infof("Version:%s", Version)
|
||||
// Perform your setup here
|
||||
a.ctx = ctx
|
||||
|
||||
@ -47,6 +48,18 @@ func (a *App) startup(ctx context.Context) {
|
||||
go onExit(a)
|
||||
})
|
||||
|
||||
//检查新版本
|
||||
go func() {
|
||||
config := data.NewSettingsApi(&data.Settings{}).GetConfig()
|
||||
if config.CheckUpdate {
|
||||
checkUpdate(a)
|
||||
}
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
func checkUpdate(a *App) {
|
||||
|
||||
}
|
||||
|
||||
// domReady is called after front-end resources have been loaded
|
||||
|
@ -22,6 +22,7 @@ type Settings struct {
|
||||
OpenAiMaxTokens int `json:"openAiMaxTokens"`
|
||||
OpenAiTemperature float64 `json:"openAiTemperature"`
|
||||
Prompt string `json:"prompt"`
|
||||
CheckUpdate bool `json:"checkUpdate"`
|
||||
}
|
||||
|
||||
func (receiver Settings) TableName() string {
|
||||
|
@ -74,6 +74,7 @@ export namespace data {
|
||||
openAiMaxTokens: number;
|
||||
openAiTemperature: number;
|
||||
prompt: string;
|
||||
checkUpdate: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Settings(source);
|
||||
@ -98,6 +99,7 @@ export namespace data {
|
||||
this.openAiMaxTokens = source["openAiMaxTokens"];
|
||||
this.openAiTemperature = source["openAiTemperature"];
|
||||
this.prompt = source["prompt"];
|
||||
this.checkUpdate = source["checkUpdate"];
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
|
5
main.go
5
main.go
@ -33,6 +33,9 @@ var icon2 []byte
|
||||
var stocksBin []byte
|
||||
|
||||
//go:generate cp -R ./data ./build/bin
|
||||
|
||||
var Version string
|
||||
|
||||
func main() {
|
||||
checkDir("data")
|
||||
db.Init("")
|
||||
@ -82,7 +85,7 @@ func main() {
|
||||
//FileMenu.AddText("退出", keys.CmdOrCtrl("q"), func(_ *menu.CallbackData) {
|
||||
// runtime.Quit(app.ctx)
|
||||
//})
|
||||
|
||||
logger.NewDefaultLogger().Info("version: " + Version)
|
||||
// Create application with options
|
||||
err := wails.Run(&options.App{
|
||||
Title: "go-stock",
|
||||
|
Loading…
x
Reference in New Issue
Block a user