mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
fix(stock):修复北交所股票AI分析时,股价获取失败的问题
- 在 SearchStockPriceInfo 函数中增加了对北交所股票代码的处理逻辑 - 更新了测试用例,添加了北交所股票的测试 - 调整了前端组件的样式
This commit is contained in:
parent
b4c513a585
commit
8673796919
@ -23,6 +23,7 @@ func TestGetTopNewsList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchGuShiTongStockInfo(t *testing.T) {
|
||||
db.Init("../../data/stock.db")
|
||||
SearchGuShiTongStockInfo("hk01810", 60)
|
||||
SearchGuShiTongStockInfo("sh600745", 60)
|
||||
SearchGuShiTongStockInfo("gb_goog", 60)
|
||||
|
@ -748,7 +748,14 @@ func GetRealTimeStockPriceInfo(ctx context.Context, stockCode string) (price, pr
|
||||
|
||||
func SearchStockPriceInfo(stockCode string, crawlTimeOut int64) *[]string {
|
||||
|
||||
if strutil.HasPrefixAny(stockCode, []string{"SZ", "SH", "sh", "sz"}) {
|
||||
if strutil.HasPrefixAny(stockCode, []string{"SZ", "SH", "sh", "sz", "bj"}) {
|
||||
if strutil.HasPrefixAny(stockCode, []string{"bj", "BJ"}) {
|
||||
stockCode = strutil.ReplaceWithMap(stockCode, map[string]string{
|
||||
"bj": "",
|
||||
"BJ": "",
|
||||
}) + ".BJ"
|
||||
}
|
||||
|
||||
return getSHSZStockPriceInfo(stockCode, crawlTimeOut)
|
||||
}
|
||||
if strutil.HasPrefixAny(stockCode, []string{"HK", "hk"}) {
|
||||
|
@ -46,9 +46,11 @@ func TestSearchStockInfoByCode(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchStockPriceInfo(t *testing.T) {
|
||||
db.Init("../../data/stock.db")
|
||||
//SearchStockPriceInfo("hk06030", 30)
|
||||
//SearchStockPriceInfo("sh600171", 30)
|
||||
SearchStockPriceInfo("gb_aapl", 30)
|
||||
//SearchStockPriceInfo("gb_aapl", 30)
|
||||
SearchStockPriceInfo("bj430198", 30)
|
||||
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ function blinkBorder(findId){
|
||||
<vue-danmaku v-model:danmus="danmus" style="height:100px; width:100%;z-index: 9;position:absolute; top: 400px; pointer-events: none;" ></vue-danmaku>
|
||||
<n-flex justify="start" >
|
||||
<n-grid :x-gap="8" :cols="3" :y-gap="8" >
|
||||
<n-gi :id="info.code+'_gi'" v-for="info in followList" style="margin-left: 2px" onmouseover="this.style.border='1px solid #3498db' " onmouseout="this.style.border='0px'">
|
||||
<n-gi :id="info.code+'_gi'" v-for="info in followList" style="margin-left: 2px" >
|
||||
<n-card :id="info.code" :title="formatterTitle(info.name)">
|
||||
<template #header-extra>
|
||||
<n-tag size="small" :bordered="false" type="info">{{info.code}}</n-tag>
|
||||
|
@ -817,7 +817,7 @@ function share(code,name){
|
||||
<template>
|
||||
<vue-danmaku v-model:danmus="danmus" style="height:100px; width:100%;z-index: 9;position:absolute; top: 400px; pointer-events: none;" ></vue-danmaku>
|
||||
<n-grid :x-gap="8" :cols="3" :y-gap="8" >
|
||||
<n-gi :id="result['股票代码']+'_gi'" v-for="result in sortedResults" style="margin-left: 2px;" onmouseover="this.style.border='1px solid #3498db' " onmouseout="this.style.border='1px'">
|
||||
<n-gi :id="result['股票代码']+'_gi'" v-for="result in sortedResults" style="margin-left: 2px;" >
|
||||
<n-card :id="result['股票代码']" :data-code="result['股票代码']" :bordered="false" :title="result['股票名称']" :closable="false" @close="removeMonitor(result['股票代码'],result['股票名称'],result.key)">
|
||||
<n-grid :cols="1" :y-gap="6">
|
||||
<n-gi>
|
||||
|
Loading…
x
Reference in New Issue
Block a user