中英文网站接口文档

中英文网站 API 接口文档


0. 获取第三方 private_token

GET /api/privateToken/:time

参数 类型 必需 默认 描述
time int true 当前时间
{
    "code": "200",
    "msg": "private_token",
    "data": {
        "private_token": "5TUCfxi16dGelanAXotOG%2B4Bx%2FML7dch9UxlESmJqgnlXtaqSN7aHNrAloiaNxsG"
    }
}

1. 图形验证码

1.1 获取 - 图形验证码

GET /api/captcha/send

参数 类型 必需 默认 描述
time int true 当前时间
{
    "code": 1,
    "msg": "验证码获取成功",
    "time": "1546255229",
    "data": {
        "captcha_key": "captcha-469285874176123",
        "expired_at": "有效期为5分钟",
        "captcha_image_content": "data:image/jpeg;base64...."
    }
}

1.2 校验 - 图形验证码

POST /api/captcha/check

参数 类型 必需 默认 描述
time int true 当前时间
captcha_key string true 验证码key
captcha_code string true 验证码
{
    "code": 1,
    "msg": "验证码校验成功",
    "time": "1546256418",
    "data": null
}

2.用户注册-登录-改密码

2.1 获取email验证码

GET /api/getEmailCode/:time/:email

参数 类型 必需 默认 描述
time int true 当前时间戳
email string true 邮箱
{
    "code": 200,
    "msg": "验证码发送成功,10分钟内有效,请注意查收!",
    "data": []
}

2.2 验证email验证码

POST /api/checkEmailCode/:time

参数 类型 必需 默认 描述
time int true 当前时间戳
email string true 邮箱
emailCode string true 验证码
{
    "code": "200",
    "msg": "验证码正确",
    "data": []
}

2.3 用户注册(注册付费见6.1)

POST /api/register/:time

参数 类型 必需 默认 描述
time int true 当前时间戳
email string true 邮箱
password string true 密码
password2 string true 重复密码
c_id string? true CRM对应id
{
    "code": "200",
    "msg": "用户注册成功",
    "data": {
        "userId": 6 //返回本地数据库用户id
    }
}

2.4 用户登录

POST /api/login/:time

参数 类型 必需 默认 描述
time int true 当前时间戳
email string true 邮箱
password string true 密码
{
    "code": 200,
    "msg": "登录成功",
    "data": {
        "id": "6",
        "email": "[email protected]",
        "c_id": "123",
        "create_time": "2019-01-10 11:48:09",
        "is_pay": "0",
        "complete_time": null,
        "token": "d7fa6fff8f2443672f6e2d5350920ce9"
    }
}

2.5 退出登录

POST /api/logout/:time

参数 类型 必需 默认 描述
time int true 当前时间戳
email string true 邮箱
token string true token
{
    "code": "200",
    "msg": "退出登录成功",
    "data": []
}

2.6 检测email是否存在于本地数据库

GET /api/checkEmailExists/:time/:email/:is

参数 类型 必需 默认 描述
time int true 当前时间戳
email string true 邮箱
is string true 是否希望存在

is == 2 时, 希望存在,并返回完整结果=> 符合期望200,不符合400;
is == 3 时, 希望不存在,并返回完整结果=>符合期望200,不符合400

{
    "code": 200,
    "msg": "邮箱已注册",
    "data": []
}

2.7 忘记密码-发送密码重置邮件

GET /api/forgetPwd/:time/:email

参数 类型 必需 默认 描述
time int true 当前时间戳
email string true 邮箱
{
    "code": 200,
    "msg": "密码重置邮件发送成功,30分钟内有效,请注意查收!",
    "data": []
}

2.7 忘记密码-重置密码

GET /api/changePwd/:time

参数 类型 必需 默认 描述
time int true 当前时间戳
t string true 从邮件url中获取的加密字符串
password string true 密码
password2 string true 重复密码
{
    "code": "200",
    "msg": "重置密码成功",
    "data": []
}

2.8 判断登录状态

POST /api/checkLogin/:time

参数 类型 必需 默认 描述
time int true 当前时间戳
email string true 用户邮箱
token string true token
{
    "code": "200",
    "msg": "已登录",
    "data": {
        "id": "8",
        "email": "[email protected]",
        "c_id": "8",
        "create_time": "2019-01-21 10:13:17",
        "is_pay": "1",
        "complete_time": "2019-01-21 10:48:02",
        "token": "66272c0d5949d160408656baae134a78"
    }
}

如果token有效,返回新的token及当前用户信息; 如果token无效,则报400

3. 新闻

3.1 获取新闻列表

GET /api/news/:time/:num/:page

参数 类型 必需 默认 描述
time int true 当前时间
num int true 每页的个数
page int true 第几页
{
    "code": 200,
    "msg": "查询成功!",
    "data": {
        "news": [
            {
                "id": "1",
                "title": "新闻1",
                "content": "新闻1",
                "img_url": "/Uploads/Picture/2019-01-09/5c358626aa2b7.png",
                "label_name": "新闻1",
                "link_url": "",
                "create_time": "2019-01-08 14:10:27"
            }
        ],
        "count": 3// 总条数
    }
}

3.2 获取新闻详情

GET /api/news/:time/:id

参数 类型 必需 默认 描述
time int true 当前时间
id int true 新闻id
{
    "code": 200,
    "msg": "查询成功!",
    "data": {
        "news": {
            "id": "1",
            "title": "新闻1",
            "content": "新闻1",
            "img_url": "/Uploads/Picture/2019-01-09/5c358626aa2b7.png",
            "label_name": "新闻1",
            "link_url": "",
            "create_time": "2019-01-08 14:10:27"
        }
    }
}

4. 首页图片+背景图片

GET /api/homepage/:time/:category/:type

参数 类型 必需 默认 描述
time int true 当前时间
category string true 图片分类,可为 home 或 background
type int true 类型, 当category=home时, type可为1-2, 对应轮播图、trending图; 当category=background时,type可为1-5,对应登录背景、注册付款、找回密码、找回密码发邮件、找回密码-重设密码
{
    "code": "200",
    "msg": "首页图片",
    "data": [
        {
            "id": "1",
            "type": "1",
            "title": "首页轮播1",
            "img_url": "/Uploads/Picture/2019-01-09/5c358626aa2b7.png",
            "link_url": "",
            "order_num": "0"
        },
        {
            "id": "3",
            "type": "1",
            "title": "轮播2",
            "img_url": "/Uploads/Picture/2019-01-09/5c358626aa2b7.png",
            "link_url": "",
            "order_num": "0"
        }
    ]
}

5. 用户个人中心文章(需要登录状态)

5.1 文章列表

POST /api/article/:time/:num/:page

参数 类型 必需 默认 描述
time int true 当前时间
num int true 分页后每页条数
page int true 分页第几页
id int true 用户id
email string true 用户邮箱
token string true 登录token
{
    "code": 200,
    "msg": "查询成功!",
    "data": {
        "articles": [
            {
                "id": "3",
                "title": "文章3",
                "img_url": "",
                "label_name": "",
                "content": "文章3",
                "create_time": "2019-01-12 15:59:12",
                "price": "0",
                "outer_chain": "",
                "order_id": null,
                "user_id": null,
                "buy_time": null
            },
            {
                "id": "2",
                "title": "文章2",
                "img_url": "",
                "label_name": "",
                "content": "文章2",
                "create_time": "2019-01-12 15:58:59",
                "price": "0",
                "outer_chain": "",
                "order_id": "3",
                "user_id": "4",
                "buy_time": "2019-01-12 15:58:16"
            },
            {
                "id": "1",
                "title": "文章1",
                "img_url": "/Uploads/Picture/2019-01-09/5c358626aa2b7.png",
                "label_name": "",
                "content": "文章1文章1文章1",
                "create_time": "2019-01-11 17:59:01",
                "price": "0",
                "outer_chain": "",
                "order_id": "1",
                "user_id": "4",
                "buy_time": "2019-01-12 15:57:21"
            }
        ],
        "count": 10,// 总条数
        "user": {
            "id": "6",
            "email": "[email protected]",
            "c_id": "123",
            "create_time": "2019-01-10 11:48:09",
            "is_pay": "0",
            "complete_time": null,
            "token": "b80b833caa86da9b01737891cbba4b4d"
        }
    }
}

5.2 文章详情

POST /api/article/:time

参数 类型 必需 默认 描述
time int true 当前时间
email string true 用户邮箱
id int true 用户id
token string true 登录token
article_id int true 文章id
{
    "code": 200,
    "msg": "查询成功!",
    "data": {
        "article": {
            "id": "1",
            "title": "文章1",
            "img_url": "/Uploads/Picture/2019-01-09/5c358626aa2b7.png",
            "label_name": "",
            "content": "文章1文章1文章1",
            "create_time": "2019-01-11 17:59:01",
            "price": "0",
            "outer_chain": "",
            "order_id": "1",
            "user_id": "6",
            "buy_time": "2019-01-12 15:57:21"
        },
        "user": {
            "id": "6",
            "email": "[email protected]",
            "c_id": "123",
            "create_time": "2019-01-10 11:48:09",
            "is_pay": "0",
            "complete_time": null,
            "token": "4639ec85f67db0843f67b6f9b1d84de9"
        }
    }
}

6. 微信支付

6.1

POST /api/native/:time

参数 类型 必需 默认 描述
time int true 当前时间
type int true 支付类型,1注册 or 2文章
user_id int true 用户id
article_id int false 文章id, 文章付费时需要

价格为0时,直接返回订单号; 价格不为0时,返回订单号和base64二维码

{
    "code": "200",
    "msg": "返回二维码图片及订单号",
    "data": {
        "src": "data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAN4AAADeAQMAAABoqSz0AAAABlBMVEX///8AAABVwtN+AAABTElEQVRYhe2X0Q3DIAxELTEAI7F6RsoASK7vHAJVMsBFwkIN5fWjpueza7ZjxzfDEUdxxzrNKt53VYhnPcxat1b86NibLqweB5FHfKRzRWbiMF5x5bj4T8A4g1LeU9GBlEmBrimQFw0JwSzBXu/1rE8hmBFW4WfLPB4hBEPI9LaZBKStCoNEEnC4yg19ThlC0SfOHNdvi0bkYGSCR6UZD70IQ1hFdubIBm1EGZ647+HBzenHXRWyG8/OjLRmCcrBMtqajy5XphkLwjjDIAmSip6WLAdXUVDU/jdhiMEswX5dvKdnyMLOKRLtovIXSNvQhRgkYcbZ9DgBmSocAoGc2e5sactyML97+oSxdSxjmhzMUZ1u0VIgq0zkYPYNtDtcvHNeE4f3PnhZvU8S5jiZ5XiNbJrQ+JedQxn311ypCUcJOmHLwcdU4Y4dX4sf6lYWnWGyTT8AAAAASUVORK5CYII=",
        "order_id": "1000201901161536005337"
    }
}
{
    "code": "201",
    "msg": "生成免费注册订单,并且自动支付成功",
    "data": {
        "order_id": "1000201901181132281564"
    }
}

6.2

POST /api/checkOrderStatus/:time

参数 类型 必需 默认 描述
time int true 当前时间
order_id int true 订单号
{
    "code": "400",
    "msg": "未支付",
    "data": []
}

你可能感兴趣的:(中英文网站接口文档)