Total Complexity | 8 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Coverage | 46.67% |
1 | # -*- coding: utf-8 -*- |
||
6 | 10 | class MerchantGroup(BaseWeChatAPI): |
|
7 | |||
8 | 10 | def add(self, name, product_list): |
|
9 | return self._post( |
||
10 | 'merchant/group/add', |
||
11 | data={ |
||
12 | 'group_detail': { |
||
13 | 'group_name': name, |
||
14 | 'product_list': product_list |
||
15 | } |
||
16 | } |
||
17 | ) |
||
18 | |||
19 | 10 | def delete(self, group_id): |
|
20 | return self._post( |
||
21 | 'merchant/group/del', |
||
22 | data={ |
||
23 | 'group_id': group_id |
||
24 | } |
||
25 | ) |
||
26 | |||
27 | 10 | def update(self, group_id, name): |
|
28 | return self._post( |
||
29 | 'merchant/group/propertymod', |
||
30 | data={ |
||
31 | 'group_id': group_id, |
||
32 | 'group_name': name |
||
33 | } |
||
34 | ) |
||
35 | |||
36 | 10 | def update_product(self, group_id, product): |
|
37 | return self._post( |
||
38 | 'merchant/group/productmod', |
||
39 | data={ |
||
40 | 'group_id': group_id, |
||
41 | 'product': product |
||
42 | } |
||
43 | ) |
||
44 | |||
45 | 10 | def get_all(self): |
|
46 | res = self._get( |
||
47 | 'merchant/group/getall', |
||
48 | result_processor=lambda x: x['group_detail'] |
||
49 | ) |
||
50 | return res |
||
51 | |||
52 | 10 | def get(self, group_id): |
|
53 | res = self._post( |
||
54 | 'merchant/group/getbyid', |
||
55 | data={ |
||
56 | 'group_id': group_id |
||
57 | }, |
||
58 | result_processor=lambda x: x['group_detail'] |
||
59 | ) |
||
60 | return res |
||
61 |