Giao diện
API · campaign
Trang sinh tự động
Parse từ schema.graphql (SDL backend export) bằng parser graphql. Mô tả và quyền lấy nguyên văn từ description trong SDL.
13 query · 8 mutation.
Query
campaign
Campaign configuration and history (figures: campaignOverview, U19-P2-08). Requires deal.read.
query · quyền: deal.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
id | ID! |
Trả về Campaign!
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | |
code | String! | Mã chiến dịch CD + ddmmyyyy + 4 số (B006.R14). |
clonedFrom | CampaignCloneSource | |
type | CampaignType! | |
name | String | |
description | String | |
state | CampaignState! | |
status | CampaignStatus! | |
opensAt | DateTime | |
closesAt | DateTime | |
termOptions | [Int!] | Recurring only: Số kỳ of the term packages, ascending (U19-P1-05; the packages are Campaign.termPackages). |
productCount | Int! | |
products | [CampaignProduct!]! | |
milestones | [CampaignMilestone!]! | |
history | [CampaignHistoryEntry!]! | Lịch sử thao tác, newest first (U19-P2-04, B171.R11). |
createdAt | DateTime! | |
updatedAt | DateTime! | |
version | Int! | |
rewardUnit | CampaignRewardUnit | |
pointCapBp | Int | Trần thanh toán bằng Pi-Point of this campaign, basis points 0..10000. |
payNowBonus | Int | Mua chung: Thưởng thanh toán online, in rewardUnit. |
prepayAllBonus | Int | Mua định kỳ: Thưởng khi trả trước toàn bộ các kỳ, in rewardUnit. |
spinWheel | SpinWheel | Áp dụng vòng quay may mắn (both types, BR-C-09, DEC-CV3-05): id, code, name, status of the chosen wheel; null = Không áp dụng. |
termsSetId | ID | Điều khoản tham gia Deal (DealTermsSet id). |
publishAt | DateTime | Thời gian công bố. |
serverTime | DateTime! | Server clock for the countdowns (B171.R05). |
creator | AdminAccountRef! | Tạo bởi (B171.R03). |
terms | DealTermsSet | Điều khoản tham gia Deal (B058.R10). |
depositRatePct | Float | Mức cọc, % (current configuration). |
pointCapPct | Float | Trần thanh toán bằng Pi-Point, %. |
maxCycles | Int | Mua định kỳ: Số kỳ tối đa = the longest package (B273.R02); null for a Group Buy. |
cycles | [CampaignCycle!]! | Recurring delivery schedule computed from the start month, windows and longest package; empty for a Group Buy. |
deliveryStartMonth | String | Mua định kỳ: Kỳ bắt đầu giao, YYYY-MM. |
minOrderValueVnd | VndAmount | Mua định kỳ: Giá trị đơn tối thiểu per period. |
deliveryWindows | [CampaignDeliveryWindow!]! | Mua định kỳ: khung ngày giao, window 1 first; empty for a Group Buy. |
termPackages | [CampaignTermPackage!]! | Mua định kỳ: gói kỳ cam kết, package 1 first; empty for a Group Buy. |
campaignCloneSource
Nhân bản: the form prefill from a campaign in any state (B006.R13). Requires deal.manage.
query · quyền: deal.manage
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
id | ID! |
Trả về CampaignCloneDraft!
| Field | Kiểu | Mô tả |
|---|---|---|
type | CampaignType! | |
clonedFromId | ID! | |
clonedFromCode | String! | |
name | String | |
description | String | |
publishAt | DateTime | |
opensAt | DateTime | |
closesAt | DateTime | |
rewardUnit | CampaignRewardUnit | |
termsSetId | ID | |
depositRatePct | Float | |
pointCapPct | Float | |
payNowBonus | Int | |
prepayAllBonus | Int | |
spinWheel | SpinWheel | BR-C-12: the source's wheel; null (Không áp dụng) when none or when it is Ngừng hoạt động (INACTIVE). |
products | [CampaignCloneProduct!]! | |
milestones | [CampaignCloneMilestone!]! | |
deliveryStartMonth | String | |
minOrderValueVnd | VndAmount | |
deliveryWindows | [CampaignDeliveryWindow!]! | |
termPackages | [CampaignTermPackage!]! |
campaignCreators
Bộ lọc Người tạo: accounts that may create a campaign (B036.R06). Requires deal.read.
query · quyền: deal.read
Không có tham số.
Trả về [AdminAccountRef!]!
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | |
displayName | String | profiles.full_name; null when the account has no profile (shown as —). |
campaignOverlap
Field check when leaving Thời gian mở/đóng (B006.R18; touching is not overlapping). Requires deal.manage.
query · quyền: deal.manage
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
type | CampaignType! | ||
opensAt | DateTime! | ||
closesAt | DateTime! | ||
excludeId | ID | The campaign being edited. |
Trả về CampaignOverlap
| Field | Kiểu | Mô tả |
|---|---|---|
code | String! | |
opensAt | DateTime! | |
closesAt | DateTime! |
campaignOverview
Tổng quan of a Mua chung (B171.R04-R09) or a Mua định kỳ (B256.R02-R10, field recurring). Requires deal.read.
query · quyền: deal.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
id | ID! |
Trả về CampaignOverview!
| Field | Kiểu | Mô tả |
|---|---|---|
campaignId | ID! | |
status | CampaignStatus! | |
closedAt | DateTime | Đã chốt lúc; null before the close. |
closePaymentWait | CampaignClosePaymentWait | #479 T6: null unless the campaign is CLOSING and its close waits on unpaid orders. |
asOf | DateTime! | |
kpis | CampaignOverviewKpis! | |
products | [CampaignOverviewProduct!]! | |
milestones | [CampaignOverviewMilestone!]! | |
purchaseMatrix | CampaignPurchaseMatrix | Null before the close (Chưa có số liệu…). |
config | CampaignOverviewConfig! | |
recurring | CampaignOverviewRecurring | Mua định kỳ only (milestones [] and purchaseMatrix null then); null for a Mua chung. |
campaignPickerBrands
Thương hiệu list of the picker (CV3-P4-16, DEC-CV3-32): live brands whose name contains search, Tên A→Z. Requires deal.manage (not catalog.read).
query · quyền: deal.manage
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
search | String | ||
page | Int | 1 | |
pageSize | Int | 50 |
Trả về CampaignPickerBrandPage!
| Field | Kiểu | Mô tả |
|---|---|---|
items | [CampaignPickerBrand!]! | |
page | Int! | |
pageSize | Int! | |
total | Int! |
campaignPickerCategories
Ngành hàng list of the picker (CV3-P4-16, DEC-CV3-32): every live category, parents first, siblings by name. Requires deal.manage (not catalog.read).
query · quyền: deal.manage
Không có tham số.
Trả về [CampaignPickerCategory!]!
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | |
parentId | ID | |
name | String! | |
level | Int! | |
isLeaf | Boolean! |
campaignProductPicker
Active (On sale) single and combo products for a campaign. search under 3 characters is validation_failed search_too_short; no / blank search loads by the filters alone. RECURRING (ĐK basket) offers single products only: productType ALL means STANDARD, COMBO is product_type_not_allowed. Requires deal.manage.
query · quyền: deal.manage
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
search | String | ||
productType | CampaignPickerProductType | ALL | |
categoryId | ID | A category includes all of its sub-categories. | |
brandId | ID | ||
campaignType | CampaignType | GROUP_BUY | Form kind; RECURRING = single products only (BR-DK-02). |
addedProductIds | [ID!] | Products already in the form; returned with alreadyAdded = true. | |
page | Int | 1 | |
pageSize | Int | 50 |
Trả về CampaignPickerPage!
| Field | Kiểu | Mô tả |
|---|---|---|
items | [CampaignPickerProduct!]! | |
page | Int! | |
pageSize | Int! | |
total | Int! |
campaigns
Admin list (B011/B031), newest first, filters AND-ed; search = Mã or Tên, ignored under 3 characters; dates = Vietnam days YYYY-MM-DD, closed, either end optional (delivery: overlap). Requires deal.read.
query · quyền: deal.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
search | String | ||
type | CampaignType | ||
status | CampaignStatus | ||
createdFrom | String | ||
createdTo | String | ||
opensFrom | String | ||
opensTo | String | ||
closesFrom | String | ||
closesTo | String | ||
deliveryFrom | String | ||
deliveryTo | String | ||
createdBy | ID | ||
page | Int | 1 | |
pageSize | Int | 50 |
Trả về CampaignPage!
| Field | Kiểu | Mô tả |
|---|---|---|
items | [CampaignListItem!]! | |
page | Int! | |
pageSize | Int! | |
total | Int! | |
sourceStatus | SourceStatus! |
campaignSettings
System parameters of the campaign form. Requires deal.read.
query · quyền: deal.read
Không có tham số.
Trả về CampaignSettings!
| Field | Kiểu | Mô tả |
|---|---|---|
minImportLeadDays | Int! | Minimum import lead time in days between close and milestone 1 (B006.R11). |
campaignSpinWheelOptions
Áp dụng vòng quay may mắn of the campaign form (CV3-P4-22, DEC-CV3-37, BR-C-09): ACTIVE wheels only, search = code / name with accents kept, newest first, at most 50. Requires deal.manage (not spin.read).
query · quyền: deal.manage
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
search | String |
Trả về [CampaignSpinWheelOption!]!
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | |
code | String! | |
name | String! | |
maxPointsPerSpin | Int | The largest slot of the wheel's configuration in force (tối đa x Pi-Point / lượt); null without one. |
dealTermsSets
Terms sets by status (default ACTIVE), by name then version. Requires deal.read.
query · quyền: deal.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
status | DealTermsStatus | ACTIVE |
Trả về [DealTermsSet!]!
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | |
name | String! | |
version | String! | Version label of the terms (e.g. v1.0); (name, version) is unique. |
content | String! | |
status | DealTermsStatus! | |
createdAt | DateTime! | |
updatedAt | DateTime! |
myRecurringBasket
The caller's own DRAFT basket of a Mua định kỳ campaign, or null. G2S: when the campaign close discarded the draft, the next read returns it once with closedNotice true (status DISCARDED), then null. Requires order.read (U-01, OWN).
query · quyền: order.read
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
campaignId | ID! |
Trả về RecurringBasket
| Field | Kiểu | Mô tả |
|---|---|---|
id | ID! | |
campaignId | ID! | |
status | RecurringBasketStatus! | |
packageNo | Int | Gói kỳ cam kết; its Số kỳ is termCycles. G2S: null while the buyer has not chosen one (a draft saved from G2-02 / G2-03; G2-05 then preselects the first package, BR-MD-06), or a legacy draft whose Số kỳ is no package of the campaign. |
termCycles | Int! | Số kỳ of the package; 0 while packageNo is null and no Số kỳ is stored (G2S). |
deliveryWindowNo | Int | G2S S3: Khung ngày giao chosen on G2-05; null until chosen (G2-05 then preselects the first window, BR-MD-06). |
version | Int! | Send it back as expectedVersion on the next save or discard. |
lines | [RecurringBasketLine!]! | |
cycleLines | [RecurringBasketCycleLine!]! | Only the cycles that differ from the default (sparse). |
emptyCycles | [Int!]! | Cycles where every product is 0. G2S (BR-MD-05, DEC-FS27-MD-EMPTY-CYCLE): an empty cycle is refused (validation_failed cycle_empty), never a skip; always []. |
skipMax | Int! | Được bỏ qua tối đa of the package (0 when the package sets none or no package is chosen). |
closedNotice | Boolean! | G2S S3 (BR-MD-05): true on the draft the campaign close discarded (status DISCARDED), returned once by myRecurringBasket so the App shows '{Tên rổ} đã đóng nhận cọc. Rổ hàng của bạn đã được xóa.'; false otherwise. |
Mutation
adoptRecurringBasket
G2S S3 (BR-MD-05 / BR-MD-11, DR-01, DEC-OWN28-G2S-BASKET-ADOPT-REPLACE): after sign-in, the device basket replaces the caller's DRAFT of the campaign (package, window, lines and per-cycle quantities) or starts one; idempotent by requestId. Requires order.create (U-02, OWN).
mutation · quyền: order.create
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | AdoptRecurringBasketInput! |
Trả về RecurringBasketResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The basket id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | submit_recurring_order after a save; null after a discard. |
basket | RecurringBasket! |
createCampaign
Tạo chiến dịch (B052.R09): validated, DRAFT -> PENDING_PUBLISH (UPCOMING if publishAt <= now). deal.manage.
mutation · SDL không ghi quyền
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | CampaignInput! |
Trả về CampaignCommandResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False when nothing changed (close of an already closed campaign). |
campaign | Campaign! |
deleteCampaign
Xóa (B198.R02): hard delete of a DRAFT / PENDING_PUBLISH / UPCOMING without orders. Requires deal.manage.
mutation · quyền: deal.manage
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | CampaignDeleteInput! |
Trả về CampaignDeleteResult!
| Field | Kiểu | Mô tả |
|---|---|---|
deletedId | ID! | |
code | String! | Mã chiến dịch of the deleted campaign. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! |
discardRecurringBasket
Discards the caller's DRAFT basket. Requires order.create (U-02, OWN).
mutation · quyền: order.create
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | DiscardRecurringBasketInput! |
Trả về RecurringBasketResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The basket id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | submit_recurring_order after a save; null after a discard. |
basket | RecurringBasket! |
saveCampaignDraft
Lưu nháp (B052.R07): create or edit a Group Buy DRAFT, stored as typed (B006.R16). Requires deal.manage.
mutation · quyền: deal.manage
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | SaveCampaignDraftInput! |
Trả về CampaignCommandResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False when nothing changed (close of an already closed campaign). |
campaign | Campaign! |
saveRecurringBasketDraft
Creates or replaces the caller's DRAFT basket: package (optional since G2S), window, lines and every per-cycle quantity in one write. Requires order.create (U-02, OWN).
mutation · quyền: order.create
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | SaveRecurringBasketDraftInput! |
Trả về RecurringBasketResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | The basket id. |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | submit_recurring_order after a save; null after a discard. |
basket | RecurringBasket! |
saveRecurringCampaignDraft
Lưu nháp of a Mua định kỳ DRAFT (create or edit): basket, tiers, windows, packages and schedule in one version. Requires deal.manage.
mutation · quyền: deal.manage
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | SaveRecurringCampaignDraftInput! |
Trả về CampaignCommandResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False when nothing changed (close of an already closed campaign). |
campaign | Campaign! |
updateCampaign
Lưu thay đổi (B149.R03) in PENDING_PUBLISH / UPCOMING: validated, state kept. Requires deal.manage.
mutation · quyền: deal.manage
| Tham số | Kiểu | Mặc định | Mô tả |
|---|---|---|---|
input | CampaignInput! |
Trả về CampaignCommandResult!
| Field | Kiểu | Mô tả |
|---|---|---|
aggregateId | ID! | |
version | Int! | |
status | CommandStatus! | |
requestId | ID! | |
correlationId | ID! | |
nextAction | NextAction | |
changed | Boolean! | False when nothing changed (close of an already closed campaign). |
campaign | Campaign! |