🎨 添加图库和客服插件(有问题-待修改)

This commit is contained in:
2025-05-14 16:51:31 +08:00
parent 5faff4afa0
commit a5ae680f94
41 changed files with 2592 additions and 12 deletions

View File

@@ -0,0 +1,20 @@
package tools
import "time"
func FormatTimestamp(timestamp int64) string {
t := time.Unix(timestamp, 0)
now := time.Now()
// 格式化时间
if t.Year() == now.Year() && t.YearDay() == now.YearDay() {
// 当天,返回 24 小时制的时和分
return t.Format("15:04")
} else if t.Year() == now.Year() && t.YearDay() == now.YearDay()-1 {
// 昨天,返回 "昨天"
return "昨天"
} else {
// 其他时间,返回月和日
return t.Format("01-02")
}
}