> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cog888.net/llms.txt
> Use this file to discover all available pages before exploring further.

# 用戶登入

> 用戶登入遊戲並取得遊戲 URL

<Accordion title="此 API 可能返回的錯誤代碼">
  | 代碼   | 說明    |
  | ---- | ----- |
  | 2    | 無效參數  |
  | 36   | 伺服器錯誤 |
  | 9999 | 未知錯誤  |
</Accordion>


## OpenAPI

````yaml /seamless-openapi.json POST /api/v1/dt/game
openapi: 3.1.0
info:
  title: 單一錢包 API
  description: 單一錢包（Seamless Wallet）API 文檔，包含 Game-API 和 Wallet-API
  version: 1.0.0
servers:
  - url: https://api.example.com
    description: API Server
security: []
tags:
  - name: Game-API User
    description: 遊戲 API - 用戶相關操作
  - name: Game-API Report
    description: 遊戲 API - 報表查詢
  - name: Game-API Internal
    description: 遊戲 API - 內部專用（隱藏）
  - name: Wallet-API
    description: 錢包 API - 由 vendor 實作
paths:
  /api/v1/dt/game:
    post:
      tags:
        - Game-API User
      summary: 用戶登入
      description: 用戶登入遊戲並取得遊戲 URL
      operationId: launchGame
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - uuid
                - platform_id
                - username
                - transaction_id
                - credit
                - key
              properties:
                uuid:
                  type: string
                  description: 各平台自定義的唯一性請求序號，長度 >= 32 且 <= 128 字節
                platform_id:
                  type: string
                  description: 平台方的產品 ID
                username:
                  type: string
                  description: 用戶在遊戲中的帳號 (限制長度23字元，且皆為小寫英文或數字)
                transaction_id:
                  type: string
                  description: 交易序號 (長度 1~128 字元，僅允許 ASCII 32-126 可列印字元，禁止使用 ` 和 ~)
                credit:
                  type: string
                  description: 本次登入所需帶入遊戲中額度，單一錢包該值須為0
                lang:
                  type: string
                  description: 語系，選填
                key:
                  type: string
                  description: md5(username + credit + transaction_id + 平台密鑰)
                homeUrl:
                  type: string
                  description: 現金網首頁，需使用 encodeURIComponent 編碼
                registerUrl:
                  type: string
                  description: 現金網註冊網址，需使用 encodeURIComponent 編碼
                depositUrl:
                  type: string
                  description: 現金網存款網址，需使用 encodeURIComponent 編碼
                withdrawUrl:
                  type: string
                  description: 現金網取款網址，需使用 encodeURIComponent 編碼
                extendSessionUrl:
                  type: string
                  description: 現金網延長 session 網址，需使用 encodeURIComponent 編碼
                theme_pid:
                  type: string
                  description: 要顯示的 UI 皮的 pid，未帶入將顯示預設值
                title:
                  type: string
                  description: 網頁分頁上顯示的產品名稱，未帶入將顯示 COG
                favicon:
                  type: string
                  description: 網頁分頁上顯示的產品 favicon，未帶入將顯示 COG favicon
                logoLandscape:
                  type: string
                  description: 大廳橫屏顯示的 logo，未帶入將顯示 COG logo
                site:
                  type: string
                  description: 帶入 app 字串，在手機 mobile h5 打橫將不顯示上滑進入全屏遮罩
                device:
                  type: string
                  description: >-
                    裝置類型，可帶入 PC 或 MB，未帶入視為 PC；帶入的值會原樣附加至遊戲 URL（device=PC 或
                    device=MB），未帶入則不附加
            example:
              uuid: e69da788a6c841d4953c475fc42bf464
              platform_id: AXTES
              username: player001
              transaction_id: TX123456
              credit: '0'
              key: abc123hash
              homeUrl: https%3A%2F%2Fwww.example.com
              lang: zh-tw
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    description: 導向遊戲平台的 URL
              example:
                url: >-
                  https://rel-game.cog888.net?pid=R01C05&token=zL13tWjRw2d0mHJSAkNtyNgjAsfTjavP6e9gQLpsOF-&homeUrl=home&registerUrl=register&depositUrl=deposit&withdrawUrl=withdraw&extendSessionUrl=extend&lang=en-us&closeAppOnLogout=1
        '400':
          description: 請求錯誤
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 2
                  msg: >-
                    request hash signature(0FACF22B9E3DB5CDC670A0F7A65BB76A) is
                    error
                  uuid: 9e96610f-5388-42df-b3ed-ba1b3178c63b
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: 錯誤代碼
        message:
          type: string
          description: 錯誤訊息
        data:
          description: 資料（通常為 null）
        status_code:
          type: integer
          description: HTTP 狀態碼
        service:
          type: string
          description: 服務名稱

````