Skip to content

动态相关接口

chwtbistu edited this page Nov 19, 2019 · 5 revisions

动态增、删、查找

方法:POST

参数介绍

字段名 含义
userId 用户编号
socialContent 动态内容
time 动态发布时间
location 定位信息,包括latitude经度和longitude纬度
address 地址信息

参数示例:

{
	"userId" : 1,
	"socialContent" : "first test",
	"time": "2019-11-7 13:34:00",
	"location" : {"latitude" : 11.05, "longitude" : 12.01},
        "address": "123455"
}
Code 返回值
成功 0
失败 -1

返回内容

数据库中新增记录详情

示例:

{
    "code": "0",
    "mesg": "ok",
    "data": {
        "userId": 1,
        "socialId": 1,
        "username": "test",
        "socialContent": "first test",
        "time": "2019-11-07 13:34:00",
        "praise": false,
        "commentsNum": 0,
        "address": "122344",
        "location": {
            "latitude": 11.05,
            "longitude": 12.01
        },
        "comments": null
    }
}

方法:DELETE

参数说明:

字段名 含义
sid 动态编号
Code 返回值
成功 0
失败 -1

方法:GET

参数说明:

字段名 含义
la 经度
lo 纬度
uid 发起请求的用户id
Code 返回值
成功 0
失败 -1

返回内容

数据库查找内容

{
    "code": "0",
    "mesg": "ok",
    "data": [
        {
            "userId": 2,
            "socialId": 1,
            "username": "xiaowang",
            "socialContent": "a test",
            "time": "2019-11-07 04:20:30",
            "praise": false,
            "commentsNum": 1,
            "location": {
                "latitude": 11.032,
                "longitude": 12.01
            },
            "comments": [
                {
                    "socialId": 1,
                    "userId": 1,
                    "username": "test",
                    "commentContent": "赞!",
                    "time": "2019-11-07 16:49:00",
                    "commentId": 2
                }
            ]
        },
        {
            "userId": 1,
            "socialId": 2,
            "username": "test",
            "socialContent": "第二次测试",
            "time": "2019-11-07 16:34:00",
            "praise": false,
            "commentsNum": 0,
            "location": {
                "latitude": 11.03,
                "longitude": 12.01
            },
            "comments": null
        }
    ]
}

方法:GET

参数说明:

字段名 含义
authorId 被访问用户id
userId 提出请求用户id
Code 返回值
成功 0
失败 -1

返回内容

数据库查找内容

{
    "code": "0",
    "mesg": "ok",
    "data": [
        {
            "userId": 2,
            "socialId": 1,
            "username": "xiaowang",
            "socialContent": "a test",
            "time": "2019-11-07 04:20:30",
            "praise": false,
            "commentsNum": 1,
            "location": {
                "latitude": 11.032,
                "longitude": 12.01
            },
            "comments": [
                {
                    "socialId": 1,
                    "userId": 1,
                    "username": "test",
                    "commentContent": "赞!",
                    "time": "2019-11-07 16:49:00",
                    "commentId": 2
                }
            ]
        }
    ]
}
Clone this wiki locally