Skip to content

Affiliate & Giới thiệu ​

Trang sinh tự động

Phần nghiệp vụ viết tay; API, dữ liệu, quyền, đường dẫn và file nguồn do bộ sinh điền từ source tại ad83b0aea.

Làm gì ​

Liên kết affiliate, mã giới thiệu và việc quy công (attribution) một đơn về đúng người giới thiệu. Quy công có phiên bản chính sách và lưu dấu các lần chạm liên kết.

Quy mô ​

Domain APIaffiliate-reward, attribution
Query / Mutation6 / 6
Nguồn dữ liệuloyalty/attribution, loyalty/referral, public.affiliate_links
Bảng8
Luật phân quyền3
Đường dẫn Web Admin0

Thao tác (mutation) ​

MutationDomainMô tả
claimAffiliateTouchesattributionBind the caller's anonymous Affiliate clicks (72 h, SPEC-02) to itself. referral.claim.
claimReferralSignupattributionBind the caller's new account to its sign-up Referral. referral.claim.
createAffiliateLinkattributionGet-or-create an Affiliate link to an open Campaign. referral_link.create (own).
createReferralLinkattributionGet-or-create the caller's personal Referral link. referral_link.create (own).
disableAffiliateLinkattributionStop an Affiliate link (AD-ATTR-01). No role may call it yet (GAP-58).
openAttributionLinkattributionOpen a shared link: records the open, returns a safe target. Public.

Phép đọc (query) ​

QueryDomainMô tả
affiliateLinksattributionThe caller's Affiliate links in this app, newest first. referral_link.read (own).
affiliateRewardsaffiliate-rewardThe caller's own Affiliate reward entries in this app, newest first. attribution.read (own).
attributionattributionOrders attributed to the caller's links (masked buyer). attribution.read (own).
publicSaleCompanionattributionG1S: the Sale đồng hành of a link code; null when the code is unknown, disabled or expired, or the Sale is not ACTIVE. Requires deal.read_public.
referralLinkattributionThe caller's personal Referral link in this app, or null. referral_link.read (own).
referralMilestonesattributionPeople the caller referred in this app (masked). attribution.read (own).

Dữ liệu ​

Bảng được tham chiếu nhiều nhất trong module:

BảngCộtĐược trỏ tớiRLS
attribution_touches103✓
referral_links122✓
affiliate_links142✓
attribution_assignments231✓
attribution_policy_versions91✓
referral_milestones141✓
attribution_touch_bindings50✓
referral_identity_keys60✓

Quyền ​

MãQuyềnỨng dụngVai tròPhạm viTrạng thái
ATR-02attribution.readAPP_USERuserOWNPROPOSED
ATR-06referral.claimAPP_USERuserOWNPROPOSED
S-03attribution.readAPP_SALEsaleOWNPROPOSED

Danh sách đầy đủ và cách đọc các cờ: Ma trận quyền.

File nguồn ​

Backend:

  • code/apps/api/supabase/functions/graphql/domains/affiliate-reward/
  • code/apps/api/supabase/functions/graphql/domains/attribution/

Dữ liệu: bảng thuộc domain loyalty/attribution, loyalty/referral, public.affiliate_links — xem Cơ sở dữ liệu.

Tài nguyên quyền không có luật nào

Bản đồ module khai các tài nguyên affiliate nhưng ma trận quyền không có luật nào cho chúng. Hoặc tên tài nguyên trong bản đồ sai, hoặc quyền chưa được định nghĩa.

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17