forked from YanzhaoMa/APICloud-PHP-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileModel.php
42 lines (41 loc) · 1.47 KB
/
FileModel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
require('ApicloudModel.php');
/**
* ApiCloud File文件操作类
**/
class FileModel extends ApicloudModel{
const SERVERAPIURL = 'https://d.apicloud.com/';
/**
* File对象操作
*/
function objAddFile($tmpname,$tmpfile,$tmpType){ //上传新文件
$data = array(
'file'=>'@'.realpath($tmpfile).";type=".$tmpType.";filename=".$tmpname
);
return $this->upload_file(self::SERVERAPIURL.'mcm/api/file',$data);
}
function objPutFile($tmpname,$tmpfile,$tmpType,$id){ //修改文件参数
$data = array(
'file'=>'@'.realpath($tmpfile).";type=".$tmpType.";filename=".$tmpname,'id'=>$id
);
return $this->upload_file(self::SERVERAPIURL.'mcm/api/file',$data);
}
function objCount($filter){ //获取所有文件数量:json(可连接参数:fields,where,limit,skip,order,include,includefilter)
return $this->get(self::SERVERAPIURL.'mcm/api/file/count?filter='.$filter);
}
function objExist($id){ //判断文件是否存在ById
return $this->exists(self::SERVERAPIURL.'mcm/api/file/'.$id.'/exists');
}
function objFindAll($filter){ //获取所有文件列表:json(可连接参数:fields,where,limit,skip,order,include,includefilter)
return $this->get(self::SERVERAPIURL.'mcm/api/file?filter='.$filter);
}
function objGet($id) //获取文件对象ById
{
return $this->get(self::SERVERAPIURL.'mcm/api/file/'.$id);
}
function objDelete($id) //删除文件对象ById
{
return $this->delete(self::SERVERAPIURL.'mcm/api/file/'.$id);
}
}
?>