diff --git a/app.go b/app.go index b3192c3..87c2903 100644 --- a/app.go +++ b/app.go @@ -1131,3 +1131,8 @@ func (a *App) GetMoneyRankSina(sort string) []map[string]any { res := data.NewMarketNewsApi().GetMoneyRankSina(sort) return res } + +func (a *App) GetStockMoneyTrendByDay(stockCode string, days int) []map[string]any { + res := data.NewMarketNewsApi().GetStockMoneyTrendByDay(stockCode, days) + return res +} diff --git a/backend/data/market_news_api.go b/backend/data/market_news_api.go index 801ad19..015101c 100644 --- a/backend/data/market_news_api.go +++ b/backend/data/market_news_api.go @@ -275,3 +275,21 @@ func (m MarketNewsApi) GetMoneyRankSina(sort string) []map[string]any { } return *res } + +func (m MarketNewsApi) GetStockMoneyTrendByDay(stockCode string, days int) []map[string]any { + url := fmt.Sprintf("http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/MoneyFlow.ssl_qsfx_zjlrqs?page=1&num=%d&sort=opendate&asc=0&daima=%s", days, stockCode) + + response, _ := resty.New().SetTimeout(time.Duration(5)*time.Second).R(). + SetHeader("Host", "vip.stock.finance.sina.com.cn"). + SetHeader("Referer", "https://finance.sina.com.cn"). + SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.60").Get(url) + js := string(response.Body()) + res := &[]map[string]any{} + err := json.Unmarshal([]byte(js), &res) + if err != nil { + logger.SugaredLogger.Error(err) + return *res + } + return *res + +} diff --git a/backend/data/market_news_api_test.go b/backend/data/market_news_api_test.go index 31fd7aa..ee51597 100644 --- a/backend/data/market_news_api_test.go +++ b/backend/data/market_news_api_test.go @@ -49,3 +49,10 @@ func TestGetMoneyRankSina(t *testing.T) { } } + +func TestGetStockMoneyTrendByDay(t *testing.T) { + res := NewMarketNewsApi().GetStockMoneyTrendByDay("sh600438", 120) + for i, re := range res { + logger.SugaredLogger.Debugf("key: %+v, value: %+v", i, re) + } +} diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 1a5338c..15fea9c 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -446,7 +446,7 @@ onBeforeMount(() => { }) onMounted(() => { - contentStyle.value = "max-height: calc(90vh);overflow: hidden" + contentStyle.value = "max-height: calc(92vh);overflow: hidden" GetConfig().then((res) => { if (res.enableNews) { enableNews.value = true @@ -488,6 +488,7 @@ onMounted(() => { + diff --git a/frontend/src/components/moneyTrend.vue b/frontend/src/components/moneyTrend.vue new file mode 100644 index 0000000..2f67fb8 --- /dev/null +++ b/frontend/src/components/moneyTrend.vue @@ -0,0 +1,279 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/stock.vue b/frontend/src/components/stock.vue index bc65e9e..828efd3 100644 --- a/frontend/src/components/stock.vue +++ b/frontend/src/components/stock.vue @@ -63,6 +63,7 @@ import {asBlob} from 'html-docx-js-typescript'; import vueDanmaku from 'vue3-danmaku' import {keys, pad, padStart} from "lodash"; import {useRoute, useRouter} from 'vue-router' +import MoneyTrend from "./moneyTrend.vue"; const route = useRoute() const router = useRouter() @@ -98,6 +99,7 @@ const modalShow = ref(false) const modalShow2 = ref(false) const modalShow3 = ref(false) const modalShow4 = ref(false) +const modalShow5 = ref(false) const addBTN = ref(true) const formModel = ref({ name: "", @@ -1241,6 +1243,12 @@ function handleKLine(){ }); }) } +function showMoney(code,name){ + data.code=code + data.name=name + modalShow5.value=true +} + function showK(code,name){ data.code=code data.name=name @@ -1710,6 +1718,8 @@ function delStockGroup(code,name,groupId){ 成本 分时 日K + 资金 + 详情 设置分组 @@ -1821,6 +1831,8 @@ function delStockGroup(code,name,groupId){ 成本 分时 日K + 资金 + 详情 设置分组 @@ -1988,6 +2000,9 @@ function delStockGroup(code,name,groupId){ + + +