This commit is contained in:
sparkmemory 2024-12-23 07:34:58 +08:00
parent 9665462ae5
commit 29158f51af
2 changed files with 10 additions and 12 deletions

View File

@ -162,7 +162,7 @@ func NewStockDataApi() *StockDataApi {
}
func (receiver StockDataApi) GetStockBaseInfo() {
res := &TushareStockBasicResponse{}
_, err := receiver.client.R().
resp, err := receiver.client.R().
SetHeader("content-type", "application/json").
SetBody(&TushareRequest{
ApiName: "stock_basic",
@ -174,7 +174,7 @@ func (receiver StockDataApi) GetStockBaseInfo() {
Post(tushare_api_url)
//logger.SugaredLogger.Infof("GetStockBaseInfo %s", string(resp.Body()))
//resp.Body()写入文件
//ioutil.WriteFile("stock_basic.json", resp.Body(), 0666)
ioutil.WriteFile("stock_basic.json", resp.Body(), 0666)
//logger.SugaredLogger.Infof("GetStockBaseInfo %+v", res)
if err != nil {
logger.SugaredLogger.Error(err.Error())

18
main.go
View File

@ -9,12 +9,10 @@ import (
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
"github.com/wailsapp/wails/v2/pkg/runtime"
"go-stock/backend/data"
"go-stock/backend/db"
"log"
"os"
"time"
)
//go:embed frontend/dist
@ -42,14 +40,14 @@ func main() {
// Create an instance of the app structure
app := NewApp()
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
//定时更新数据
go func() {
for range ticker.C {
runtime.WindowSetTitle(app.ctx, "go-stock "+time.Now().Format("2006-01-02 15:04:05"))
}
}()
//ticker := time.NewTicker(time.Second)
//defer ticker.Stop()
////定时更新数据
//go func() {
// for range ticker.C {
// runtime.WindowSetTitle(app.ctx, "go-stock "+time.Now().Format("2006-01-02 15:04:05"))
// }
//}()
// Create application with options
err := wails.Run(&options.App{
Title: "go-stock",