Skip to content

Latest commit

 

History

History
1044 lines (785 loc) · 18.5 KB

api_doc.md

File metadata and controls

1044 lines (785 loc) · 18.5 KB

go-maimai-player-counter

github.com/jz0ojiang/go-maimai-player-counter

API 文档

Variables

Key Value Type
url localhost:8080 string

Endpoints


Province(省)

1. getProvinceList(获取省份列表)

Endpoint:

Method: GET
Type:
URL: {{url}}/getProvinceList

More example Requests/Responses:

I. Example Request: 成功示例

Body: None

I. Example Response: 成功示例

{
    "code": 0,
    "data": [
        {
            "code": 11,
            "name": "北京市",
            "full_code": "110000000000"
        }
        ...
    ],
    "message": "success"
}

Status Code: 200


City(市)

1. getCityList(获取某省城市列表)

Endpoint:

Method: GET
Type:
URL: {{url}}/getCityList/:provinceCode

URL variables:

Key Value Description
provinceCode 11

More example Requests/Responses:

I. Example Request: 成功示例(fullcode)

Query:

Key Value Description
provinceCode 110000000000

Body: None

I. Example Response: 成功示例(fullcode)

{
    "code": 0,
    "data": [
        {
            "code": 1101,
            "name": "市辖区",
            "province_code": 11,
            "full_code": "110100000000"
        }
    ],
    "message": "success"
}

Status Code: 200


II. Example Request: 成功示例(code)

Query:

Key Value Description
provinceCode 11

Body: None

II. Example Response: 成功示例(code)

{
    "code": 0,
    "data": [
        {
            "code": 1101,
            "name": "市辖区",
            "province_code": 11,
            "full_code": "110100000000"
        }
    ],
    "message": "success"
}

Status Code: 200


III. Example Request: 失败示例(Not Found)

Query:

Key Value Description
provinceCode 0

Body: None

III. Example Response: 失败示例(Not Found)

{
    "code": -1,
    "data": [],
    "message": "no city found"
}

Status Code: 404


2. getCity(获取城市)

Endpoint:

Method: GET
Type:
URL: {{url}}/getCity/:cityCode

URL variables:

Key Value Description
cityCode 1401

More example Requests/Responses:

I. Example Request: 成功示例(code)

Query:

Key Value Description
cityCode 1401

Body: None

I. Example Response: 成功示例(code)

{
    "code": 0,
    "data": {
        "code": 1401,
        "name": "太原市",
        "province_code": 14,
        "full_code": "140100000000"
    },
    "message": "success"
}

Status Code: 200


II. Example Request: 失败示例(Not Found)

Query:

Key Value Description
cityCode 0

Body: None

II. Example Response: 失败示例(Not Found)

{
    "code": -1,
    "data": {},
    "message": "no city found"
}

Status Code: 404


Arcade(机厅)

getArcade/:arcadeID 的机厅 ID 与华立公布的机厅列表的机厅 ID 一致

如果你想获取华立更新的机厅,直接进行一次请求即可,将自动添加至数据库中

1. getArcade(获取机厅详情)

Endpoint:

Method: GET
Type:
URL: {{url}}/getArcade/:arcadeID

URL variables:

Key Value Description
arcadeID 0

More example Requests/Responses:

I. Example Request: 成功示例

Query:

Key Value Description
arcadeID 1001

Body: None

I. Example Response: 成功示例

{
    "code": 0,
    "data": {
        "arcade_id": 1001,
        "arcade_name": "环游嘉年华天河店",
        "machine_count": 4,
        "address": "广东省广州市天河区天河路208号天河城6楼",
        "province": {
            "code": 44,
            "name": "广东省",
            "full_code": "440000000000"
        },
        "city": {
            "code": 4401,
            "name": "广州市",
            "province_code": 44,
            "full_code": "440100000000"
        }
    }
}

Status Code: 200


II. Example Request: 失败示例

Query:

Key Value Description
arcadeID 0

Body: None

II. Example Response: 失败示例

{
    "code": -1,
    "message": "arcade not found"
}

Status Code: 500


2. getArcadeList(获取机厅列表)

Endpoint:

Method: GET
Type:
URL: {{url}}/getArcadeList

More example Requests/Responses:

I. Example Request: 成功示例

Body: None

I. Example Response: 成功示例

{
    "code": 0,
    "data": [
        {
            "arcade_id": 1001,
            "arcade_name": "环游嘉年华天河店",
            "machine_count": 4,
            "address": "广东省广州市天河区天河路208号天河城6楼",
            "province": {
                "code": 44,
                "name": "广东省",
                "full_code": "440000000000"
            },
            "city": {
                "code": 4401,
                "name": "广州市",
                "province_code": 44,
                "full_code": "440100000000"
            }
        },
        {
            "arcade_id": 1002,
            "arcade_name": "环游嘉年华番禺易发店",
            "machine_count": 3,
            "address": "广东省广州市番禺区市桥街易发商业街新大新百货5楼",
            "province": {
                "code": 44,
                "name": "广东省",
                "full_code": "440000000000"
            },
            "city": {
                "code": 4401,
                "name": "广州市",
                "province_code": 44,
                "full_code": "440100000000"
            }
        },
        ...(1300+)
    ]
}

Status Code: 200


3. getArcadeList/city(获取某城市机厅列表)

Endpoint:

Method: GET
Type:
URL: {{url}}/getArcadeList/city/:cityCode

URL variables:

Key Value Description
cityCode 1101

More example Requests/Responses:

I. Example Request: 成功示例

Query:

Key Value Description
cityCode 1101

Body: None

I. Example Response: 成功示例

{
    "code": 0,
    "data": [
        {
            "arcade_id": 1011,
            "arcade_name": "北京乐酷电玩",
            "machine_count": 2,
            "address": "北京市海淀区远大路一号世纪金源购物中心5楼",
            "province": {
                "code": 11,
                "name": "北京市",
                "full_code": "110000000000"
            },
            "city": {
                "code": 1101,
                "name": "市辖区",
                "province_code": 11,
                "full_code": "110100000000"
            }
        },
        {
            "arcade_id": 1018,
            "arcade_name": "风云再起北京西单店",
            "machine_count": 2,
            "address": "北京市西城区堂子胡同9号新一代商城六层",
            "province": {
                "code": 11,
                "name": "北京市",
                "full_code": "110000000000"
            },
            "city": {
                "code": 1101,
                "name": "市辖区",
                "province_code": 11,
                "full_code": "110100000000"
            }
        },
        ...
    ]
}

Status Code: 200


II. Example Request: 失败示例

Query:

Key Value Description
cityCode 11011

Body: None

II. Example Response: 失败示例

{
    "code": -1,
    "data": [],
    "message": "no arcade found"
}

Status Code: 404


4. getArcadeList/province(获取某省份机厅列表)

Endpoint:

Method: GET
Type:
URL: {{url}}/getArcadeList/province/:provinceCode

URL variables:

Key Value Description
provinceCode 0

More example Requests/Responses:

I. Example Request: 成功示例

Query:

Key Value Description
provinceCode 11

Body: None

I. Example Response: 成功示例

{
    "code": 0,
    "data": [
        {
            "arcade_id": 1011,
            "arcade_name": "北京乐酷电玩",
            "machine_count": 2,
            "address": "北京市海淀区远大路一号世纪金源购物中心5楼",
            "province": {
                "code": 11,
                "name": "北京市",
                "full_code": "110000000000"
            },
            "city": {
                "code": 1101,
                "name": "市辖区",
                "province_code": 11,
                "full_code": "110100000000"
            }
        },
        {
            "arcade_id": 1018,
            "arcade_name": "风云再起北京西单店",
            "machine_count": 2,
            "address": "北京市西城区堂子胡同9号新一代商城六层",
            "province": {
                "code": 11,
                "name": "北京市",
                "full_code": "110000000000"
            },
            "city": {
                "code": 1101,
                "name": "市辖区",
                "province_code": 11,
                "full_code": "110100000000"
            }
        },
        ...
    ]
}

Status Code: 200


II. Example Request: 失败示例

Query:

Key Value Description
provinceCode 0

Body: None

II. Example Response: 失败示例

{
    "code": -1,
    "data": [],
    "message": "no arcade found"
}

Status Code: 404


Count(人数)

1. getCount(获取机厅人数)

Endpoint:

Method: GET
Type:
URL: {{url}}/getCount/:arcadeID

URL variables:

Key Value Description
arcadeID 1001

More example Requests/Responses:

I. Example Request: 成功示例

Query:

Key Value Description
arcadeID 1002

Body: None

I. Example Response: 成功示例

{
    "code": 0,
    "data": [
        {
            "arcade_id": 1002,
            "count": 0,
            "update_timestamp": 1703606400000,
            "type": 0
        }
    ],
    "message": "success"
}

Status Code: 200


II. Example Request: 失败示例

Query:

Key Value Description
arcadeID 0

Body: None

II. Example Response: 失败示例

{
    "code": -1,
    "message": "arcade not found"
}

Status Code: 500


2. getCountByCity(获取城市出勤人数)

【主要给网页工具使用,没有失败示例】

Endpoint:

Method: GET
Type:
URL: {{url}}/getCountByCity/:arcadeID

URL variables:

Key Value Description
arcadeID 1101

More example Requests/Responses:

I. Example Request: 成功示例

Query:

Key Value Description
arcadeID 1101

Body: None

I. Example Response: 成功示例

{
    "code": 0,
    "data": {
        "1011": 0,
        "1018": 0,
        "1022": 0,
        "1110": 0,
        "1169": 0,
        "1258": 0,
        "1279": 0,
        "1289": 0,
        "1366": 0,
        "1403": 0,
        "1440": 0,
        "1468": 0,
        "1476": 0,
        "1485": 0,
        "1504": 0,
        "1525": 0,
        "1533": 0,
        "1601": 0,
        "1615": 0,
        "1691": 0,
        "1740": 0,
        "1808": 0,
        "1813": 0,
        "1852": 0,
        "1861": 0,
        "1920": 0,
        "1984": 0,
        "2007": 0,
        "2036": 0,
        "2051": 0,
        "2069": 0,
        "2072": 0,
        "2076": 0,
        "2218": 0,
        "2228": 0,
        "2258": 0,
        "2266": 0,
        "2326": 0,
        "2337": 0,
        "2345": 0,
        "2381": 0,
        "2407": 0,
        "2439": 0,
        "2482": 0,
        "2506": 0,
        "2521": 0,
        "2569": 0,
        "2592": 0,
        "2622": 0
    },
    "message": "success"
}

Status Code: 200


3. logCount(记录机厅人数)

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/logCount

Body:

{
    "arcade_id": 1001,
    "count": 0,
    "type": 2,
    "token": "test"
}

More example Requests/Responses:

I. Example Request: 成功示例

Body:

{
    "arcade_id": 1001,
    "count": 1,
    "type": 2,
    "token": "test"
}

I. Example Response: 成功示例

{
    "code": 0
}

Status Code: 200


II. Example Request: 失败示例(token 错误)

Body:

{
    "arcade_id": 1001,
    "count": 1,
    "type": 2,
    "token": "test2"
}

II. Example Response: 失败示例(token 错误)

{
    "code": -1,
    "message": "invalid token"
}

Status Code: 400


III. Example Request: 失败示例(type=0)

Body:

{
    "arcade_id": 1001,
    "count": 1,
    "type": 0,
    "token": "test"
}

III. Example Response: 失败示例(type=0)

{
    "code": -1,
    "message": "I'm a teapot"
}

Status Code: 418


IV. Example Request: 失败示例(数量错误)

Body:

{
    "arcade_id": 1001,
    "count": -1,
    "type": 2,
    "token": "test"
}

IV. Example Response: 失败示例(数量错误)

{
    "code": -1,
    "message": "invalid count"
}

Status Code: 400


Admin(管理员用)

这里的 token 需要使用 TOTP 生成动态口令

1. createCustomArcade(创建机厅)

【即将弃用,机厅数据前往全国音游地图修改】

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/createCustomArcade

Body:

{
    "arcade_name": "机厅名称",
    "address": "机厅地址",
    "machine_count": 1, // 机台数量
    "province_code": 11, // 省份 ID
    "city_code": 1101, // 城市ID
    "token": "123456" // TOTP 动态密码
}

More example Requests/Responses:

I. Example Request: 示例

Body:

{
    "arcade_name": "机厅名称",
    "address": "机厅地址",
    "machine_count": 1, // 机台数量
    "province_code": 11, // 省份 ID
    "city_code": 1101, // 城市ID
    "token": "123456" // TOTP 动态密码
}

I. Example Response: 示例

{
    "code": -1,
    "message": "invalid token"
}

Status Code: 400


2. deleteArcade(删除机厅)

【即将弃用】

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/deleteArcade

Body:

{
    "arcade_id": 1101, // 机厅 ID
    "token": "123456" // TOTP 动态密码
}

3. updateArcade(从音游地图更新机厅)

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/updateArcade

Body:

{
    "token": "123456" // TOTP 动态密码
}

4. generateToken(生成 token)

Endpoint:

Method: POST
Type: RAW
URL: {{url}}/generateToken

Body:

{
    "token": "123456", // TOTP 动态密码
    "remark": "备注"
}

Back to top

Generated by docgen