=====资产表=====
资产表是表单的一种,您可在帮我吧后台设置某个表单用作资产表,可以将该资产表关联到客户档案,那么该表单就可以用来记录某个客户的资产,资产的形式可以根据场景的不同而不同,比如可以作为某个客户的“合同表”,可以作为某个客户的“购买明细”,也可作为某个客户的“回访记录”等等。
==== 请求参数 ====
^名称 ^必要的 ^类型 ^注释 ^
|page |否 |number |页码,默认为 1 |
|per_page |否 |number |每页大小,默认为 20 |
//说明:分页:数据返回条数太多时,会自动分页,默认每页20条,可以在请求url里更改per_page参数的值来自定义每页返回的条数,建议不要超过20条,因为会影响接口返回速度。 当请求的数据个数超过per_page参数值时,可设置自增的page参数继续请求下一页数据。
//
==== 返回参数 ====
^名称 ^类型 ^只读 ^必填 ^注释^
|tableId |int |是 |否 |资产表id,系统自动生成 |
|ownerType |varchar |否 |是 |资产表数据的所属人类型,取值为:agent-服务商,servicer-客服,contacter-联系人,company-公司,servicerGroup-客服组|
|owner |int |是 |是 |资产表数据的所属人,取值为:agent-服务商id,servicer-客服id,contacter-联系人id,company-公司id,servicerGroup-客服组id|
|rId |int |是 |否 |资产表某条数据的id,系统自动生成|
|ticketId |int |是 |否 |工单的唯一标识id,系统自动生成|
|unique_key |varchar |否 |否 |唯一值的字段唯一标识,根据这个标识搜索唯一值|
|unique_value |varchar |否 |否 |唯一值的取值,根据这个值更新数据|
|createTime |datetime |是 |否 |创建时间|
|updateTime |datetime |是 |否 |更新时间|
|relative_ticket_columnId |varchar |是 |否 |资产表对应的工单字段的id|
====JSON示例====
{
"rId": "25",
"field_1": "甜甜圈",
"field_2": "60",
"relative_ticket_columnId": "24441346",
"owner": "1331193",
"ownerType": "servicer",
"tableId": "3785437",
"createTime": "2021-11-11 14:29:36",
"updateTime": "2021-11-11 14:34:16",
"ticketId": "19665409"
}
====获取指定资产表的所有数据====
GET /api/v1/forms/asset_form/{tableId}.json
//说明:默认按编码升序返回//
**调用者权限**
管理员
**调用示例**
curl https://www.bangwo8.com/api/v1/forms/asset_form/3234.json \
-v -u {account}:{password}
**返回值示例**
Status: 200 OK
{
"asset_table":[
{
"rId": "67",
"field_1": "榴莲千层",
"field_2": "5",
"field_4": "4524913",
"field_5": [],
"field_3": "",
"relative_ticket_columnId": "24441346",
"field_6": "",
"owner": "1331193",
"ownerType": "servicer",
"tableId": "3785437",
"createTime": "2022-04-01 14:19:07",
"updateTime": "2022-04-01 14:19:07",
"ticketId": "22497808"
},
{
"rId": "65",
"field_1": "旺仔牛奶",
"field_2": "1000",
"field_3": "010",
"field_4": "4524913",
"field_5": [
{
"fileName": "部件.png",
"fileUrl": "874731/PZ6nBYMJA3.png"
}
],
"field_6_pid": "o1",
"field_6_curId": "o27",
"field_6": "北京市-丰台区",
"relative_ticket_columnId": "24441346",
"owner": "1331193",
"ownerType": "servicer",
"tableId": "3785437",
"createTime": "2022-04-01 14:19:07",
"updateTime": "2022-04-01 14:19:07",
"ticketId": "22497808"
}
]
}
====给指定资产表添加一行数据====
POST /api/v1/forms/asset_form/{tableId}.json
**调用者权限**
管理员
**调用示例**
curl -v -u {account}:{password} https://www.bangwo8.com/api/v1/forms/asset_form/61748.json \
-H "Content-Type: application/json" \
-X POST -d \
'{
"item_data": {
"owner": "1331193",
"ownerType": "servicer",
"ticketId":"356786",
"field_1": "旺仔小馒头",
"field_2": "1000",
"field_3": "011",
"field_4": "4524913",
"field_5": [
{
"fileName": "file1.png",
"fileUrl": "https://s2.loli.net/2022/03/18/lVYR7pDi3bG4HLm.png"
},
{
"fileName": "111.doc",
"fileUrl": "111.doc"
}
],
"field_6": "吉林省-长春市",
"relative_ticket_columnId":"26559664"
}
}'
说明:级联字段传输格式为"字段唯一标识":"aa-bb-cc"
**返回值示例**
Status: 200 OK
{
"item_data": {
"rId": "69",
"ticketId":"356786",
"field_1": "旺仔小馒头",
"field_2": "1000",
"field_3": "011",
"field_4": "4524913",
"field_6": "吉林省-长春市",
"field_5": [
{
"fileName": "file1.png",
"fileUrl": "https://s2.loli.net/2022/03/18/lVYR7pDi3bG4HLm.png"
},
{
"fileName": "111.doc",
"fileUrl": "111.doc"
}
],
"owner": "1331193",
"ownerType": "servicer",
"tableId": "3785437",
"createTime": "2022-04-01 14:29:56",
"updateTime": "2022-04-01 14:29:56",
"relative_ticket_columnId":"26559664"
}
}
====给指定资产表添加多行数据====
POST /api/v1/forms/asset_form/{tableId}.json
**调用者权限**
管理员
**调用示例**
curl -v -u {account}:{password} https://www.bangwo8.com/api/v1/forms/asset_form/61748.json \
-H "Content-Type: application/json" \
-X POST -d \
'{
"items_data": [
{
"field_1": "测试多条1",
"field_2": "50",
"field_3": "1",
"owner": "1331193",
"ownerType": "servicer",
"relative_ticket_columnId": "24441346"
},
{
"field_1": "测试多条2",
"field_2": [],
"ownerType": "servicer",
"relative_ticket_columnId": "24441346"
}
]
}'
**返回值示例**
Status: 200 OK
{
"items_data": [
{
"result_flag": "SUCCESS",
"rId": "255",
"field_1": "测试多条1",
"field_2": "50",
"field_3": "1",
"relative_ticket_columnId": "24441346",
"field_4": "",
"field_5": [],
"field_6": "",
"shaixuan": "",
"scrq": "",
"mzxt": "",
"owner": "1331193",
"ownerType": "servicer",
"tableId": "3785437",
"createTime": "2023-09-22 16:33:35",
"updateTime": "2023-09-22 16:33:35"
},
{
"result_flag": "FAIL",
"error_info": "请选择所属人",
"field_1": "测试多条2",
"field_2": [],
"ownerType": "servicer",
"relative_ticket_columnId": "24441346"
}
]
}
====根据唯一值更新指定资产表一行数据====
PUT /api/v1/forms/asset_form/{tableId}.json?unique_key=xxx&unique_value=xxx
**调用者权限**
管理员
**调用示例**
curl -v -u {account}:{password} https://www.bangwo8.com/api/v1/forms/asset_form/61748.json?unique_key=cpdm&unique_value=XF345\
-H "Content-Type: application/json" \
-X PUT -d '{"item_data":{"rId":"5","owner":"65047","ownerType":"servicer","cpmc":"帮我吧", \
"cpdm":"XF345", "tableId":"61748"}}'
**返回值示例**
Status: 200 OK
{
"item_data":{
"rId":"5",
"cpdm":"20190102555",
"cpmc":"",
"tableId":"61748",
"owner":"65047",
"ownerType":"servicer",
"createTime":"2019-01-15 14:34:47",
"updateTime":"2019-01-15 14:34:47"
}
}
====更新指定资产表一行数据====
PUT /api/v1/forms/asset_form/{tableId}/{rid}.json
**调用者权限**
管理员
**调用示例**
curl -v -u {account}:{password} https://www.bangwo8.com/api/v1/forms/asset_form/617485/123.json \
-H "Content-Type: application/json" \
-X PUT -d '{"item_data":{"owner":"65047","ownerType":"servicer","cpmc":"帮我吧", \
"cpdm":"XF345", "tableId":"61748"}}'
**返回值示例**
Status: 200 OK
{
"item_data":{
"rId":"5",
"cpdm":"XF345",
"cpmc":"帮我吧",
"tableId":"61748",
"owner":"65047",
"ownerType":"servicer",
"createTime":"2019-01-15 14:34:47",
"updateTime":"2019-01-15 14:34:47"
}
}
====删除一行数据====
DELETE /api/v1/forms/asset_form/{tableId}/{rId}.json
**调用者权限**
所有客服
**调用示例**
curl https://www.bangwo8.com/api/v1/forms/asset_form/61748/5.json \
-v -u {account}:{password} \
-X DELETE
**返回值示例**
Status: 200 OK
{
"result":{
"rId": 5,
"tableId": 61748,
"success": true,
"error_log": ""
}
}
====搜索资产表中的资产数据====
GET /api/v1/forms/asset_form/{tableId}/search.json
**调用者权限**
所有客服
**请求参数**
^名称 ^类型 ^必需的 ^注释 ^
|query |string |是 |搜索内容 |
|page |number |否 |页码,默认为 1 |
|per_page |number |否 |每页大小,默认为 20 |
**query参数说明**
^搜索内容 ^返回结果 ^
|query=ownerType:servicer owner:1331193 |返回客服sId为“1331193”的所有资产 |
|query=ticketId:19665409 field_1:甜甜圈 |返回工单ticketId为“19665409”,自定义字段field_1的值为甜甜圈的所有资产 |
|query=ticketId:null |返回工单ticketId为空的所有资产 |
|query=updateTime:2021-12-03 |返回更新时间为2021-12-03的资产 |
|query=createTime>=2021-12-03 updateTime< =2022-09-03 |返回创建时间在2021-12-03之后,更新时间为2022-09-03之前的资产 |
//说明://
//1、暂不支持搜索内容本身带有空格//
//2、当query参数增加了时间的过滤条件时,两个条件之间要以空格分开,比如“ownerType:servicer owner:1331193”//
//3、自定义字段同系统字段一样,空格隔开写上搜索值即可,比如:“ticketId:19665409 field_1:甜甜圈”//
**调用示例**
curl "https://www.bangwo8.com/api/v1/forms/asset_form/3785437/search.json" \
-G --data-urlencode "query=ticketId:19665409 field_1:甜甜圈" \
-v -u {account}:{password}
**返回值示例**
{
"asset_table": {
"total": "2",
"datas": [
{
"rId": "19",
"field_1": "甜甜圈",
"field_2": "25",
"owner": "1331193",
"ownerType": "servicer",
"tableId": "3785437",
"createTime": "2021-11-11 14:25:06",
"updateTime": "2021-11-11 14:25:06"
},
{
"rId": "25",
"field_1": "甜甜圈",
"field_2": "60",
"relative_ticket_columnId": "24441346",
"owner": "1331193",
"ownerType": "servicer",
"tableId": "3785437",
"createTime": "2021-11-11 14:29:36",
"updateTime": "2021-11-11 14:34:16",
"ticketId": "19665409"
}
]
}
}