From 7952c1fceb32940b2e28aa9c24095fb69a93c322 Mon Sep 17 00:00:00 2001 From: ArvinLovegood Date: Mon, 24 Feb 2025 12:15:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(hk):=E6=9B=B4=E6=96=B0=E6=B8=AF=E8=82=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=94=AF=E6=8C=81=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=96=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新 README.md,添加 ETF 和美股支持计划 - 修改 stock.vue,增加弹幕相关图标和功能 - 更新 stock_data_api.go,添加股票价格时间信息 - 修改 stock_data_api_test.go,更新测试用例 --- README.md | 16 +++++++++------- backend/data/stock_data_api.go | 11 +++++++++-- backend/data/stock_data_api_test.go | 2 +- frontend/src/components/stock.vue | 15 ++++++++++++--- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 67e7c31..aa20f22 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,19 @@ - 欢迎大家提出宝贵的建议,欢迎提issue,PR。当然更欢迎[赞助我](#都划到这了如果我的项目对您有帮助请赞助我吧)。💕 -## 🧩 功能开发计划 -| 功能说明 | 状态 | 备注 | -|-----------------|----|---------------------------------------------------------------------------------------------------------| -| 港股支持 | ✅ | 港股数据支持 | -| 多轮对话 | ✅ | AI分析后可继续对话提问 | +## 🧩 重大功能开发计划 +| 功能说明 | 状态 | 备注 | +|-----------------|----|--------------------------------------------------------------------------------------------------------| +| ETF支持 | 🚧 | ETF数据支持 | +| 美股支持 | 🚧 | 美股数据支持 | +| 港股支持 | ✅ | 港股数据支持 | +| 多轮对话 | ✅ | AI分析后可继续对话提问 | | 自定义AI分析提问模板 | ✅ | 可配置的提问模板 [v2025.2.12.7-alpha](https://github.com/ArvinLovegood/go-stock/releases/tag/v2025.2.12.7-alpha) | -| 不再强制依赖Chrome浏览器 | ✅ | 默认使用edge浏览器抓取新闻资讯 | +| 不再强制依赖Chrome浏览器 | ✅ | 默认使用edge浏览器抓取新闻资讯 | ## 👀 更新日志 ### 2025.02.23 弹幕功能,盯盘不再孤单,无聊划个水!😎 -### 2025.02.22 港股数据支持 +### 2025.02.22 港股数据支持(目前有延迟) ### 2025.02.16 AI分析后可继续对话提问 - [v2025.2.16.1-alpha](https://github.com/ArvinLovegood/go-stock/releases/tag/v2025.2.16.1-alpha) diff --git a/backend/data/stock_data_api.go b/backend/data/stock_data_api.go index c0a3b12..20ecd39 100644 --- a/backend/data/stock_data_api.go +++ b/backend/data/stock_data_api.go @@ -620,6 +620,7 @@ func getHKStockPriceInfo(stockCode string, crawlTimeOut int64) *[]string { } stockName := "" stockPrice := "" + stockPriceTime := "" document.Find("#stock_cname").Each(func(i int, selection *goquery.Selection) { stockName = strutil.RemoveNonPrintable(selection.Text()) logger.SugaredLogger.Infof("股票名称-:%s", stockName) @@ -627,10 +628,16 @@ func getHKStockPriceInfo(stockCode string, crawlTimeOut int64) *[]string { document.Find("#mts_stock_hk_price").Each(func(i int, selection *goquery.Selection) { stockPrice = strutil.RemoveNonPrintable(selection.Text()) - logger.SugaredLogger.Infof("股票名称-现价: %s", stockPrice) + logger.SugaredLogger.Infof("现价: %s", stockPrice) }) - messages = append(messages, fmt.Sprintf("%s现价%s", stockName, stockPrice)) + document.Find("#mts_stock_hk_time").Each(func(i int, selection *goquery.Selection) { + stockPriceTime = strutil.RemoveNonPrintable(selection.Text()) + logger.SugaredLogger.Infof("时间: %s", stockPriceTime) + }) + + messages = append(messages, fmt.Sprintf("%s:%s现价%s", stockPriceTime, stockName, stockPrice)) + logger.SugaredLogger.Infof("股票: %s", messages) document.Find(".deta_hqContainer >.deta03 li").Each(func(i int, selection *goquery.Selection) { text := strutil.RemoveNonPrintable(selection.Text()) diff --git a/backend/data/stock_data_api_test.go b/backend/data/stock_data_api_test.go index a4351c5..28c793e 100644 --- a/backend/data/stock_data_api_test.go +++ b/backend/data/stock_data_api_test.go @@ -43,7 +43,7 @@ func TestSearchStockInfoByCode(t *testing.T) { } func TestSearchStockPriceInfo(t *testing.T) { - SearchStockPriceInfo("hk00927", 30) + SearchStockPriceInfo("hk06030", 30) //SearchStockPriceInfo("sh600859", 30) } diff --git a/frontend/src/components/stock.vue b/frontend/src/components/stock.vue index af8b476..b1db7b1 100644 --- a/frontend/src/components/stock.vue +++ b/frontend/src/components/stock.vue @@ -30,7 +30,15 @@ import { useNotification } from 'naive-ui' import {EventsEmit, EventsOn, WindowFullscreen, WindowReload, WindowUnfullscreen} from '../../wailsjs/runtime' -import {Add, BalloonOutline} from '@vicons/ionicons5' +import { + Add, + Balloon, + BalloonOutline, ChatboxOutline, ChatbubbleEllipses, + ChatbubbleEllipsesOutline, + ChatbubbleOutline, + Chatbubbles, + ChatbubblesSharp +} from '@vicons/ionicons5' import {MdPreview,MdEditor } from 'md-editor-v3'; // preview.css相比style.css少了编辑器那部分样式 //import 'md-editor-v3/lib/preview.css'; @@ -148,6 +156,7 @@ onMounted(() => { }); // 创建 WebSocket 连接 ws.value = new WebSocket('ws://8.134.249.145:16688/ws'); // 替换为你的 WebSocket 服务器地址 + //ws.value = new WebSocket('ws://localhost:16688/ws'); // 替换为你的 WebSocket 服务器地址 ws.value.onopen = () => { console.log('WebSocket 连接已打开'); @@ -797,8 +806,8 @@ AI赋能股票分析:自选股行情获取,成本盈亏展示,涨跌报警  关注该股票 - -  发送弹幕 + +  发送弹幕