Passed
Push — master ( be4655...e9d8d4 )
by Carlos
03:27
created

GiftCardPageClient   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 80
ccs 17
cts 17
cp 1
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A list() 0 3 1
A add() 0 7 1
A get() 0 7 1
A update() 0 11 1
A setMaintain() 0 7 2
1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EasyWeChat\OfficialAccount\Card;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class GiftCardPageClient.
18
 *
19
 * @author overtrue <[email protected]>
20
 */
21
class GiftCardPageClient extends BaseClient
22
{
23
    /**
24
     * 创建-礼品卡货架接口.
25
     *
26
     * @param array $attributes
27
     *
28
     * @return mixed
29
     */
30 1
    public function add(array $attributes)
31
    {
32
        $params = [
33 1
            'page' => $attributes,
34
        ];
35
36 1
        return $this->httpPostJson('card/giftcard/page/add', $params);
37
    }
38
39
    /**
40
     * 查询-礼品卡货架信息接口.
41
     *
42
     * @param string $pageId
43
     *
44
     * @return mixed
45
     */
46 1
    public function get(string $pageId)
47
    {
48
        $params = [
49 1
            'page_id' => $pageId,
50
        ];
51
52 1
        return $this->httpPostJson('card/giftcard/page/get', $params);
53
    }
54
55
    /**
56
     * 修改-礼品卡货架信息接口.
57
     *
58
     * @param string $pageId
59
     * @param string $bannerPicUrl
60
     * @param array  $themeList
61
     *
62
     * @return mixed
63
     */
64 1
    public function update(string $pageId, string $bannerPicUrl, array $themeList)
65
    {
66
        $params = [
67
            'page' => [
68 1
                'page_id' => $pageId,
69 1
                'banner_pic_url' => $bannerPicUrl,
70 1
                'theme_list' => $themeList,
71
            ],
72
        ];
73
74 1
        return $this->httpPostJson('card/giftcard/page/update', $params);
75
    }
76
77
    /**
78
     * 查询-礼品卡货架列表接口.
79
     *
80
     * @return mixed
81
     */
82 1
    public function list()
83
    {
84 1
        return $this->httpPostJson('card/giftcard/page/batchget');
85
    }
86
87
    /**
88
     * 下架-礼品卡货架接口(下架某一个货架或者全部货架).
89
     *
90
     * @param string $pageId
91
     *
92
     * @return mixed
93
     */
94 1
    public function setMaintain(string $pageId = '')
95
    {
96 1
        $params = ($pageId ? ['page_id' => $pageId] : ['all' => true]) + [
97 1
                'maintain' => true,
98
            ];
99
100 1
        return $this->httpPostJson('card/giftcard/maintain/set', $params);
101
    }
102
}
103