mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
feat(frontend):添加股票分析分享功能
- 在 App.d.ts 中添加 ShareAnalysis 函数声明 - 在 app.go 中实现 ShareAnalysis 方法,用于获取股票分析结果并上传 - 在 App.js 中添加 ShareAnalysis 函数的 JavaScript 调用接口 - 在 stock.vue 中添加分享按钮和相关逻辑,实现股票分析结果的分享功能
This commit is contained in:
parent
ec7534ff2c
commit
6f6884c18a
20
app.go
20
app.go
@ -711,3 +711,23 @@ func getScreenResolution() (int, int, error) {
|
|||||||
|
|
||||||
return int(width), int(height), nil
|
return int(width), int(height), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) ShareAnalysis(stockCode, stockName string) string {
|
||||||
|
//http://go-stock.sparkmemory.top:16688/upload
|
||||||
|
res := data.NewDeepSeekOpenAi(a.ctx).GetAIResponseResult(stockCode)
|
||||||
|
if res != nil {
|
||||||
|
analysisTime := res.CreatedAt.Format("2006/01/02")
|
||||||
|
logger.SugaredLogger.Infof("%s analysisTime:%s", res.CreatedAt, analysisTime)
|
||||||
|
response, err := resty.New().SetHeader("ua-x", "go-stock").R().SetFormData(map[string]string{
|
||||||
|
"text": res.Content,
|
||||||
|
"stockCode": stockCode,
|
||||||
|
"stockName": stockName,
|
||||||
|
"analysisTime": analysisTime,
|
||||||
|
}).Post("http://go-stock.sparkmemory.top:16688/upload")
|
||||||
|
if err != nil {
|
||||||
|
return err.Error()
|
||||||
|
}
|
||||||
|
return response.String()
|
||||||
|
}
|
||||||
|
return "获取分析结果失败"
|
||||||
|
}
|
||||||
|
@ -14,7 +14,8 @@ import {
|
|||||||
SetAlarmChangePercent,
|
SetAlarmChangePercent,
|
||||||
SetCostPriceAndVolume,
|
SetCostPriceAndVolume,
|
||||||
SetStockSort,
|
SetStockSort,
|
||||||
UnFollow
|
UnFollow,
|
||||||
|
ShareAnalysis
|
||||||
} from '../../wailsjs/go/main/App'
|
} from '../../wailsjs/go/main/App'
|
||||||
import {
|
import {
|
||||||
NAvatar,
|
NAvatar,
|
||||||
@ -753,6 +754,12 @@ AI赋能股票分析:自选股行情获取,成本盈亏展示,涨跌报警
|
|||||||
URL.revokeObjectURL(a.href);
|
URL.revokeObjectURL(a.href);
|
||||||
a.remove()
|
a.remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function share(code,name){
|
||||||
|
ShareAnalysis(code,name).then(msg => {
|
||||||
|
message.info(msg)
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -926,6 +933,7 @@ AI赋能股票分析:自选股行情获取,成本盈亏展示,涨跌报警
|
|||||||
<n-button size="tiny" type="success" @click="copyToClipboard">复制到剪切板</n-button>
|
<n-button size="tiny" type="success" @click="copyToClipboard">复制到剪切板</n-button>
|
||||||
<n-button size="tiny" type="primary" @click="saveAsMarkdown">保存为Markdown文件</n-button>
|
<n-button size="tiny" type="primary" @click="saveAsMarkdown">保存为Markdown文件</n-button>
|
||||||
<n-button size="tiny" type="primary" @click="saveAsWord">保存为Word文件</n-button>
|
<n-button size="tiny" type="primary" @click="saveAsWord">保存为Word文件</n-button>
|
||||||
|
<n-button size="tiny" type="error" @click="share(data.code,data.name)">分享到项目社区</n-button>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</template>
|
</template>
|
||||||
</n-modal>
|
</n-modal>
|
||||||
|
2
frontend/wailsjs/go/main/App.d.ts
vendored
2
frontend/wailsjs/go/main/App.d.ts
vendored
@ -35,6 +35,8 @@ export function SetCostPriceAndVolume(arg1:string,arg2:number,arg3:number):Promi
|
|||||||
|
|
||||||
export function SetStockSort(arg1:number,arg2:string):Promise<void>;
|
export function SetStockSort(arg1:number,arg2:string):Promise<void>;
|
||||||
|
|
||||||
|
export function ShareAnalysis(arg1:string,arg2:string):Promise<string>;
|
||||||
|
|
||||||
export function UnFollow(arg1:string):Promise<string>;
|
export function UnFollow(arg1:string):Promise<string>;
|
||||||
|
|
||||||
export function UpdateConfig(arg1:data.Settings):Promise<string>;
|
export function UpdateConfig(arg1:data.Settings):Promise<string>;
|
||||||
|
@ -66,6 +66,10 @@ export function SetStockSort(arg1, arg2) {
|
|||||||
return window['go']['main']['App']['SetStockSort'](arg1, arg2);
|
return window['go']['main']['App']['SetStockSort'](arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ShareAnalysis(arg1, arg2) {
|
||||||
|
return window['go']['main']['App']['ShareAnalysis'](arg1, arg2);
|
||||||
|
}
|
||||||
|
|
||||||
export function UnFollow(arg1) {
|
export function UnFollow(arg1) {
|
||||||
return window['go']['main']['App']['UnFollow'](arg1);
|
return window['go']['main']['App']['UnFollow'](arg1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user