From 86f041b4d67a515bced2746c08a5b76db5bf465b Mon Sep 17 00:00:00 2001 From: ArvinLovegood Date: Fri, 27 Jun 2025 17:46:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=E6=B7=BB=E5=8A=A0=E8=B4=A2?= =?UTF-8?q?=E7=BB=8F=E6=97=A5=E5=8E=86=E5=92=8C=E9=87=8D=E5=A4=A7=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E9=97=B4=E8=BD=B4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 App.d.ts 和 App.js 中添加了 ClsCalendar 和 InvestCalendarTimeLine 函数 - 在 app_common.go 中实现了对应的后端逻辑 - 新增了 InvestCalendarTimeLine 和 ClsCalendarTimeLine组件用于展示数据 - 更新了 market.vue 中的 tabs,添加了新功能的页面 --- README.md | 1 + app_common.go | 7 ++ backend/data/market_news_api.go | 49 ++++++++ backend/data/market_news_api_test.go | 16 +++ frontend/package-lock.json | 20 +++- frontend/package.json | 1 + frontend/package.json.md5 | 2 +- .../src/components/ClsCalendarTimeLine.vue | 102 +++++++++++++++++ .../src/components/InvestCalendarTimeLine.vue | 108 ++++++++++++++++++ frontend/src/components/market.vue | 8 ++ frontend/wailsjs/go/main/App.d.ts | 4 + frontend/wailsjs/go/main/App.js | 8 ++ 12 files changed, 321 insertions(+), 5 deletions(-) create mode 100644 frontend/src/components/ClsCalendarTimeLine.vue create mode 100644 frontend/src/components/InvestCalendarTimeLine.vue diff --git a/README.md b/README.md index 925455b..e6c8e8d 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ | 不再强制依赖Chrome浏览器 | ✅ | 默认使用edge浏览器抓取新闻资讯 | ## 👀 更新日志 +### 2025.06.27 添加财经日历和重大事件时间轴功能 ### 2025.06.25 添加热门股票、事件和话题功能 ### 2025.06.18 更新内置股票基础数据,软件内实时市场资讯信息提醒,添加行业研究功能 ### 2025.06.15 添加公司公告信息搜索/查看功能 diff --git a/app_common.go b/app_common.go index 7a9f6f0..600668e 100644 --- a/app_common.go +++ b/app_common.go @@ -48,3 +48,10 @@ func (a App) HotTopic(size int) []any { } return data.NewMarketNewsApi().HotTopic(size) } + +func (a App) InvestCalendarTimeLine(yearMonth string) []any { + return data.NewMarketNewsApi().InvestCalendar(yearMonth) +} +func (a App) ClsCalendar() []any { + return data.NewMarketNewsApi().ClsCalendar() +} diff --git a/backend/data/market_news_api.go b/backend/data/market_news_api.go index 0a55591..7cc91aa 100644 --- a/backend/data/market_news_api.go +++ b/backend/data/market_news_api.go @@ -643,3 +643,52 @@ func (m MarketNewsApi) HotTopic(size int) []any { return respMap["re"].([]any) } + +func (m MarketNewsApi) InvestCalendar(yearMonth string) []any { + if yearMonth == "" { + yearMonth = time.Now().Format("2006-01") + } + + url := "https://app.jiuyangongshe.com/jystock-app/api/v1/timeline/list" + resp, err := resty.New().SetTimeout(time.Duration(30)*time.Second).R(). + SetHeader("Host", "app.jiuyangongshe.com"). + SetHeader("Origin", "https://www.jiuyangongshe.com"). + SetHeader("Referer", "https://www.jiuyangongshe.com/"). + SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0"). + SetHeader("Content-Type", "application/json"). + SetHeader("token", "1cc6380a05c652b922b3d85124c85473"). + SetHeader("platform", "3"). + SetHeader("Cookie", "SESSION=NDZkNDU2ODYtODEwYi00ZGZkLWEyY2ItNjgxYzY4ZWMzZDEy"). + SetHeader("timestamp", strconv.FormatInt(time.Now().UnixMilli(), 10)). + SetBody(map[string]string{ + "date": yearMonth, + "grade": "0", + }). + Post(url) + if err != nil { + logger.SugaredLogger.Errorf("InvestCalendar err:%s", err.Error()) + return []any{} + } + //logger.SugaredLogger.Infof("InvestCalendar:%s", resp.Body()) + respMap := map[string]any{} + err = json.Unmarshal(resp.Body(), &respMap) + return respMap["data"].([]any) + +} + +func (m MarketNewsApi) ClsCalendar() []any { + url := "https://www.cls.cn/api/calendar/web/list?app=CailianpressWeb&flag=0&os=web&sv=8.4.6&type=0&sign=4b839750dc2f6b803d1c8ca00d2b40be" + resp, err := resty.New().SetTimeout(time.Duration(30)*time.Second).R(). + SetHeader("Host", "www.cls.cn"). + SetHeader("Origin", "https://www.cls.cn"). + SetHeader("Referer", "https://www.cls.cn/"). + SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0"). + Get(url) + if err != nil { + logger.SugaredLogger.Errorf("ClsCalendar err:%s", err.Error()) + return []any{} + } + respMap := map[string]any{} + err = json.Unmarshal(resp.Body(), &respMap) + return respMap["data"].([]any) +} diff --git a/backend/data/market_news_api_test.go b/backend/data/market_news_api_test.go index d6279bd..9f24c16 100644 --- a/backend/data/market_news_api_test.go +++ b/backend/data/market_news_api_test.go @@ -135,3 +135,19 @@ func TestHotTopic(t *testing.T) { } } + +func TestInvestCalendar(t *testing.T) { + db.Init("../../data/stock.db") + res := NewMarketNewsApi().InvestCalendar("2025-06") + for _, a := range res { + logger.SugaredLogger.Debugf("value: %+v", a) + } +} + +func TestClsCalendar(t *testing.T) { + db.Init("../../data/stock.db") + res := NewMarketNewsApi().ClsCalendar() + for _, a := range res { + logger.SugaredLogger.Debugf("value: %+v", a) + } +} diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f7836cc..abf5ea7 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,6 +11,7 @@ "@types/file-saver": "^2.0.7", "@vavt/cm-extension": "^1.8.0", "@vavt/v3-extension": "^3.0.0", + "date-fns": "^4.1.0", "echarts": "^5.6.0", "file-saver": "^2.0.5", "html2canvas": "^1.4.1", @@ -1717,10 +1718,10 @@ "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, "node_modules/date-fns": { - "version": "3.6.0", - "resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-3.6.0.tgz", - "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", - "dev": true, + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/kossnocorp" @@ -2066,6 +2067,17 @@ "vue": "^3.0.0" } }, + "node_modules/naive-ui/node_modules/date-fns": { + "version": "3.6.0", + "resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-3.6.0.tgz", + "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/nanoid": { "version": "3.3.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", diff --git a/frontend/package.json b/frontend/package.json index 24e27d5..ebc6914 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,7 @@ "@types/file-saver": "^2.0.7", "@vavt/cm-extension": "^1.8.0", "@vavt/v3-extension": "^3.0.0", + "date-fns": "^4.1.0", "echarts": "^5.6.0", "file-saver": "^2.0.5", "html2canvas": "^1.4.1", diff --git a/frontend/package.json.md5 b/frontend/package.json.md5 index 018b90a..fce852e 100644 --- a/frontend/package.json.md5 +++ b/frontend/package.json.md5 @@ -1 +1 @@ -f64f2faecc1cae8baa43eca694be54ac \ No newline at end of file +2d63c3a999d797889c01d6c96451b197 \ No newline at end of file diff --git a/frontend/src/components/ClsCalendarTimeLine.vue b/frontend/src/components/ClsCalendarTimeLine.vue new file mode 100644 index 0000000..c823298 --- /dev/null +++ b/frontend/src/components/ClsCalendarTimeLine.vue @@ -0,0 +1,102 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/InvestCalendarTimeLine.vue b/frontend/src/components/InvestCalendarTimeLine.vue new file mode 100644 index 0000000..54d8b3d --- /dev/null +++ b/frontend/src/components/InvestCalendarTimeLine.vue @@ -0,0 +1,108 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/market.vue b/frontend/src/components/market.vue index c41038e..0cc74e0 100644 --- a/frontend/src/components/market.vue +++ b/frontend/src/components/market.vue @@ -29,6 +29,8 @@ import IndustryResearchReportList from "./IndustryResearchReportList.vue"; import HotStockList from "./HotStockList.vue"; import HotEvents from "./HotEvents.vue"; import HotTopics from "./HotTopics.vue"; +import InvestCalendarTimeLine from "./InvestCalendarTimeLine.vue"; +import ClsCalendarTimeLine from "./ClsCalendarTimeLine.vue"; const route = useRoute() const icon = ref('https://raw.githubusercontent.com/ArvinLovegood/go-stock/master/build/appicon.png'); @@ -584,6 +586,12 @@ function ReFlesh(source) { + + + + + + diff --git a/frontend/wailsjs/go/main/App.d.ts b/frontend/wailsjs/go/main/App.d.ts index 2f4754b..bc9d171 100644 --- a/frontend/wailsjs/go/main/App.d.ts +++ b/frontend/wailsjs/go/main/App.d.ts @@ -15,6 +15,8 @@ export function AnalyzeSentiment(arg1:string):Promise; export function CheckUpdate():Promise; +export function ClsCalendar():Promise>; + export function DelPrompt(arg1:number):Promise; export function EMDictCode(arg1:string):Promise>; @@ -73,6 +75,8 @@ export function HotTopic(arg1:number):Promise>; export function IndustryResearchReport(arg1:string):Promise>; +export function InvestCalendarTimeLine(arg1:string):Promise>; + export function LongTigerRank(arg1:string):Promise; export function NewChatStream(arg1:string,arg2:string,arg3:string,arg4:any):Promise; diff --git a/frontend/wailsjs/go/main/App.js b/frontend/wailsjs/go/main/App.js index 0e93c54..2259069 100644 --- a/frontend/wailsjs/go/main/App.js +++ b/frontend/wailsjs/go/main/App.js @@ -26,6 +26,10 @@ export function CheckUpdate() { return window['go']['main']['App']['CheckUpdate'](); } +export function ClsCalendar() { + return window['go']['main']['App']['ClsCalendar'](); +} + export function DelPrompt(arg1) { return window['go']['main']['App']['DelPrompt'](arg1); } @@ -142,6 +146,10 @@ export function IndustryResearchReport(arg1) { return window['go']['main']['App']['IndustryResearchReport'](arg1); } +export function InvestCalendarTimeLine(arg1) { + return window['go']['main']['App']['InvestCalendarTimeLine'](arg1); +} + export function LongTigerRank(arg1) { return window['go']['main']['App']['LongTigerRank'](arg1); }