按桌面past-go原样同步首页样式与后端通知逻辑

This commit is contained in:
2026-10-11 09:16:38 +08:00
parent 4e751410b3
commit 5365e13963
6 changed files with 69 additions and 9 deletions
+5 -2
View File
@@ -20,6 +20,7 @@ const (
var actionTypes = []string{
"login", "timeline_create", "album_create", "photo_upload", "diary_create", "diary_comment_add",
"song_add", "checkin_do", "period_add", "period_sex_add", "pet_adopt", "pet_daily", "pet_rename", "pet_all_done",
"couple_bind", "smoking_consume",
}
var actionLabels = map[string]string{
@@ -27,6 +28,7 @@ var actionLabels = map[string]string{
"diary_create": "写了新的日记", "diary_comment_add": "评论了日记", "song_add": "添加了新歌曲", "checkin_do": "完成了打卡",
"period_add": "记录了姨妈期", "period_sex_add": "记录了亲密时光", "pet_adopt": "领养了新宠物", "pet_daily": "照顾了宠物",
"pet_rename": "给宠物改了名", "pet_all_done": "完成了所有宠物任务",
"couple_bind": "同意了你的邀请", "smoking_consume": "记录了抽烟",
}
var pageMap = map[string]string{
@@ -35,6 +37,7 @@ var pageMap = map[string]string{
"song_add": "pages/lovewords/lovewords", "checkin_do": "pages/punch/punch", "period_add": "pages/period/period",
"period_sex_add": "pages/period/period", "pet_adopt": "pages/pet/pet", "pet_daily": "pages/pet/pet",
"pet_rename": "pages/pet/pet", "pet_all_done": "pages/pet/pet",
"couple_bind": "pages/index/index", "smoking_consume": "pages/punch/punch",
}
func mbSub(s string, n int) string {
@@ -70,9 +73,9 @@ func Once(db *store.DB, wx *wechat.Client, force bool) {
}
var sql string
if force {
sql = "SELECT a.*, u.nickname, u.couple_id as user_couple_id FROM activity_log a JOIN users u ON a.user_id = u.id WHERE a.action_type IN (" + ph + ") AND a.id NOT IN (SELECT nl.activity_id FROM notify_log nl WHERE nl.status = 'success') AND a.couple_id IS NOT NULL ORDER BY a.created_at DESC LIMIT 20"
sql = "SELECT a.*, u.nickname, u.couple_id as user_couple_id FROM activity_log a JOIN users u ON a.user_id = u.id WHERE a.action_type IN (" + ph + ") AND a.id NOT IN (SELECT nl.activity_id FROM notify_log nl) AND a.couple_id IS NOT NULL ORDER BY a.created_at DESC LIMIT 20"
} else {
sql = "SELECT a.*, u.nickname, u.couple_id as user_couple_id FROM activity_log a JOIN users u ON a.user_id = u.id WHERE a.action_type IN (" + ph + ") AND a.created_at >= ? AND a.id NOT IN (SELECT nl.activity_id FROM notify_log nl WHERE nl.status = 'success') AND a.couple_id IS NOT NULL ORDER BY a.created_at DESC LIMIT 20"
sql = "SELECT a.*, u.nickname, u.couple_id as user_couple_id FROM activity_log a JOIN users u ON a.user_id = u.id WHERE a.action_type IN (" + ph + ") AND a.created_at >= ? AND a.id NOT IN (SELECT nl.activity_id FROM notify_log nl) AND a.couple_id IS NOT NULL ORDER BY a.created_at DESC LIMIT 20"
args = append(args, time.Now().Add(-scanMinutes*time.Minute).Format("2006-01-02 15:04:05"))
}
activities, err := db.Query(sql, args...)