feat: add account deletion, announcements and subscription renewal
Support personal records and persistent smoking visibility. Add upload quota preflight, file cleanup, privacy entry, image caching and revision-based page refresh across the backend, admin and mini program.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package wechat
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CheckinMessage matches template 15198: 留言内容、打卡时间、温馨提示。
|
||||
// Persist the note on the activity so immediate sends and retries use the same content.
|
||||
func CheckinMessage(title, note, timestamp string) map[string]string {
|
||||
content := strings.TrimSpace(note)
|
||||
if content == "" {
|
||||
content = title
|
||||
if !strings.HasPrefix(content, "打卡「") {
|
||||
content = "打卡「" + content + "」"
|
||||
}
|
||||
}
|
||||
// Database rows may use RFC3339; display all check-in times in China time.
|
||||
for _, layout := range []string{time.RFC3339Nano, "2006-01-02 15:04:05"} {
|
||||
if t, err := time.ParseInLocation(layout, timestamp, time.FixedZone("CST", 8*3600)); err == nil {
|
||||
timestamp = t.In(time.FixedZone("CST", 8*3600)).Format("2006年01月02日 15:04")
|
||||
break
|
||||
}
|
||||
}
|
||||
return normalizeSubscribeData(map[string]string{
|
||||
"thing1": content,
|
||||
"time2": timestamp,
|
||||
"thing3": "TA已完成打卡,点击看看吧",
|
||||
})
|
||||
}
|
||||
|
||||
// ReminderMessage adapts all activity notifications to the shared three-field
|
||||
// template. Legacy callers keep their content and landing page.
|
||||
func ReminderMessage(data map[string]string) map[string]string {
|
||||
if data["time2"] != "" {
|
||||
return normalizeSubscribeData(map[string]string{"thing1": data["thing1"], "time2": data["time2"], "thing3": data["thing3"]})
|
||||
}
|
||||
content := data["thing2"]
|
||||
if strings.TrimSpace(content) == "" {
|
||||
content = data["thing1"]
|
||||
}
|
||||
if strings.TrimSpace(content) == "" {
|
||||
content = "有新的记录"
|
||||
}
|
||||
stamp := data["event_time"]
|
||||
if stamp == "" {
|
||||
stamp = time.Now().In(time.FixedZone("CST", 8*3600)).Format("2006-01-02 15:04:05")
|
||||
}
|
||||
out := CheckinMessage("", content, stamp)
|
||||
out["thing3"] = data["thing4"]
|
||||
if strings.TrimSpace(out["thing3"]) == "" {
|
||||
out["thing3"] = "TA有新的动态,点击查看"
|
||||
}
|
||||
return normalizeSubscribeData(out)
|
||||
}
|
||||
Reference in New Issue
Block a user