ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 自定义表单(Diyform) ## 获取字段接口\[index\]【编辑需登录】 获取编辑或添加的表单字段接口 ### 请求URL http://www.yoursite.com/addons/cms/api.diyform/index ### 请求方法 GET ### 请求参数 | Body参数名 | 类型 | 必需 | 描述 | 示例 e.g. | | --- | --- | --- | --- | --- | | diyname | string | 否 | 表单名称,为空则默认第一个 | message | | id | number | 否 | 表单数据id,编辑时传 | 1 | ### 返回值 ~~~json { "code": 1, "msg": "", "time": "1616741008", "data": { "diyform": { "id": 1, "name": "留言", "title": "留言", "seotitle": "", "keywords": "留言板", "description": "欢迎给我们留言反馈你的问题", "fields": "name,telephone", "needlogin": 0, "isedit": 1, "successtips": "留言已成功提交,我们会在第一时间进行处理", "redirecturl": "", "diyname": "message", "usermode": "all", "statusmode": "normal", "createtime": 1540091957, "updatetime": 1606787163, "setting": { "orderfields": [ "createtime" ] }, "status": "normal", "url": "/cms/d/message.html" }, "fields": [ { "id": 1, "source": "diyform", "source_id": 1, "name": "name", "type": "string", "title": "姓名", "content": "value1|title1\r\nvalue2|title2", "defaultvalue": "", "rule": "required", "msg": "", "ok": "", "tip": "", "decimals": 0, "length": 50, "minimum": 0, "maximum": 0, "extend": "", "setting": null, "weigh": 136, "createtime": 1540110334, "updatetime": 1540110334, "isorder": 0, "iscontribute": 1, "isfilter": 0, "status": "normal", "value": "", "content_list": "value1|title1\r\nvalue2|title2", "isrequire": true }, { "id": 2, "source": "diyform", "source_id": 1, "name": "telephone", "type": "string", "title": "手机", "content": "value1|title1\r\nvalue2|title2", "defaultvalue": "", "rule": "required; mobile", "msg": "", "ok": "", "tip": "", "decimals": 0, "length": 50, "minimum": 0, "maximum": 0, "extend": "", "setting": null, "weigh": 135, "createtime": 1540110369, "updatetime": 1540110369, "isorder": 0, "iscontribute": 1, "isfilter": 0, "status": "normal", "value": "", "content_list": "value1|title1\r\nvalue2|title2", "isrequire": false } ] } } ~~~ ## 提交或修改表单数据接口\[postForm\]【需登录】 提交或修改表单数据 ### 请求URL http://www.yoursite.com/addons/cms/api.diyform/postForm ### 请求方法 POST ### 请求参数 | Body参数名 | 类型 | 必需 | 描述 | 示例 e.g. | | --- | --- | --- | --- | --- | | {} | object | 是 | 提交的表单对象数据 | {name:"测试",telephone:"18333333333"} | ### 返回值 ~~~json { "code": 1, "msg": "留言已成功提交,我们会在第一时间进行处理", "time": "1616741526", "data": null } ~~~ ## 获取表单数据列表接口\[formList\] 获取表单数据列表接口 ### 请求URL http://www.yoursite.com/addons/cms/api.diyform/formList ### 请求方法 GET ### 请求参数 | Body参数名 | 类型 | 必需 | 描述 | 示例 e.g. | | --- | --- | --- | --- | --- | | orderby | string | 否 | 排序字段 | default | | orderway | string | 否 | 排序方式 | desc | | page | number | 是 | 文档id | 1 | | diyname | string | 否 | 表单名称,为空则默认第一个 | message | > 更多条件见`filterList`和`orderList` ### 返回值 ~~~json { "code": 1, "msg": "", "time": "1616741960", "data": { "pageList": { "total": 3, "per_page": 15, "current_page": 1, "last_page": 1, "data": [ { "id": 9, "user_id": 1, "name": "留言君", "telephone": "18333333333", "qq": "123456", "content": "史蒂夫", "os": "windows", "language": "zh-cn", "address": "河北省/秦皇岛市/昌黎县", "category": "1,2", "memo": "", "image": [ "http://www.fa.com/uploads/2021/20210326/be50b9c1759142a4fb2e885f1de39aac.png" ], "createtime": 1616741527, "updatetime": 1616741527, "status": "hidden", "PHP": "2021-03-17 00:00:00 - 2021-03-19 23:59:59", "title": "", "images": "", "mobile": "value1" }, { "id": 6, "user_id": 1, "name": "PHP", "telephone": "18589834416", "qq": "1261502635", "content": "sdfsdf789789", "os": "windows", "language": "zh-cn,en", "address": "广西壮族自治区/贺州市/昭平县", "category": "Android开发,CRM系统 ,SASS平台软件,官方新闻,微信公众号,测试1", "memo": "", "image": [ "http://www.fa.com/uploads/2020/20200901/5871cf963ae2d5e2565b7a997db8500c.png" ], "createtime": 1598947226, "updatetime": 1598947774, "status": "hidden", "PHP": "", "title": "", "images": "", "mobile": null }, { "id": 5, "user_id": 1, "name": "赵六", "telephone": "13411111111", "qq": "123456", "content": "一键压缩打包JS和CSS文件,一键CDN静态资源部署,一键生成控制器菜单和规则", "os": "windows", "language": "zh-cn", "address": "安徽省/芜湖市/弋江区", "category": "12,1", "memo": "需要需要需要需要", "image": [ "https://cdn.demo.fastadmin.net/uploads/2019/20190328/30752b442c826ab7d3a63f1ddfb5d9ac.png", "https://cdn.demo.fastadmin.net/uploads/2019/20190328/c9abe74b02cd5789f08bb47e5d18d1aa.png", "https://cdn.demo.fastadmin.net/uploads/2019/20190328/242c72f8f3d4515b045875d4093d4bfa.png", "https://cdn.demo.fastadmin.net/uploads/2019/20190328/c503015461309deefc8d75be6372bbe4.png" ], "createtime": 1597200638, "updatetime": 1597221389, "status": "hidden", "PHP": "", "title": "", "images": "", "mobile": null } ] }, "orderList": [ { "name": "default", "field": "createtime DESC,id DESC", "title": "默认", "active": true, "url": "?filter[language]=zh-cn&orderby=default&orderway=asc" }, { "name": "createtime", "field": "createtime", "title": "添加时间", "active": false, "url": "?filter[language]=zh-cn&orderby=createtime&orderway=desc" } ], "filterList": [ { "name": "os", "title": "操作系统", "content": [ { "value": "", "title": "全部", "active": true, "url": "?language=zh-cn&orderby=default&orderway=desc" }, { "value": "windows", "title": "Windows", "active": false, "url": "?language=zh-cn&os=windows&orderby=default&orderway=desc" }, { "value": "mac", "title": "Mac", "active": false, "url": "?language=zh-cn&os=mac&orderby=default&orderway=desc" } ] }, { "name": "language", "title": "语言", "content": [ { "value": "", "title": "全部", "active": false, "url": "?orderby=default&orderway=desc" }, { "value": "zh-cn", "title": "中文", "active": true, "url": "?language=&orderby=default&orderway=desc" }, { "value": "en", "title": "英文", "active": false, "url": "?language=en&orderby=default&orderway=desc" } ] }, { "name": "mobile", "title": "手机号码", "content": [ { "value": "", "title": "全部", "active": true, "url": "?language=zh-cn&orderby=default&orderway=desc" }, { "value": "value1", "title": "title1", "active": false, "url": "?language=zh-cn&mobile=value1&orderby=default&orderway=desc" }, { "value": "value2", "title": "title2", "active": false, "url": "?language=zh-cn&mobile=value2&orderby=default&orderway=desc" } ] } ] } } ~~~ ## 绑定详情\[show\] 绑定详情 ### 请求URL http://www.yoursite.com/addons/cms/api.diyform/show ### 请求方法 GET ### 请求参数 | Body参数名 | 类型 | 必需 | 描述 | 示例 e.g. | | --- | --- | --- | --- | --- | | diyname | string | 否 | 表单名称,为空则默认第一个 | message | | id | number | 是 | 表单数据id | 1 | ### 返回值 ~~~json { "code": 1, "msg": "", "time": "1616747583", "data": { "fieldsList": [ { "id": 1, "source": "diyform", "source_id": 1, "name": "name", "type": "string", "title": "姓名", "content": "value1|title1\r\nvalue2|title2", "defaultvalue": "", "rule": "required", "msg": "", "ok": "", "tip": "", "decimals": 0, "length": 50, "minimum": 0, "maximum": 0, "extend": "", "setting": null, "weigh": 136, "createtime": 1540110334, "updatetime": 1540110334, "isorder": 0, "iscontribute": 1, "isfilter": 0, "status": "normal", "value": "PHP", "content_list": "value1|title1\r\nvalue2|title2", "isrequire": true }, { "id": 2, "source": "diyform", "source_id": 1, "name": "telephone", "type": "string", "title": "手机", "content": "value1|title1\r\nvalue2|title2", "defaultvalue": "", "rule": "required; mobile", "msg": "", "ok": "", "tip": "", "decimals": 0, "length": 50, "minimum": 0, "maximum": 0, "extend": "", "setting": null, "weigh": 135, "createtime": 1540110369, "updatetime": 1540110369, "isorder": 0, "iscontribute": 1, "isfilter": 0, "status": "normal", "value": "18589834416", "content_list": "value1|title1\r\nvalue2|title2", "isrequire": false } ], "diydata": { "id": 6, "user_id": 1, "name": "PHP", "telephone": "18589834416", "qq": "1261502635", "content": "sdfsdf789789", "os": "windows", "language": "zh-cn,en", "address": "广西壮族自治区/贺州市/昭平县", "category": "Android开发,CRM系统 ,SASS平台软件,官方新闻,微信公众号,测试1", "memo": "", "image": "/uploads/2020/20200901/5871cf963ae2d5e2565b7a997db8500c.png", "createtime": 1598947226, "updatetime": 1598947774, "status": "hidden", "PHP": "", "title": "", "images": "", "mobile": null }, "diyform": { "id": 1, "name": "留言", "title": "留言", "seotitle": "", "keywords": "留言板", "description": "欢迎给我们留言反馈你的问题", "fields": "name,telephone,qq,content,image,os,language,address,category,PHP,mobile", "needlogin": 0, "isedit": 1, "successtips": "留言已成功提交,我们会在第一时间进行处理", "redirecturl": "", "diyname": "message", "usermode": "all", "statusmode": "normal", "createtime": 1540091957, "updatetime": 1606787163, "setting": { "orderfields": [ "createtime" ] }, "status": "normal", "url": "/cms/d/message.html" } } } ~~~