接口文档.md 20 KB

站点信息接口

接口地址: /api/index/siteinfo

更新时间: 2023-05-19

请求方式:get / post

请求数据:无

响应数据:

{
    "code": 1,
    "err_code": 0,
    "msg": "success",
    "time": "1682828132",
    "data": {
        "appointment_time_limit":1, //临近几小时不可预约
        "banners": [    //轮播图
            {
                "id": 1,
                "name": "图片1", //轮播图标题
                "pid": 1,
                "value": "http:\/\/local.appointment.com\/admin\/index\/index.html",  //跳转地址
                "description": "",
                "image":"https:\/\/iph.href.lu\/400x200\/?text=%E8%BD%AE%E6%92%AD%E5%9B%BE%E7%89%872&fg=666666&bg=cccccc", //轮播图地址
                "status": 1,
                "single_status": 0,
                "sort": 0
            },
            {
                "id": 2,
                "name": "图片2",
                "pid": 1,
                "value": "http:\/\/local.appointment.com\/admin\/index\/index.html",
                "description": "",
                "image":"https:\/\/iph.href.lu\/400x200\/?text=%E8%BD%AE%E6%92%AD%E5%9B%BE%E7%89%872&fg=666666&bg=cccccc",
                "status": 1,
                "single_status": 0,
                "sort": 0
            }
        ],
        "boxs": [   //模块
            {
                "id": 4,
                "name": "心里咨询", //模块标题
                "pid": 2,
                "value": "http:\/\/local.appointment.com\/admin\/index\/index.html",  //跳转地址
                "description": "",
                "image":"https:\/\/iph.href.lu\/400x200\/?text=%E8%BD%AE%E6%92%AD%E5%9B%BE%E7%89%872&fg=666666&bg=cccccc", //封面图地址
                "status": 1,
                "single_status": 0,
                "sort": 0,
                "color":"#31bdec"
            },
            {
                "id": 5,
                "name": "法律咨询",
                "pid": 2,
                "value": "",
                "description": "",
                "image": 7,
                "status": 1,
                "single_status": 0,
                "sort": 0,
                "color":""
            }
        ],
        "contact_us": "0595-88052395",  //联系电话
        "announcements": [         //公告
            {
                "id": 4,
                "title": "国际新闻",
                "thumb": 8,
                "thumb_url": "http://local.appointment.com/uploads/admin/article_content/20230421/ee2a2b125a3c174e11683530a931a69e.jpg"
                "content": "<p>士大夫撒地方水电费asd<\/p><p>士大夫撒地方水电费地方<\/p>",
                "admin_id": 1,
                "create_time": "2023-04-23 18:00:47"
            },
            {
                "id": 2,
                "title": "测试",
                "thumb": 4,
                "thumb_url": "http://local.appointment.com/uploads/admin/article_content/20230421/ee2a2b125a3c174e11683530a931a69e.jpg"
                "content": "<p>测试<img src=\"\/uploads\/admin\/article_content\/20230421\/ee2a2b125a3c174e11683530a931a69e.jpg\" style=\"max-width: 100%;\"\/>的范德萨发生的<\/p><p>士大夫撒地方  水电费水电费水电费水电费sdf<\/p><p>是的发生的是的<\/p>",
                "admin_id": 1,
                "create_time": "2023-04-21 18:58:00"
            },
            {
                "id": 1,
                "title": "联系我们",
                "thumb": 0,
                "thumb_url": "http://local.appointment.com/uploads/admin/article_content/20230421/ee2a2b125a3c174e11683530a931a69e.jpg"
                "content": "<p>我们的地址是 xxx 市区 xxx 街道 xxx 号<\/p><p><br\/><\/p><p><img src=\"http:\/\/local.appointment.com\/static\/public\/images\/tx.jpg\" style=\"max-width:100%;\"\/><br\/><\/p>",
                "admin_id": 1,
                "create_time": "2023-04-20 23:48:32"
            }
        ],
        "notice": {   //家庭教育咨询来访须知
            "title": "家庭教育咨询来访须知",  //标题
            "content": "<p>一、遵守保密原则,家庭教育指导师不会泄露来访者的电话、信息和咨询内容。<br\/>二、每次咨询时长为45分钟,来访者需准时到达。<br\/>三、中心仅对平台预约的服务负责,若有后续咨询意向,由家庭教育指导师和来访者个人负责,中心对此不承担任何责任。<br\/>四、本中心家庭教育服务咨询为公益免费项目,为保证公共资源不被浪费,取消预约需提前24小时。<br\/>五、最终解释权归晋江市家庭教育指导中心所有。<br\/>点击确认即表示完全知晓并同意以上规则。<br\/><\/p>"
        },
        "siteinfo":"网站名"
    }
}

登入接口

接口地址:/api/common/login

请求方式:跳转地址方式

请求数据:

参数名 说明 备注
return_url 前端的回调地址 max:500

响应数据:

登入成功将跳到地址: return_url?jwt={登入令牌}
前端需获取jwt,用于后续部分用户权限接口
如何使用jwt:
推荐在header里携带 x-token:jwt(安全性比较好),也可以get/post提交
前端需要处理登入过期时的响应:
{
    "code": 0, // 返回状态,1代表成功,0代表失败
    "msg": "登入过期", // 返回消息
    "time": "1586490789", // 响应时间戳
    "err_code" : 1 //判断code=0 且 err_code=1 时,表示需要重新登入
}

用户信息接口

接口地址:/api/user/info

请求方式:post / get

请求数据:

参数名 说明 备注
x-token 登入令牌jwt 必填

响应数据:(json格式)

{
    "code": 1,
    "err_code": 0,
    "msg": "success",
    "time": "1682778816",
    "data": {
        "nickname": "111", //昵称
        "head_pic": "",  //头像
        "sex": 0,   //性别:0未知,1男,2女
        "country": "", //国家
        "province": "", //省份
        "city": ""   //城市
    }
}

提交反馈

接口地址:/api/user/feedback

请求方式:post

请求数据:

参数名 说明 备注
x-token 登入令牌jwt 必填
content 内容 max:500

响应数据:(json格式)

{
    "code": 1, // 返回状态,1代表成功,0代表失败
    "msg": "success", // 返回消息
    "time": "1586490789", // 响应时间戳
    "data": null // 结果数据,json格式,没数据时为 null
}

查询公告列表

接口地址:/api/announcement/index

请求方式:get

请求数据:

参数名 说明 备注
page 第几页,默认1 int
pagenum 每页几条,默认20 int,<=1000

响应数据:

{
    "code": 1,
    "err_code": 0,
    "msg": "查询成功",
    "time": "1682076315",
    "data": {
        "per_page": 20, //分页数
        "current_page": 1, //当前页码
        "has_more": false, //是否还有下一页
        "next_item": null, //下一条数据
        "data": [
            {
                "id": 1,
                "title": "联系我们",
                "thumb_url": "http://local.appointment.com/uploads/admin/article_content/20230421/ee2a2b125a3c174e11683530a931a69e.jpg"
                "content": "<p>我们的地址是 xxx 市区 xxx 街道 xxx 号<\/p><p><br\/><\/p><p><img src=\"http:\/\/local.appointment.com\/static\/public\/images\/tx.jpg\" style=\"max-width:100%;\"\/><br\/><\/p>",
                "admin_id": 1,
                "create_time": "2023-04-20 23:48:32"
            },
            {
                "id": 2,
                "title": "测试",
                "thumb_url": "http://local.appointment.com/uploads/admin/article_content/20230421/ee2a2b125a3c174e11683530a931a69e.jpg"
                "content": "<p>测试<img src=\"\/uploads\/admin\/article_content\/20230421\/ee2a2b125a3c174e11683530a931a69e.jpg\" style=\"max-width: 100%;\"\/><\/p>",
                "admin_id": 2,
                "create_time": "2023-04-21 18:58:00"
            }
        ]
    }
}

查询专家列表

接口地址:/api/specialist/index

更新时间: 2023-05-06

请求方式:get / post

请求数据:

参数名 说明 备注
id 用ID查询专家 int
module 按模块ID查专家列表 int
page 第几页,默认1 int
pagenum 每页几条,默认20 int,<=:1000

响应数据:

{
    "code": 1,
    "err_code": 0,
    "msg": "查询成功",
    "time": "1682090806",
    "data": {
        "per_page": 20, //分页数
        "current_page": 1,//当前页码
        "has_more": false,//是否还有下一页
        "next_item": null, //下一条数据
        "data": [
            {
                "id": 1,
                "name": "张站长", //姓名
                "title": "心里医生", //职称
                "head_pic": "http://xxxxxxxx", //头像
                "sex": 1, //性别:0未知 1男 2女
                "desc": "心里医生", //简介
                "consultation_direction": "心里医生",//咨询方向
                "address_id": 1, //地址id
                "phone":"123123" //联系电话
            }
        ]
    }
}

获取地址列表

接口地址:/api/appointment/addressList

请求方式:get / post

请求数据:

参数名 说明 备注
page 第几页,默认1 int
pagenum 每页几条,默认20 int,<=:1000

响应数据:

{
    "code": 1,
    "err_code": 0,
    "msg": "查询成功",
    "time": "1682257527",
    "data": {
        "per_page": 20,
        "current_page": 1,
        "has_more": false,
        "next_item": null,
        "data": [
            {
                "id": 1,
                "title": "厦门曙光医院",
                "thumb_url": "http://local.appointment.com/uploads/admin/article_content/20230421/ee2a2b125a3c174e11683530a931a69e.jpg"
                "address": "福建省厦门市湖里区金尚路127号"
            },
            {
                "id": 2,
                "title": "厦门前埔医院",
                "thumb_url": "http://local.appointment.com/uploads/admin/article_content/20230421/ee2a2b125a3c174e11683530a931a69e.jpg"
                "address": "地址 : 福建省厦门市湖里区仙岳路3777号\r\n电话 : 0592-5262666"
            }
        ]
    }
}

按地址获取号源信息

接口地址:/api/appointment/getTicketByAddressId

更新时间: 2023-05-01

请求方式:get / post

请求数据:

参数名 说明 备注
address_id 地址ID 必填,int
daytime 日期,默认今天 dateFormat:y-m-d

响应数据:(json格式)

{
    "code": 1,
    "err_code": 0,
    "msg": "查询成功",
    "time": "1682911870",
    "data": [
        {
            "id": 19,               //号源ID
            "appointment_id": 5,
            "appointment_daytime": "2023-05-01",  //排号日期
            "provider_id": 18,
            "address_id": 1,
            "morning_remaining": 3,   // 上午剩余(预约号个数)
            "afternoon_remaining": 20,  // 下午剩余
            "night_remaining": 11,     // 晚上剩余
            "status": 1,
            "morning_time_period": [
                {
                    "period": "11:24:00 - 11:36:00",  // 上午可预约时间段
                    "status": 0                       // 状态 , 0 可预约 , 1 已被预约
                },
                {
                    "period": "11:36:00 - 11:48:00",
                    "status": 0
                },
                {
                    "period": "11:48:00 - 12:00:00",
                    "status": 0
                }
            ],
            "afternoon_time_period": [             // 下午可预约时间段
                {
                    "period": "14:00:00 - 14:12:00",
                    "status": 0
                },
                {
                    "period": "14:12:00 - 14:24:00",
                    "status": 0
                }
            ],
            "night_time_period": [              // 晚上可预约时间段
                {
                    "period": "20:00:00 - 20:23:59",
                    "status": 0
                },
                {
                    "period": "20:23:59 - 20:47:58",
                    "status": 0
                }
            ],
            "appointment": {     //放号设置信息
                "id": 5,
                "provider_id": 18,
                "weeks": 0,  //按工作日排号
            },
            "specialist": {   //专家信息
                "id": 18,
                "name": "庄奕漩",
                "title": "社会",
                "head_pic": "",
                "sex": 0,
                "desc": "",
                "consultation_direction": "",
                "address_id": 1,
                "phone": ""
            }
        }
    ]
}

按时间获取地址列表

接口地址:/api/appointment/addressListByDayTime

请求方式:get / post

请求数据:

参数名 说明 备注
daytime 日期,默认今天 dateFormat:y-m-d
page 第几页,默认1 int
pagenum 每页几条,默认20 int,<=:1000

响应数据:

{
    "code": 1,
    "err_code": 0,
    "msg": "查询成功",
    "time": "1682261424",
    "data": {
        "per_page": 20,
        "current_page": 1,
        "has_more": false,
        "next_item": null,
        "data": [
            {
                "id": 1,
                "title": "厦门曙光医院",
                "thumb_url": "",
                "address": "福建省厦门市湖里区金尚路127号"
            }
        ]
    }
}

预约申请

接口地址:/api/user/application

更新时间: 2023-05-01

请求方式:get / post

请求数据:

参数名 说明 备注
x-token 登入令牌jwt require必填
name 姓名 require , max:50
age 年龄 int
birthday 出生年月 string , max:50
sex 性别:1男 2女 int
phone 电话 require,max:50
id_card 身份证 max:50
problem_desc 问题描述 max:200
requirement_desc 需求描述 max:200
appointment_ticket_id 号源id require, int
appointment_period 时段:1上午,2下午,3晚上 require, int
appointment_time 预约时间段 require, dateFormat: H:i:s - H:i:s
city 来自城市 max:50
job 职业 max:50
education_level 受教育程度:1小学,2初中,3高中,4大学及以上 number, in:0,1,2,3,4
home_address 家庭住址 max:255
marriage 婚姻情况:0未婚,1己婚,2离异 number, in:0,1,2
problem_type 咨询问题类别:0其他,1自我意识,2人际关系,3亲子关系,4情绪问题,5学习问题 number, in:0,1,2,3,4,5
childs_num_str 子女数量,年龄,性别 ,字符串格式 max:255

| childs_num | 子女数量:0无,1一孩、2二孩、3三孩 | int, in:1,2,3 | | childs_age1| 一孩年龄 | number | | childs_age2| 二孩年龄 | number | | childs_age3| 三孩年龄 | number | | childs_sex1 | 一孩性别 | number | | childs_sex2 | 二孩性别 | number | | childs_sex3 | 三孩性别 | number |

响应数据:

{
    "code": 0,
    "err_code": 0,
    "msg": "此账号 30 天内爽约 3 次, 2 天内不能再预约",
    "time": "1682333036",
    "data": null
}
{
    "code": 1,
    "err_code": 0,
    "msg": " 预约成功",
    "time": "1682332924",
    "data": null
}

取消预约

接口地址: /api/user/cancelApplication

更新时间: 2023-05-12

请求方式:get / post

请求数据:

参数名 说明 备注
x-token 登入令牌jwt 必填
id 预约id int

响应数据:

{
    "code": 1,
    "msg": " 提交成功",
    "time": "1682332924",
    "data": null
}

我的预约列表

接口地址:/api/user/applicationList

请求方式:get / post

参数名 说明 备注
x-token 登入令牌jwt 必填
status 状态 (默认0): 0全部,1待完成,2已完成 int
page 第几页,默认1 int
pagenum 每页几条,默认20 int,<=:1000

响应数据:

{
    "code": 1,
    "err_code": 0,
    "msg": "查询成功",
    "time": "1682333270",
    "data": {
        "per_page": 20,
        "current_page": 1,
        "has_more": false,
        "next_item": null,
        "data": [
            {
                "id": 3,
                "name": "小明",
                "user_id": 1,
                "age": 0,
                "birthday": "",
                "sex": 0,
                "phone": "1231214545",
                "id_card": "",
                "childs_num": 0,
                "problem_desc": "",
                "requirement_desc": "",
                "address_id": "1",
                "provider_id": 1,
                "appointment_ticket_id": 1,
                "appointment_date": "2023-01-02",
                "appointment_time": "08:00:00 - 12:00:00",
                "status": 0,
                "remark": "",
                "create_time": "2023-04-24 18:42:04",
                "finish_time": "",
                "address": {
                    "id": 1,
                    "title": "厦门曙光医院",
                    "thumb_url":"",
                    "address": "福建省厦门市湖里区金尚路127号"
                },
                "specialist": {
                    "id": 1,
                    "name": "张站长",
                    "title": "心里医生",
                    "head_pic": "https:\/\/iph.href.lu\/400x200\/?text=%E5%BF%83%E9%87%8C%E5%92%A8%E8%AF%A2&fg=666666&bg=cccccc",
                    "sex": 2,
                    "desc": "心里医生",
                    "consultation_direction": "心里医生",
                    "address_id": 1,
                    "phone": "12121212"
                }
            },
            {
                "id": 2,
                "name": "小明",
                "user_id": 1,
                "age": 0,
                "birthday": "",
                "sex": 0,
                "phone": "1231214545",
                "id_card": "",
                "childs_num": 0,
                "problem_desc": "",
                "requirement_desc": "",
                "address_id": "1",
                "provider_id": 1,
                "appointment_ticket_id": 1,
                "appointment_date": "2023-01-02",
                "appointment_time": "08:00:00 - 12:00:00",
                "status": 0,
                "remark": "",
                "create_time": "2023-04-24 18:42:02",
                "finish_time": "",
                "address": {
                    "id": 1,
                    "title": "厦门曙光医院",
                    "thumb_url":"",
                    "address": "福建省厦门市湖里区金尚路127号"
                },
                "specialist": {
                    "id": 1,
                    "name": "张站长",
                    "title": "心里医生",
                    "head_pic": "https:\/\/iph.href.lu\/400x200\/?text=%E5%BF%83%E9%87%8C%E5%92%A8%E8%AF%A2&fg=666666&bg=cccccc",
                    "sex": 2,
                    "desc": "心里医生",
                    "consultation_direction": "心里医生",
                    "address_id": 1,
                    "phone": "12121212"
                }
            }
        ]
    }
}