当用户访问链接时授予徽章

如果它是在特定帖子中共享的特定链接,我认为这个链接可以做到:

SELECT DISTINCT tlc.user_id, MIN(tlc.created_at) granted_at
FROM badge_posts p
  LEFT JOIN topic_links tl ON tl.post_id = p.id
  LEFT JOIN topic_link_clicks tlc ON tlc.topic_link_id = tl.id
WHERE tl.post_id = 1246
  AND tl.url = 'https://meta.discourse.org/'
  AND tlc.user_id IS NOT NULL
GROUP BY tlc.user_id

您需要从特定帖子的 JSON 中获取 post_id(或通过数据浏览器进行查找)。

2 个赞