1 | <?php |
||
23 | class Product extends Base implements ProductInterface |
||
24 | { |
||
25 | |||
26 | const API_CREATE = 'https://api.weixin.qq.com/merchant/create'; |
||
27 | const API_DELETE = 'https://api.weixin.qq.com/merchant/del'; |
||
28 | const API_UPDATE = 'https://api.weixin.qq.com/merchant/update'; |
||
29 | const API_GET = 'https://api.weixin.qq.com/merchant/get'; |
||
30 | const API_GET_BY_STATUS = 'https://api.weixin.qq.com/merchant/getbystatus'; |
||
31 | const API_UPDATE_STATUS = 'https://api.weixin.qq.com/merchant/modproductstatus'; |
||
32 | const API_SUB = 'https://api.weixin.qq.com/merchant/category/getsub'; |
||
33 | const API_SKU = 'https://api.weixin.qq.com/merchant/category/getsku'; |
||
34 | const API_Property = 'https://api.weixin.qq.com/merchant/category/getproperty'; |
||
|
|||
35 | |||
36 | /** |
||
37 | * 新建商品 |
||
38 | * |
||
39 | * @param array|callable $data |
||
40 | * @return array|bool |
||
41 | * @throws ShopsException |
||
42 | * @throws |
||
43 | */ |
||
44 | public function create($data) |
||
60 | |||
61 | /** |
||
62 | * 删除商品 |
||
63 | * |
||
64 | * @param $productId |
||
65 | * @return bool |
||
66 | * @throws ShopsException |
||
67 | */ |
||
68 | public function delete($productId) |
||
74 | |||
75 | /** |
||
76 | * 修改商品 |
||
77 | * |
||
78 | * @param $productId |
||
79 | * @param $data |
||
80 | * @param bool|false $shelf |
||
81 | * @return array|bool |
||
82 | * @throws ShopsException |
||
83 | */ |
||
84 | public function update($data,$productId = null,$shelf = false) |
||
110 | |||
111 | /** |
||
112 | * 查询商品 |
||
113 | * |
||
114 | * @param $productId |
||
115 | * @return bool |
||
116 | * @throws ShopsException |
||
117 | */ |
||
118 | public function get($productId) |
||
125 | |||
126 | /** |
||
127 | * 从状态获取商品 |
||
128 | * |
||
129 | * @param int $status |
||
130 | * @return mixed |
||
131 | * @throws ShopsException |
||
132 | */ |
||
133 | public function getByStatus($status = 0) |
||
139 | |||
140 | /** |
||
141 | * 商品上下架 |
||
142 | * |
||
143 | * @param $productId |
||
144 | * @param int $status |
||
145 | * @return bool |
||
146 | * @throws ShopsException |
||
147 | */ |
||
148 | public function updateStatus($productId, $status = 0) |
||
157 | |||
158 | /** |
||
159 | * 获取指定分类的所有子分类 |
||
160 | * |
||
161 | * @param $cateId |
||
162 | * @return mixed |
||
163 | * @throws ShopsException |
||
164 | */ |
||
165 | public function getSub($cateId = 1) |
||
171 | |||
172 | /** |
||
173 | * 获取指定子分类的所有SKU |
||
174 | * |
||
175 | * @param $cateId |
||
176 | * @return mixed |
||
177 | * @throws ShopsException |
||
178 | */ |
||
179 | public function getSku($cateId) |
||
186 | |||
187 | /** |
||
188 | * 获取指定分类的所有属性 |
||
189 | * |
||
190 | * @param $cateId |
||
191 | * @return mixed |
||
192 | * @throws ShopsException |
||
193 | */ |
||
194 | public function getProperty($cateId) |
||
202 | |||
203 | |||
204 | } |