> ## 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    | 無效參數   |
  | 10   | 交易序號重複 |
  | 36   | 伺服器錯誤  |
  | 9999 | 未知錯誤   |
</Accordion>


## OpenAPI

````yaml /transfer-openapi.json POST /api/v1/dt/game
openapi: 3.1.0
info:
  title: 轉帳錢包 API
  description: Game-API 用於 vendor 向遊戲取得遊戲相關數據
  version: 1.0.0
servers:
  - url: https://api.example.com
    description: Production server
security: []
paths:
  /api/v1/dt/game:
    post:
      tags:
        - User API
      summary: 用戶登入
      description: 用戶登入並取得遊戲 URL
      operationId: userLogin
      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: 本次登入所需帶入遊戲中額度
                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），未帶入則不附加
      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/Error'
              example:
                error:
                  code: 2
                  msg: >-
                    request hash signature(0FACF22B9E3DB5CDC670A0F7A65BB76A) is
                    error
                  uuid: 9e96610f-5388-42df-b3ed-ba1b3178c63b
components:
  schemas:
    Error:
      type: object
      properties:
        code:
          type: string
          description: 錯誤代碼
        message:
          type: string
          description: 錯誤訊息
        data:
          description: 資料（通常為 null）
        status_code:
          type: integer
          description: HTTP 狀態碼
        service:
          type: string
          description: 服務名稱

````