Skip to main content

🎮 GameService (10 APIs)

API สำหรับจัดการเกม — รายการเกม, เปิดเกม, ผู้ให้บริการเกม, วงล้อ, เกมโปรด


1. เปิดเกม (Open Game)

Authorization

TypeKeyValue
Bearer TokenAuthorizationBearer <token>

Request

POST {{ENDPOINT}}/member-hook/open-game/v2

Body application/json

Fieldตัวอย่างคำอธิบาย
game_id"pg_slot_001"ID ของเกม
member_id"64a1b2c3d4e5f6a7b8c9d0e1"ID ของสมาชิก

Example

Request

curl -X POST '{{ENDPOINT}}/member-hook/open-game/v2' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"game_id": "pg_slot_001",
"member_id": "64a1b2c3d4e5f6a7b8c9d0e1"
}'

Response 200 OK

{
"status": true,
"url": "https://game-provider.com/play?session=xyz789"
}

2. ดึง Game List จาก CDN (CDN Static Game List)

Authorization

ไม่ต้องใช้ (No Auth)

Request

GET {{CDN_URL}}/{provider_name}.json

Path Parameters

Parameterตัวอย่างคำอธิบาย
provider_namepg_softชื่อ provider (lowercase, แทนช่องว่างด้วย _)

Example

Request

curl -X GET 'https://cdn.example.com/pg_soft.json'

Response 200 OK

[
{
"game_id": "pg_001",
"game_name": "Fortune Tiger",
"image": "https://cdn.example.com/fortune-tiger.webp"
}
]

3. ดึง Provider จาก CDN (CDN Agent Games)

Authorization

ไม่ต้องใช้ (No Auth)

Request

GET https://s3.b9auto.com/AGENT/{app_name}-games.json?v={timestamp}

Path Parameters

Parameterตัวอย่างคำอธิบาย
app_nameb9autoชื่อ App (lowercase) จาก REACT_APP_NAME

Example

Request

curl -X GET 'https://s3.b9auto.com/AGENT/b9auto-games.json?v=1705312000000'

Response 200 OK

{
"providers": [
{
"code": "PG",
"name": "PG Soft",
"games": [...]
}
]
}

4. ดึง Game Provider JSON จาก CDN (CDN Provider)

Authorization

ไม่ต้องใช้ (No Auth)

Request

GET https://s3.b9auto.com/{PREFIX}-PROVIDER/provider.json?v={timestamp}

Path Parameters

Parameterตัวอย่างคำอธิบาย
PREFIXB9Prefix ของ Agent จาก REACT_APP_PREFIX

Example

Request

curl -X GET 'https://s3.b9auto.com/B9-PROVIDER/provider.json?v=1705312000000'

Response 200 OK

[
{
"code": "PG",
"name": "PG Soft",
"logo": "https://s3.b9auto.com/provider/pg.png"
}
]

5. ดึง Game List ตาม Provider จาก CDN (CDN Game by Provider)

Authorization

ไม่ต้องใช้ (No Auth)

Request

GET https://s3.b9auto.com/{PREFIX}-GAME/{provider_name}.json?v={timestamp}

Path Parameters

Parameterตัวอย่างคำอธิบาย
PREFIXB9Prefix ของ Agent
provider_namepgชื่อ Provider (lowercase)

Example

Request

curl -X GET 'https://s3.b9auto.com/B9-GAME/pg.json?v=1705312000000'

Response 200 OK

[
{
"game_id": "pg_001",
"game_name": "Fortune Tiger",
"image": "https://s3.b9auto.com/games/pg/fortune-tiger.webp"
}
]

6. ดึง Config วงล้อ (Wheel Config)

Authorization

TypeKeyValue
Bearer TokenAuthorizationBearer <token>

Request

GET {{ENDPOINT}}/member-hook/reward-config

Example

Request

curl -X GET '{{ENDPOINT}}/member-hook/reward-config' \
-H 'Authorization: Bearer <token>'

Response 200 OK

{
"rewards": [
{ "label": "10 เครดิต", "value": 10, "color": "#FFD700" },
{ "label": "50 เครดิต", "value": 50, "color": "#FF4500" },
{ "label": "เสียใจด้วย", "value": 0, "color": "#808080" }
],
"spin_cost": 100,
"enabled": true
}

7. หมุนวงล้อ (Play Wheel)

Authorization

TypeKeyValue
Bearer TokenAuthorizationBearer <token>

Request

POST {{ENDPOINT}}/member-hook/reward-wheel

Body application/json

Fieldตัวอย่างคำอธิบาย
member_id"64a1b2c3d4e5f6a7b8c9d0e1"ID ของสมาชิก

Example

Request

curl -X POST '{{ENDPOINT}}/member-hook/reward-wheel' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"member_id": "64a1b2c3d4e5f6a7b8c9d0e1"
}'

Response 200 OK

{
"status": true,
"reward": {
"label": "50 เครดิต",
"value": 50
},
"index": 1
}

8. ดูประวัติวงล้อ (Wheel History)

Authorization

TypeKeyValue
Bearer TokenAuthorizationBearer <token>

Request

GET {{ENDPOINT}}/member-hook/reward-wheel-history/{memberId}

Parameters

Parameterตัวอย่างคำอธิบาย
memberId64a1b2c3d4e5f6a7b8c9d0e1ID ของสมาชิก (Path Parameter)

Example

Request

curl -X GET '{{ENDPOINT}}/member-hook/reward-wheel-history/64a1b2c3d4e5f6a7b8c9d0e1' \
-H 'Authorization: Bearer <token>'

Response 200 OK

{
"data": [
{
"reward": "50 เครดิต",
"value": 50,
"created_at": "2024-01-15T10:30:00.000Z"
}
]
}

9. ดึงเกมโปรด (Game Favorite)

Authorization

TypeKeyValue
Bearer TokenAuthorizationBearer <token>

Request

GET {{ENDPOINT}}/member-hook/game-list/fav/{memberId}

Parameters

Parameterตัวอย่างคำอธิบาย
memberId64a1b2c3d4e5f6a7b8c9d0e1ID ของสมาชิก (Path Parameter)

Example

Request

curl -X GET '{{ENDPOINT}}/member-hook/game-list/fav/64a1b2c3d4e5f6a7b8c9d0e1' \
-H 'Authorization: Bearer <token>'

Response 200 OK

{
"data": [
{
"game_id": "pg_slot_001",
"game_name": "Fortune Tiger",
"provider": "PG"
}
]
}

10. ดึงเปอร์เซ็นต์เกม (Game Percent)

Authorization

TypeKeyValue
Bearer TokenAuthorizationBearer <token>

Request

POST https://state.icasclub.dev/game/percent

Body application/json

Fieldตัวอย่างคำอธิบาย
provider"PG"ชื่อ Provider
game_id"pg_slot_001"ID ของเกม

Example

Request

curl -X POST 'https://state.icasclub.dev/game/percent' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"provider": "PG",
"game_id": "pg_slot_001"
}'

Response 200 OK

{
"percent": 95.5,
"provider": "PG",
"game_id": "pg_slot_001"
}