#24315
Back
2025/12/05
5 min read

派獎 - 更新審核新增

派獎 - 更新審核新增.md
156 additions, 0 deletions
... ... @@ -1 +1,157 @@
1 +### SUMMARY
2 +更新審核以建立派獎設定,包含派獎群組、獎項、小樹點有效期限、推播通知設定。
3 +* 需檢查派獎時間合理性 (start_time < end_time)
4 +* 需檢查 ETA 發放類型是否提供發放時間
5 +* 需檢查推播行為是否提供對應的 URL
6 +* 需檢查訊息夾按鈕是否提供對應的 URL
7 +
8 +### REFERENCE TABLE
9 +* `DBMT.CMS_AUDIT`
10 +* `DBMT.CMS_AUDIT_ENTRY`
11 +* `DBMT.AWARD_GROUP`
12 +* `DBMT.AWARD`
13 +* `DBMT.AWARD_GP`
14 +* `DBMT.PUSHNOTIFY_RELATION`
15 +* `DBMT.PUSHNOTIFY_NOTIFICATION_ENTRY`
16 +* `DBMT.PUSHNOTIFY_MESSAGE_ENTRY`
17 +
18 +### ATTRIBUTES
19 +* METHOD: **PATCH**
20 +* PATH: `/api/features/award/groups/audit/create/{audit_id: int}`
21 +* LOGIN REQUIRED: **TRUE**
22 +* FEATURE: `AWARD_GROUP`
23 +* PERMISSION: `CREATE`, `APPLY`
24 +* CRYPTO: **None**
25 +
26 +### REQUEST
27 +#### HEADERS
28 +
29 +| Name | Type/Len | Required(*) | Nullable(*) | Desc |
30 +| ---| ---| ---| ---| --- |
31 +| Content-Type | String | * | | `"application/json"` |
32 +| Authorization | String | * | | JWT Token |
33 +| X-Request-Id | String | | | X-Request-Id for api flow tracing |
34 +
35 +```json
36 +// Example:
37 +{
38 + "Content-Type": "application/json",
39 + "Authorization": "Bearer jwt-token",
40 + "x-request-id": "78f91284-d9df-43e6-a8d2-d557273c10bb"
41 +}
42 +```
43 +
44 +#### PAYLOAD
45 +
46 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
47 +| ---| ---| ---| ---| ---| --- |
48 +| 1 | progress | String | * | | 審核進度 |
49 +| 1 | data | Dict | * | | 派獎設定資料 |
50 +
51 +### DATA
52 +
53 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
54 +| ---| ---| ---| ---| ---| --- |
55 +| 2 | award_group | Dict | * | | 派獎群組設定 |
56 +| 2 | gp_action | Dict | * | | 小樹點有效期限設定 |
57 +| 2 | awards | List(Dict) | * | | 獎項設定列表 |
58 +
59 +### award_group
60 +
61 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
62 +| ---| ---| ---| ---| ---| --- |
63 +| 3 | id | Integer | | * | 派獎群組 ID (新增時不提供) |
64 +| 3 | name | String(50) | * | | 派獎群組名稱 |
65 +| 3 | status | Enum | * | | 狀態:<br>ACTIVE: 上架<br>INACTIVE: 下架<br>RETIRED: 永久下架 |
66 +| 3 | start_time | Datetime | * | | 派獎開始時間 |
67 +| 3 | end_time | Datetime | * | | 派獎結束時間 |
68 +
69 +### gp_action
70 +
71 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
72 +| ---| ---| ---| ---| ---| --- |
73 +| 3 | expire_duration | Integer | * | * | 小樹點有效天數 (1-1095) |
74 +
75 +### awards (List Item)
76 +
77 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
78 +| ---| ---| ---| ---| ---| --- |
79 +| 3 | award | Dict | * | | 獎項設定 |
80 +| 3 | prize_gp | Dict | * | | 小樹點獎項設定 |
81 +| 3 | notify | Dict | * | | 推播通知設定 |
82 +
83 +### award
84 +
85 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
86 +| ---| ---| ---| ---| ---| --- |
87 +| 4 | id | Integer | | * | 獎項 ID (新增時不提供) |
88 +| 4 | code | String(50) | * | | 獎項代碼 |
89 +| 4 | name | String(50) | * | | 獎項名稱 |
90 +| 4 | active_status | Enum | * | | 啟用狀態:<br>ACTIVE: 啟用<br>INACTIVE: 停用 |
91 +| 4 | award_type | Enum | * | | 獎項類型:<br>ORCA_POINT: 小樹點<br>QWARE: Qware 點數<br>SELFGEN_VOUCHER: 自建票券<br>EDENRED: Edenred<br>SYSTEX: Systex |
92 +| 4 | deliver_type | Enum | * | | 發放類型:<br>IMMEDIATE: 立即發放<br>ETA: 預定時間發放 |
93 +| 4 | deliver_amount | Integer | * | | 發放數量 |
94 +| 4 | deliver_limit | Integer | * | | 發放上限 |
95 +| 4 | deliver_time | Datetime | | * | 預定發放時間 (deliver_type=ETA 時必填) |
96 +
97 +### prize_gp
98 +
99 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
100 +| ---| ---| ---| ---| ---| --- |
101 +| 4 | id | Integer | | * | 小樹點獎項 ID (新增時不提供) |
102 +| 4 | note | String(64) | | * | 備註 |
103 +
104 +### notify
105 +
106 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
107 +| ---| ---| ---| ---| ---| --- |
108 +| 4 | id | Integer | | * | 推播關聯 ID (新增時不提供) |
109 +| 4 | notification | Dict | | * | 外部推播設定 |
110 +| 4 | message | Dict | | * | 訊息夾設定 |
111 +
112 +### notification
113 +
114 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
115 +| ---| ---| ---| ---| ---| --- |
116 +| 5 | id | Integer | | * | 推播 ID (新增時不提供) |
117 +| 5 | title | String(300) | * | | 推播標題 |
118 +| 5 | content | String(200) | * | | 推播內文 |
119 +| 5 | notification_behavior | Enum | * | | 推播點擊行為:<br>OPEN_URL: 開啟連結<br>OPEN_INBOX: 開啟訊息夾 |
120 +| 5 | url | String(200) | | * | DeepLink 網址 (notification_behavior=OPEN_URL 時必填) |
121 +
122 +### message
123 +
124 +| Level | Name | Type/Len | Required(*) | Nullable(*) | Desc |
125 +| ---| ---| ---| ---| ---| --- |
126 +| 5 | id | Integer | | * | 訊息夾 ID (新增時不提供) |
127 +| 5 | title | String(100) | * | | 訊息夾標題 |
128 +| 5 | content | String(4000) | * | | 訊息夾內文 |
129 +| 5 | btn_wording | String(50) | | * | 按鈕文字 |
130 +| 5 | url | String(4000) | | * | 網址 (btn_wording 有值時必填) |
131 +
132 +### RESPONSE
133 +#### STATUS CODE
134 +* 204 No Content
135 +
136 +#### BODY
137 +No response body
138 +
139 +#### ERROR CODE
140 +
141 +| HTTP Status | ErrorCode | Message | Desc |
142 +| ---| ---| ---| --- |
143 +| 400 | ValidationError | Start time must be before end time | 開始時間必須早於結束時間 |
144 +| 400 | ValidationError | Deliver time must be provided for ETA delivery | ETA 發放類型必須提供發放時間 |
145 +| 400 | ValidationError | Deliver time must not be in the past | 發放時間不可為過去時間 |
146 +| 400 | ValidationError | URL must be provided for OPEN_URL notification behavior | OPEN_URL 行為必須提供 URL |
147 +| 400 | ValidationError | URL must be provided for button action | 按鈕文字有值時必須提供 URL |
148 +| 401 | Unauthorized | Unauthorized | 未授權 |
149 +| 403 | Forbidden | Forbidden | 無權限存取 |
150 +| 400 | AwardGroupAuditError.DELIVER_TIME_BAD_REQUEST | Deliver time must greater than end_time and system now. | 發放時間必須大於結束時間且晚於系統目前時間 |
151 +| 400 | AwardGroupAuditError.DELIVER_TIME_NOT_ALLOWED_CHANGE | Deliver time must greater than end_time and system now. | 發放時間必須大於結束時間且晚於系統目前時間 |
152 +| 400 | AwardGroupAuditError.AWARD_GROUP_STATUS_BAD_REQUEST | Award group status not allowed to changed. | 派獎群組狀態不允許變更 |
153 +| 400 | AwardGroupAuditError.AWARD_GROUP_START_TIME_BAD_REQUEST | Award group start time must greater than every awards. | 派獎開始時間必須早於所有獎項時間 |
154 +| 400 | AwardGroupAuditError.AWARD_LIMIT_BAD_REQUEST | Award limit should be greater than previous setting. | 獎項發放上限必須大於先前設定 |
155 +| 400 | AwardGroupAuditError.AWARD_MISSING_BAD_REQUEST | At lease one award setting. | 至少需要一個獎項設定 |
156 +| 500 | AwardGroupAuditError.ACTION_RULE_CREATE_FAILED | Failed to create action rule. | 建立行動規則失敗 |