File tree Expand file tree Collapse file tree 5 files changed +21
-2
lines changed
Expand file tree Collapse file tree 5 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 3232 submodules : recursive
3333
3434 - name : Build wails
35- uses : ArvinLovegood/wails-build-action@v2.3
35+ uses : ArvinLovegood/wails-build-action@v2.4
3636 id : build
3737 with :
3838 build-name : ${{ matrix.build.name }}
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ func NewApp() *App {
3737
3838// startup is called at application startup
3939func (a * App ) startup (ctx context.Context ) {
40+ logger .SugaredLogger .Infof ("Version:%s" , Version )
4041 // Perform your setup here
4142 a .ctx = ctx
4243
@@ -47,6 +48,18 @@ func (a *App) startup(ctx context.Context) {
4748 go onExit (a )
4849 })
4950
51+ //检查新版本
52+ go func () {
53+ config := data .NewSettingsApi (& data.Settings {}).GetConfig ()
54+ if config .CheckUpdate {
55+ checkUpdate (a )
56+ }
57+ }()
58+
59+ }
60+
61+ func checkUpdate (a * App ) {
62+
5063}
5164
5265// domReady is called after front-end resources have been loaded
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ type Settings struct {
2222 OpenAiMaxTokens int `json:"openAiMaxTokens"`
2323 OpenAiTemperature float64 `json:"openAiTemperature"`
2424 Prompt string `json:"prompt"`
25+ CheckUpdate bool `json:"checkUpdate"`
2526}
2627
2728func (receiver Settings ) TableName () string {
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ export namespace data {
7474 openAiMaxTokens : number ;
7575 openAiTemperature : number ;
7676 prompt : string ;
77+ checkUpdate : boolean ;
7778
7879 static createFrom ( source : any = { } ) {
7980 return new Settings ( source ) ;
@@ -98,6 +99,7 @@ export namespace data {
9899 this . openAiMaxTokens = source [ "openAiMaxTokens" ] ;
99100 this . openAiTemperature = source [ "openAiTemperature" ] ;
100101 this . prompt = source [ "prompt" ] ;
102+ this . checkUpdate = source [ "checkUpdate" ] ;
101103 }
102104
103105 convertValues ( a : any , classs : any , asMap : boolean = false ) : any {
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ var icon2 []byte
3333var stocksBin []byte
3434
3535//go:generate cp -R ./data ./build/bin
36+
37+ var Version string
38+
3639func main () {
3740 checkDir ("data" )
3841 db .Init ("" )
@@ -82,7 +85,7 @@ func main() {
8285 //FileMenu.AddText("退出", keys.CmdOrCtrl("q"), func(_ *menu.CallbackData) {
8386 // runtime.Quit(app.ctx)
8487 //})
85-
88+ logger . NewDefaultLogger (). Info ( "version: " + Version )
8689 // Create application with options
8790 err := wails .Run (& options.App {
8891 Title : "go-stock" ,
You can’t perform that action at this time.
0 commit comments