Giao diện
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 API | affiliate-reward, attribution |
| Query / Mutation | 6 / 6 |
| Nguồn dữ liệu | loyalty/attribution, loyalty/referral, public.affiliate_links |
| Bảng | 8 |
| Luật phân quyền | 3 |
| Đường dẫn Web Admin | 0 |
Thao tác (mutation)
| Mutation | Domain | Mô tả |
|---|---|---|
claimAffiliateTouches | attribution | Bind the caller's anonymous Affiliate clicks (72 h, SPEC-02) to itself. referral.claim. |
claimReferralSignup | attribution | Bind the caller's new account to its sign-up Referral. referral.claim. |
createAffiliateLink | attribution | Get-or-create an Affiliate link to an open Campaign. referral_link.create (own). |
createReferralLink | attribution | Get-or-create the caller's personal Referral link. referral_link.create (own). |
disableAffiliateLink | attribution | Stop an Affiliate link (AD-ATTR-01). No role may call it yet (GAP-58). |
openAttributionLink | attribution | Open a shared link: records the open, returns a safe target. Public. |
Phép đọc (query)
| Query | Domain | Mô tả |
|---|---|---|
affiliateLinks | attribution | The caller's Affiliate links in this app, newest first. referral_link.read (own). |
affiliateRewards | affiliate-reward | The caller's own Affiliate reward entries in this app, newest first. attribution.read (own). |
attribution | attribution | Orders attributed to the caller's links (masked buyer). attribution.read (own). |
publicSaleCompanion | attribution | G1S: 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. |
referralLink | attribution | The caller's personal Referral link in this app, or null. referral_link.read (own). |
referralMilestones | attribution | People the caller referred in this app (masked). attribution.read (own). |
Dữ liệu
- Nhóm
loyalty/attribution— 4 bảng - Nhóm
loyalty/referral— 3 bảng - Một bảng:
affiliate_links— thuộc domainloyalty, nhómkhác
Bảng được tham chiếu nhiều nhất trong module:
| Bảng | Cột | Được trỏ tới | RLS |
|---|---|---|---|
attribution_touches | 10 | 3 | ✓ |
referral_links | 12 | 2 | ✓ |
affiliate_links | 14 | 2 | ✓ |
attribution_assignments | 23 | 1 | ✓ |
attribution_policy_versions | 9 | 1 | ✓ |
referral_milestones | 14 | 1 | ✓ |
attribution_touch_bindings | 5 | 0 | ✓ |
referral_identity_keys | 6 | 0 | ✓ |
Quyền
| Mã | Quyền | Ứng dụng | Vai trò | Phạm vi | Trạng thái |
|---|---|---|---|---|---|
ATR-02 | attribution.read | APP_USER | user | OWN | PROPOSED |
ATR-06 | referral.claim | APP_USER | user | OWN | PROPOSED |
S-03 | attribution.read | APP_SALE | sale | OWN | PROPOSED |
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.