2 Star 0 Fork 1

web-bird/bird

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
money.go 341 Bytes
一键复制 编辑 原始数据 按行查看 历史
悟道人 提交于 2020-03-04 21:05 +08:00 . 增加些小功能
package utils
import (
"github.com/shopspring/decimal"
)
//分转换为元
func MoneyFenToString(f int64) string {
d := decimal.NewFromInt(f)
return d.Div(decimal.NewFromInt(100)).String()
}
//将分输出成为 元
type Fen int64
func (d Fen) MarshalJSON() ([]byte, error) {
s := MoneyFenToString(int64(d))
return []byte(s), nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/web-bird/bird.git
git@gitee.com:web-bird/bird.git
web-bird
bird
bird
ac7d4c82d0c1

搜索帮助