1 <?php
2
3 /*
4 ==========================================================
5 == File Name : album.control.php ==
6 == Author : genghs ==
7 == Date : 2011/8/10 ==
8 == Description : 相册管理模块接口类 ==
9 ==========================================================
10 */
11 require_once( $_SERVER['COMMON_PATH']."/common.inc.php");
12 require_once( $_SERVER['CONTROL_PATH']."/keyword.control.php");
13 require_once( $_SERVER['CONTROL_PATH']."/cache.control.php");
14
15 class C_Album
16 {
17 var $userId; //当前用户ID
18 private $Cache; // 缓存接口
19 private $cacheMod = "album"; //缓存模块名
20
21 //类初始化
22 function C_Album()
23 {
24 global $_PASSPORT;
25 $this->userId = $_PASSPORT->userId();
26 $this->Cache = new C_Cache();
27
28
29 }
30 /*
31 添加相册信息
32 */
33 function addAlbum($data)
34 {
35 if(empty($this->userId))
36 return null;
37
38 $data['userid'] = $this->userId;
39 $ret = IceCall('company_addb2buseralbum',$data);
40 if($ret['code'] == '0'){
41 $this->Cache->deleteCache($this->cacheMod,$this->userId);
42 }
43 return $ret;
44 }
45
46 /*
47 删除相册信息
48 */
49 function deleteAlbum($data)
50 {
51 if(empty($this->userId))
52 return null;
53
54 $data['userid'] = $this->userId;
55 $ret = IceCall('company_deleteb2buseralbum',$data);
56 if($ret['code'] == '0'){
57 $this->Cache->deleteCache($this->cacheMod,$this->userId);
58 }
59 return $ret;
60 }
61 /*
62 修改相册名称
63 */
64 function updateAlbumName($data)
65 {
66 if(empty($this->userId))
67 return null;
68
69 if(!is_numeric($data['albumid']))
70 return false;
71 if(empty($data['albumname']))
72 return false;
73
74 $data['albumname'] = mb_substr(trim($data['albumname']), 0, 100, 'utf-8');
75
76 $data['userid'] = $this->userId;
77 $ret = IceCall('company_updateb2buseralbumbyname',$data);
78 if($ret['code'] == '0'){
79 $this->Cache->deleteCache($this->cacheMod,$this->userId);
80 }
81 return $ret;
82 }
83
84 /*
85 维护相册封面
86 */
87 function manageAlbumCorver($data)
88 {
89 if(empty($this->userId))
90 return null;
91
92 $data['userid'] = $this->userId;
93 $ret = IceCall('company_updateb2buseralbumbypic',$data);
94 if($ret['code'] == '0'){
95 $this->Cache->deleteCache($this->cacheMod,$this->userId);
96 }
97 return $ret;
98 }
99
100 /*
101 维护相册排序
102 */
103 function orderAlbum($data)
104 {
105 if(empty($this->userId))
106 return null;
107 $data['userid'] = $this->userId;
108 $ret = IceCall('company_orderb2buseralbum',$data);
109 if($ret['code'] == '0'){
110 $this->Cache->deleteCache($this->cacheMod,$this->userId);
111 }
112 return $ret;
113 }
114
115 /*
116 查询相册信息
117 */
118 function queryAlbum($userId = 0)
119 {
120 if(!is_numeric($userId) || $userId <= 0)
121 {
122 if(empty($this->userId))
123 return null;
124 $userId = $this->userId;
125 }
126
127 $key = $this->Cache->getCacheKey($this->cacheMod,$userId);
128 $info = $this->Cache->getCache($key);
129 if (!empty($info)){
130 return $info;
131 }
132
133 $data['userid'] = $userId;
134 $ret = IceCall('company_album',$data);
135 if($ret['code'] == '0'){
136 $this->Cache->setCache($key,$ret);
137 }
138 return $ret;
139 }
140 /*
141 添加图片信息
142 */
143 function addPhoto($data)
144 {
145 if(empty($this->userId))
146 return null;
147
148 $data['userid'] = $this->userId;
149 $ret = IceCall('company_addb2buserphoto',$data);
150 if($ret['code'] == '0'){
151 $this->Cache->deleteCache('company',$data['userid']."_photolist");
152 }
153 return $ret;
154 }
155 /*
156 添加企业图片信息 by LIYU
157 */
158 function addPhoto_sell($data)
159 {
160 if(empty($this->userId))
161 return null;
162
163 $data['userid'] = $this->userId;
164 $ret = IceCall('company_addb2buserphoto_sell',$data);
165 if($ret['code'] == '0'){
166 $this->Cache->deleteCache('company',$data['userid']."_photolist");
167 }
168 return $ret;
169 }
170 /*
171 删除图片信息
172 */
173 function deletePhoto($data)
174 {
175 if(empty($this->userId))
176 return null;
177
178 $data['userid'] = $this->userId;
179 $ret = IceCall('company_deleteb2buserphoto',$data);
180
181 if($ret['code'] == '0'){
182 $this->Cache->deleteCache('company',$data['userid']."_photolist");
183 }
184
185 return $ret;
186 }
187 /*
188 删除企业图片信息 by LIYU
189 */
190 function deletePhoto_sell($data)
191 {
192 if(empty($this->userId))
193 return null;
194
195 $data['userid'] = $this->userId;
196 $ret = IceCall('company_deleteb2buserphoto_sell',$data);
197
198 if($ret['code'] == '0'){
199 $this->Cache->deleteCache('company',$data['userid']."_photolist");
200 }
201
202 return $ret;
203 }
204 /*
205 修改图片名称
206 */
207 function updatePhotoName($data)
208 {
209 if(empty($this->userId))
210 return null;
211
212 $data['userid'] = $this->userId;
213 $ret = IceCall('company_updateb2buserphotobyname',$data);
214
215 if($ret['code'] == '0'){
216 $this->Cache->deleteCache('company',$data['userid']."_photolist");
217 }
218 return $ret;
219 }
220 /*
221 修改企业图片名称
222 */
223 function updatePhotoName_sell($data)
224 {
225 if(empty($this->userId))
226 return null;
227
228 $data['userid'] = $this->userId;
229 $ret = IceCall('company_updateb2buserphotobyname_sell',$data);
230
231 if($ret['code'] == '0'){
232 $this->Cache->deleteCache('company',$data['userid']."_photolist");
233 }
234 return $ret;
235 }
236 /*
237 推荐图片信息
238 */
239 function recommendPhoto($data)
240 {
241 if(empty($this->userId))
242 return null;
243
244 $data['userid'] = $this->userId;
245 $ret = IceCall('company_recommendb2buserphoto',$data);
246 if($ret['code'] == '0'){
247 $this->Cache->deleteCache('company',$data['userid']."_photolist");
248 }
249 return $ret;
250 }
251 /*
252 查询图片信息
253 */
254 function queryPhoto($data)
255 {
256 if(empty($this->userId))
257 return null;
258
259 $data['userid'] = $this->userId;
260 $ret = IceCall('company_photo_echo',$data);
261 if($ret['code'] == '0'){
262 return $ret;
263 }
264 return false;
265 }
266 /*
267 查询企业图片信息 by LIYU
268 */
269 function queryPhoto_sell($data)
270 {
271 if(empty($this->userId))
272 return null;
273
274 $data['userid'] = $this->userId;
275 $ret = IceCall('company_photo_echo_sell',$data);
276 if($ret['code'] == '0'){
277 return $ret;
278 }
279 return false;
280 }
281
282 /*
283 移动图片信息
284 */
285 function movePhoto($data)
286 {
287 if(empty($this->userId))
288 return null;
289
290 $data['userid'] = $this->userId;
291 $ret = IceCall('company_modb2buserphotoforalbumid',$data);
292 if($ret['code'] == '0'){
293 $this->Cache->deleteCache('company',$data['userid']."_photolist");
294 }
295 return $ret;
296 }
297
298 /*
299 设置相册是否公开
300 */
301
302 function openUserAlbum($data){
303 if(empty($this->userId)){
304 return -1;
305 }
306
307 $ret = IceCall('company_openb2buseralbum',$data);
308 if($ret['code'] == 0){
309 $this->Cache->deleteCache($this->cacheMod,$this->userId);
310 $this->Cache->deleteCache('company',$this->userId."_photolist");
311 }
312 return $ret['code'];
313
314 }
315
316
317 }