GS2-Lottery Transaction Actions
AcquireAction
Gs2Lottery:DrawByUserId
Execute a lottery by specifying a User ID
Performs a lottery draw for the specified user based on the lottery model configuration. The lottery supports two methods: Prize Table mode (using predefined probability tables) and Script mode (using a GS2-Script to determine prizes). In box lottery mode, drawn prizes are removed from the box and cannot be drawn again. If the box is empty, an Empty error is returned. The drawn prizes are issued as a transaction.
Whether the action allows quantity specification: YES
Whether the action is reversible: NO
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||
| lotteryName | string | ✓ | ~ 128 chars | Lottery Model name Lottery Model-specific name. Specified using alphanumeric characters, hyphen (-), underscore (_), and period (.). | ||
| userId | string | ✓ | ~ 128 chars | User ID Set #{userId} to replace the currently logged in user ID. | ||
| count | int | ✓ | 1 ~ 1000 | Number of draws | ||
| config | List<Config> | [] | 0 ~ 1000 items | Settings applied to the placeholder on the transaction | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
{
"action": "Gs2Lottery:DrawByUserId",
"request": {
"namespaceName": "[string]Namespace name",
"lotteryName": "[string]Lottery Model name",
"userId": "[string]User ID",
"count": "[int]Number of draws",
"config": [
{
"key": "[string]Name",
"value": "[string]Value"
}
],
"timeOffsetToken": "[string]Time offset token"
}
}action: Gs2Lottery:DrawByUserId
request:
namespaceName: "[string]Namespace name"
lotteryName: "[string]Lottery Model name"
userId: "[string]User ID"
count: "[int]Number of draws"
config:
- key: "[string]Name"
value: "[string]Value"
timeOffsetToken: "[string]Time offset token"transaction.service("lottery").acquire.draw_by_user_id({
namespaceName="[string]Namespace name",
lotteryName="[string]Lottery Model name",
userId="[string]User ID",
count="[int]Number of draws",
config={
{
key="[string]Name",
value="[string]Value"
}
},
timeOffsetToken="[string]Time offset token",
})Gs2Lottery:ResetBoxByUserId
Reset box with specified user ID
Resets the specified user’s box to its initial state, returning all drawn prizes back into the box.
Whether the action allows quantity specification: NO
Whether the action is reversible: NO
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| prizeTableName | string | ✓ | ~ 128 chars | Name of prize table | ||
| userId | string | ✓ | ~ 128 chars | User ID Set #{userId} to replace the currently logged in user ID. | ||
| timeOffsetToken | string | ~ 1024 chars | Time offset token |
{
"action": "Gs2Lottery:ResetBoxByUserId",
"request": {
"namespaceName": "[string]Namespace name",
"prizeTableName": "[string]Name of prize table",
"userId": "[string]User ID",
"timeOffsetToken": "[string]Time offset token"
}
}action: Gs2Lottery:ResetBoxByUserId
request:
namespaceName: "[string]Namespace name"
prizeTableName: "[string]Name of prize table"
userId: "[string]User ID"
timeOffsetToken: "[string]Time offset token"transaction.service("lottery").acquire.reset_box_by_user_id({
namespaceName="[string]Namespace name",
prizeTableName="[string]Name of prize table",
userId="[string]User ID",
timeOffsetToken="[string]Time offset token",
})