2 Attachment
Get a list of attachments
POST api/attachment/list
Request Body
attach_ids
array
Attachment ID Collection
Field
Type
Description
status
boolean
(1) Access is successful
data
array
back to attachment
{
"status": 1,
"data": [
[
'id' => 1600, //Primary id
'attachment_id' => '61bb77aa7c4eb8e3bb8b20c0ac72ab1e', //attachmetn id
'attachment_name' => '图20160314105710.png', //Attachment name
'affect_attachment_name' => '9a28e37c0a9bae896ea2fa9bce07fe1c.png', //Attachment system name, avoid user copy from server
'attachment_relative_path' => '2018/05/31/61bb77aa7c4eb8e3bb8b20c0ac72ab1e/', //Attachment path
'attachment_type' => 'png', //Attachment type
'attachment_mark' => 1, //Attachment mark
'category' => 1, //Attachment category
'relation_table' => "document_content", //Related table
'thumb_attachment_name' => "data:image/png;base64,iVBORw0K.....==", //Attachment Thumbnail
'attachment_size' => 2250, //Size
'attachment_time' => "2018-05-31 16:40:30", //Upload time
'attachment_path' => "attachment\index\61bb77aa7c4eb8e3bb8b20c0ac72ab1e", //Download path
],
......
]
}Name
Type
Description
status
boolean
(0) Access failed
errors
array
Access failure error message
{
"status": 0,
"errors": [
{
"code": "0x000003",
"message": "未知错误"
}
]
}Attachment Upload
GET api/attachment/upload
Request Body
name
string
File name If this value is passed in, use this value as the file name, otherwise generate a name based on the uploaded file
Filedata
file
The value of the file upload name is fixed as Filedata, and the uploaded file information is $_FILES['Filedata']
attachment_table
string
Association table name, optional, if this value is passed in, this attachment will be associated with the corresponding table
chunks
int
The number of all uploaded slices
chunk
int
The index of the currently uploaded slice, starting from 0
Field
Type
Description
status
boolean
(1) uploaded successfully
data
array
Returns the attachment id and name
{
"status": 1,
"data": {
"attachment_id": "61bb77aa7c4eb8e3bb8b20c0ac72ab1e", //attachment id
"attachment_name": "图20160314105710.png" //file name
}
}Name
Type
Description
status
boolean
(0) Access failed
errors
array
Access failure error message
{
"status": 0,
"errors": [
{
"code": "0x000003",
"message": "未知错误"
}
]
}Get Attachments
GET api/attachment/index/{attachmentId}
Path Parameters
encrypt
string
Fixed value: 0
attachment_id
string
Attachment ID
operate
string
The fixed value is: download
Field
Type
Description
status
boolean
(1) Access is successful
attachment
resource
back to attachment
Name
Type
Description
status
boolean
(0) Access failed
errors
array
Access failure error message
{
"status": 0,
"errors": [
{
"code": "0x011017",
"message": "文件不存在"
}
]
}Last updated