diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3a59273..8aeb803 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,8 +31,13 @@ jobs: with: submodules: recursive + - name: Get commit message + run: | + commit_message=$(git log -1 --pretty=format:"# [%an %ad] # %s %b") + echo "Commit message: $commit_message" + - name: Build wails - uses: ArvinLovegood/wails-build-action@v2.4 + uses: ArvinLovegood/wails-build-action@v2.5 id: build with: build-name: ${{ matrix.build.name }} @@ -40,3 +45,4 @@ jobs: package: true go-version: '1.23' build-tags: ${{ github.ref_name }} + build-commit-message: $commit_message diff --git a/app.go b/app.go index 596f4b6..7ca1e84 100644 --- a/app.go +++ b/app.go @@ -4,6 +4,7 @@ package main import ( "context" + "encoding/base64" "fmt" "github.com/PuerkitoBio/goquery" "github.com/coocood/freecache" @@ -431,6 +432,18 @@ func (a *App) GetAIResponseResult(stock string) *models.AIResponseResult { return data.NewDeepSeekOpenAi().GetAIResponseResult(stock) } +func (a *App) GetVersionInfo() *models.VersionInfo { + return &models.VersionInfo{ + Version: Version, + Icon: GetImageBase(icon), + Content: VersionCommit, + } +} + +func GetImageBase(bytes []byte) string { + return "data:image/jpeg;base64," + base64.StdEncoding.EncodeToString(bytes) +} + func GenNotificationMsg(stockInfo *data.StockInfo) string { Price, err := convertor.ToFloat(stockInfo.Price) if err != nil { diff --git a/backend/models/models.go b/backend/models/models.go index 3697526..d547d63 100644 --- a/backend/models/models.go +++ b/backend/models/models.go @@ -144,3 +144,16 @@ type AIResponseResult struct { func (receiver AIResponseResult) TableName() string { return "ai_response_result" } + +type VersionInfo struct { + gorm.Model + Version string `json:"version"` + Content string `json:"content"` + Icon string `json:"icon"` + BuildTimeStamp int64 `json:"buildTimeStamp"` + IsDel soft_delete.DeletedAt `gorm:"softDelete:flag"` +} + +func (receiver VersionInfo) TableName() string { + return "version_info" +} diff --git a/frontend/src/components/about.vue b/frontend/src/components/about.vue index 8f12e76..73f29cb 100644 --- a/frontend/src/components/about.vue +++ b/frontend/src/components/about.vue @@ -1,28 +1,87 @@ + + + + + + + + go-stock {{versionInfo}} + 自选股行情实时监控,基于Wails和NaiveUI构建的AI赋能股票分析工具 + + 欢迎点赞GitHub:go-stock + + + - - - go-stock - - 自选股行情实时监控,基于Wails和NaiveUI构建的AI赋能股票分析工具 - - 欢迎点赞GitHub:go-stock - - - - 关于作者 - - @ArvinLovegood - 一个热爱编程的小白,欢迎关注我的Github - - + + + + 更新说明 + + + + + + + 关于作者 + + @ArvinLovegood + 一个热爱编程的小白,欢迎关注我的Github + + + + + \ No newline at end of file +p { + margin: 2px 0; +} + +ul { + list-style-type: disc; + padding-left: 20px; +} + +a { + color: #18a058; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + diff --git a/frontend/wailsjs/go/main/App.d.ts b/frontend/wailsjs/go/main/App.d.ts index 3231ea6..3f84d6f 100644 --- a/frontend/wailsjs/go/main/App.d.ts +++ b/frontend/wailsjs/go/main/App.d.ts @@ -13,6 +13,8 @@ export function GetFollowList():Promise>; export function GetStockList(arg1:string):Promise>; +export function GetVersionInfo():Promise; + export function Greet(arg1:string):Promise; export function NewChat(arg1:string):Promise; diff --git a/frontend/wailsjs/go/main/App.js b/frontend/wailsjs/go/main/App.js index addc5ee..d9b62a7 100644 --- a/frontend/wailsjs/go/main/App.js +++ b/frontend/wailsjs/go/main/App.js @@ -22,6 +22,10 @@ export function GetStockList(arg1) { return window['go']['main']['App']['GetStockList'](arg1); } +export function GetVersionInfo() { + return window['go']['main']['App']['GetVersionInfo'](); +} + export function Greet(arg1) { return window['go']['main']['App']['Greet'](arg1); } diff --git a/frontend/wailsjs/go/models.ts b/frontend/wailsjs/go/models.ts index c32a511..c0689d6 100644 --- a/frontend/wailsjs/go/models.ts +++ b/frontend/wailsjs/go/models.ts @@ -378,6 +378,55 @@ export namespace models { return a; } } + export class VersionInfo { + ID: number; + // Go type: time + CreatedAt: any; + // Go type: time + UpdatedAt: any; + // Go type: gorm + DeletedAt: any; + version: string; + content: string; + icon: string; + buildTimeStamp: number; + IsDel: number; + + static createFrom(source: any = {}) { + return new VersionInfo(source); + } + + constructor(source: any = {}) { + if ('string' === typeof source) source = JSON.parse(source); + this.ID = source["ID"]; + this.CreatedAt = this.convertValues(source["CreatedAt"], null); + this.UpdatedAt = this.convertValues(source["UpdatedAt"], null); + this.DeletedAt = this.convertValues(source["DeletedAt"], null); + this.version = source["version"]; + this.content = source["content"]; + this.icon = source["icon"]; + this.buildTimeStamp = source["buildTimeStamp"]; + this.IsDel = source["IsDel"]; + } + + convertValues(a: any, classs: any, asMap: boolean = false): any { + if (!a) { + return a; + } + if (a.slice && a.map) { + return (a as any[]).map(elem => this.convertValues(elem, classs)); + } else if ("object" === typeof a) { + if (asMap) { + for (const key of Object.keys(a)) { + a[key] = new classs(a[key]); + } + return a; + } + return new classs(a); + } + return a; + } + } } diff --git a/main.go b/main.go index cccbd77..849b547 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,7 @@ var stocksBin []byte //go:generate cp -R ./data ./build/bin var Version string +var VersionCommit string func main() { checkDir("data") @@ -88,6 +89,7 @@ func main() { // runtime.Quit(app.ctx) //}) logger.NewDefaultLogger().Info("version: " + Version) + logger.NewDefaultLogger().Info("commit: " + VersionCommit) // Create application with options err := wails.Run(&options.App{ Title: "go-stock",
自选股行情实时监控,基于Wails和NaiveUI构建的AI赋能股票分析工具
+ 欢迎点赞GitHub:go-stock +
- 欢迎点赞GitHub:go-stock -
一个热爱编程的小白,欢迎关注我的Github