fix: 修正金豆集市汇率计算与显示格式
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-23 06:41:34 +08:00
committed by cnb
parent 5773b8d182
commit ce3f1fc02e

View File

@@ -16,8 +16,8 @@ func startrobot() {
Handle(func(ctx *zero.Ctx) {
var msgs []string
for _, v := range service.NewGoldListService(0).Get() {
v.Rate = 1 / v.Rate
msgs = append(msgs, fmt.Sprintf("数量:%d 单价:%.2f 总价:%.2f", v.ExchangeNum, v.Rate, float64(v.ExchangeNum)*v.Rate))
msgs = append(msgs, fmt.Sprintf("数量:%d 汇率:%.2f 所需金币:%.2f", v.ExchangeNum, 1/v.Rate, float64(v.ExchangeNum)*v.Rate))
}
// ======================
@@ -40,7 +40,7 @@ func startrobot() {
// 标题
img.SetRGB255(44, 62, 80)
img.LoadFontFace("/opt/blazing/build/simhei.ttf", 20) // 黑体,解决中文乱码
img.DrawString("骄阳号金豆集市行情列表", padding, 30) //📊
img.DrawString("骄阳号金豆集市行情列表", padding, 30) //📊
// 画内容
img.SetRGB255(30, 30, 30)