UserApi::setUserRemark()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 6
nc 1
nop 2
1
<?php
2
namespace Wechat\API;
3
4
/**
5
 * 微信用户相关接口.
6
 *
7
 * @author Tian.
8
 */
9
class UserApi extends BaseApi
10
{
11
    /**
12
     * 获取用户信息.
13
     *
14
     * @author Tian
15
     *
16
     * @param string $openid 用户openid
17
     * @param string $lang
18
     *
19
     * @return array 用户信息.
20
     */
21
    public function getUserMsg($openid, $lang = 'zh_CN')
22
    {
23
        $queryStr = [
24
            'openid' => $openid,
25
            'lang'   => $lang,
26
        ];
27
28
        $res = $this->_get('info', $queryStr);
29
30
        return $res;
31
    }
32
33
    /**
34
     * 批量获取用户基本信息.
35
     *
36
     * @author Tian
37
     *
38
     * @param  array $user_list 用户openid列表
39
     *
40
     * @return array|bool 用户信息.
41
     */
42 View Code Duplication
    public function getUserList(array $user_list)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44
        if (!is_array($user_list)) {
45
            $this->setError('参数必须为一个数组');
46
47
            return false;
48
        }
49
50
        $this->module = 'user';
51
52
        $res = $this->_post('info/batchget', $user_list);
53
54
        return $res;
55
    }
56
57
    /**
58
     * 获取用户Openid列表.
59
     *
60
     * @author Tian
61
     *
62
     * @param string $next_openid 下一个openid
63
     *
64
     * @return array Openid列表.
65
     */
66
    public function getUserOpenidList($next_openid = '')
67
    {
68
        $queryStr = [
69
            'next_openid' => $next_openid,
70
        ];
71
72
        $res = $this->_get('get', $queryStr);
73
74
        return $res;
75
    }
76
77
    /**
78
     *  设置用户备注名.
79
     *
80
     * @author Tian
81
     *
82
     * @param string $openid 用户openid  sting
83
     * @param string $remark 用户备注名,长度必须小于30字符
84
     *
85
     * @return string bool.
86
     */
87
    public function setUserRemark($openid, $remark = "")
88
    {
89
        $queryStr = [
90
            'openid' => $openid,
91
            'remark' => $remark,
92
        ];
93
94
        $res = $this->_post('info/updateremark', $queryStr);
95
96
        return $res;
97
    }
98
}
99