PictureUploadRequest.php
2.1 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/**
* TOP API: taobao.picture.upload request
*
* @author auto create
* @since 1.0, 2012-12-13 16:33:03
*/
class PictureUploadRequest
{
/**
* 包括后缀名的图片标题,不能为空,如Bule.jpg,有些卖家希望图片上传后取图片文件的默认名
**/
private $imageInputTitle;
/**
* 图片二进制文件流,不能为空,允许png、jpg、gif图片格式
**/
private $img;
/**
* 图片分类ID,设置具体某个分类ID或设置0上传到默认分类,只能传入一个分类
**/
private $pictureCategoryId;
/**
* 图片标题,如果为空,传的图片标题就取去掉后缀名的image_input_title,超过50字符长度会截取50字符,重名会在标题末尾加"(1)";标题末尾已经有"(数字)"了,则数字加1
**/
private $title;
private $apiParas = array();
public function setImageInputTitle($imageInputTitle)
{
$this->imageInputTitle = $imageInputTitle;
$this->apiParas["image_input_title"] = $imageInputTitle;
}
public function getImageInputTitle()
{
return $this->imageInputTitle;
}
public function setImg($img)
{
$this->img = $img;
$this->apiParas["img"] = $img;
}
public function getImg()
{
return $this->img;
}
public function setPictureCategoryId($pictureCategoryId)
{
$this->pictureCategoryId = $pictureCategoryId;
$this->apiParas["picture_category_id"] = $pictureCategoryId;
}
public function getPictureCategoryId()
{
return $this->pictureCategoryId;
}
public function setTitle($title)
{
$this->title = $title;
$this->apiParas["title"] = $title;
}
public function getTitle()
{
return $this->title;
}
public function getApiMethodName()
{
return "taobao.picture.upload";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->imageInputTitle,"imageInputTitle");
RequestCheckUtil::checkNotNull($this->img,"img");
RequestCheckUtil::checkNotNull($this->pictureCategoryId,"pictureCategoryId");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}