Completed
Push — master ( 71ecec...777be0 )
by Carlos
03:08
created

MemberCardClient   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 74
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A updateUser() 0 3 1
A getUser() 0 8 1
A setActivationForm() 0 5 1
A activate() 0 3 1
A getActivationForm() 0 7 1
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
/**
15
 * Class MemberCardClient.
16
 *
17
 * @author overtrue <[email protected]>
18
 */
19
class MemberCardClient extends Client
20
{
21
    /**
22
     * 会员卡接口激活.
23
     *
24
     * @param array $info
25
     *
26
     * @return mixed
27
     */
28
    public function activate(array $info = [])
29
    {
30
        return $this->httpPostJson('card/membercard/activate', $info);
31
    }
32
33
    /**
34
     * 设置开卡字段接口.
35
     *
36
     * @param string $cardId
37
     * @param array  $settings
38
     *
39
     * @return mixed
40
     */
41
    public function setActivationForm(string $cardId, array $settings)
42
    {
43
        $params = array_merge(['card_id' => $cardId], $settings);
44
45
        return $this->httpPostJson('card/membercard/activateuserform/set', $params);
46
    }
47
48
    /**
49
     * 拉取会员信息接口.
50
     *
51
     * @param string $cardId
52
     * @param string $code
53
     *
54
     * @return mixed
55
     */
56
    public function getUser(string $cardId, string $code)
57
    {
58
        $params = [
59
            'card_id' => $cardId,
60
            'code' => $code,
61
        ];
62
63
        return $this->httpPostJson('card/membercard/userinfo/get', $params);
64
    }
65
66
    /**
67
     * 更新会员信息.
68
     *
69
     * @param array $params
70
     *
71
     * @return mixed
72
     */
73
    public function updateUser(array $params = [])
74
    {
75
        return $this->httpPostJson('card/membercard/updateuser', $params);
76
    }
77
78
79
    /**
80
     * 获取用户提交资料.
81
     *
82
     * @param string $activateTicket
83
     *
84
     * @return mixed
85
     */
86
    public function getActivationForm($activateTicket){
87
88
        $params = [
89
            'activate_ticket' => $activateTicket
90
        ];
91
92
        return $this->httpPostJson('card/membercard/activatetempinfo/get', $params);
93
    }
94
}