feat: 商业认证完整流程 + 通知时间过滤
商业认证: - 申请页重写:商户名+说明字段,显示审核中/被拒/已通过状态 - 被拒绝显示原因,可重新申请 - 管理员拒绝时输入原因 - 商业核算页未认证用户点详情弹认证提示,跳转认证页面 - 删除项目仅管理员可见 通知: - 只显示用户注册后的通知,避免角色变更后看到旧通知 - 搜索未收录通知只发管理员和高级编辑者 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1420,11 +1420,15 @@ def get_notifications(user=Depends(get_current_user)):
|
||||
if not user["id"]:
|
||||
return []
|
||||
conn = get_db()
|
||||
# Only show notifications created after user registration
|
||||
user_created = conn.execute("SELECT created_at FROM users WHERE id = ?", (user["id"],)).fetchone()
|
||||
created_at = user_created["created_at"] if user_created else "2000-01-01"
|
||||
rows = conn.execute(
|
||||
"SELECT id, title, body, is_read, created_at FROM notifications "
|
||||
"WHERE (target_user_id = ? OR (target_user_id IS NULL AND (target_role = ? OR target_role = 'all'))) "
|
||||
"AND created_at >= ? "
|
||||
"ORDER BY is_read ASC, id DESC LIMIT 200",
|
||||
(user["id"], user["role"])
|
||||
(user["id"], user["role"], created_at)
|
||||
).fetchall()
|
||||
conn.close()
|
||||
return [dict(r) for r in rows]
|
||||
|
||||
Reference in New Issue
Block a user