Client.php
2.53 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
*
* @author tongdesheng
*
*/
class YHMProduct_Models_Goodsimages_Client
{
/**
*
* @var YHMProduct_Models_Goodsimages_Dao
*/
private static $dao;
/**
*
* @return YHMProduct_Models_Goodsimages_Dao
*/
static private function dao()
{
if (empty(self::$dao)) {
self::$dao = new YHMProduct_Models_Goodsimages_Dao();
}
return self::$dao;
}
/**
* 通过skc获取所有商品图片
* @param integer $product_skc
*/
public static function getByProductSkc($product_skc)
{
if (intval($product_skc) < 1) {
return array();
}
return self::dao()->getByProductSkc($product_skc);
}
/**
* 通过skc获取默认展示图片
* @param int $product_skc
*/
public static function getDefaultImageBySkc($product_skc)
{
if ((int)$product_skc < 1) {
return array();
}
return self::dao()->getDefaultImageBySkc((int)$product_skc);
}
/**
* 通过skc获取一个或多个图片
* @param $product_skc
* @return Array
*/
static function getOneImagesBySkc($product_skc)
{
return self::dao()->getOneImagesBySkc((int)$product_skc);
}
/**
* skc获取多个图片
*
* @param $product_skc
* @param $size
* @return Array
*/
public static function getImagesBySkc($product_skc, $size = 8)
{
return self::dao()->getOneImagesBySkc((int)$product_skc, $size);
}
/**
* 获取最新的一张图片,用于没有默认图时
* @param int $product_skc
* @return type
*/
public static function getOneImageBySkc($product_skc)
{
if ((int)$product_skc < 1) {
return '';
}
return self::dao()->getOneImageBySkc((int)$product_skc);
}
/**
* 添加商品图片
* @param intger $product_skc
* @param string $image_path
* @param enum $is_default
*/
public static function setGoodsImage($product_skc, $image_path, $is_default)
{
if (intval($product_skc) < 1) {
return false;
}
return self::dao()->setGoodsImage($product_skc, $image_path, $is_default);
}
/**
* 删除指定skc下所有图片
* @param integer $product_skc
*/
public static function delByProductSkc($product_skc)
{
if (intval($product_skc) < 1) {
return false;
}
return self::dao()->delByProductSkc($product_skc);
}
}