From d0cf8768b41afab3df8d527b283b3a9c3c317f76 Mon Sep 17 00:00:00 2001 From: jager Date: Mon, 10 Jan 2022 11:47:03 +0800 Subject: [PATCH] add code to msg --- fund/fund.go | 4 ++-- stock/stock.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fund/fund.go b/fund/fund.go index 1bcabc3..dea89f2 100644 --- a/fund/fund.go +++ b/fund/fund.go @@ -87,7 +87,7 @@ func (f *fund) Msg() string { if err1 == nil && err2 == nil { rise = fmt.Sprintf("%.5f", cur-last) } - msg := fmt.Sprintf(msgTemplate, f.FName, f.UpdateTime, f.UnitVal, f.EstimateVal, rise, f.RisePer) + msg := fmt.Sprintf(msgTemplate, f.FName, f.Code, f.UpdateTime, f.UnitVal, f.EstimateVal, rise, f.RisePer) return msg } @@ -157,7 +157,7 @@ func NewFund(code string) (*fund, error) { return ff, err } -const msgTemplate = `%s +const msgTemplate = `%s(%s) 更新时间:%s 单位净值:%s 估算净值:%s 估算涨幅:(%s) %s%% diff --git a/stock/stock.go b/stock/stock.go index 514b481..eae47d8 100644 --- a/stock/stock.go +++ b/stock/stock.go @@ -146,7 +146,7 @@ func numFormat(num interface{}) string { func (s *stock) Msg() string { msg := fmt.Sprintf(msgTemplate, - s.values[0], + s.values[0], s.code, s.values[30], s.values[31], s.values[2], s.values[1], s.values[3], s.rise(), @@ -370,7 +370,7 @@ func getStockStr(codes []string) (string, error) { return string(body), nil } -const msgTemplate = `%s +const msgTemplate = `%s(%s) 更新时间:%s %s 昨收:%s 今开:%s 现价:%s 涨跌:%s