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\OpenPlatform\Authorizer\MiniProgram\Setting; |
13
|
|
|
|
14
|
|
|
use EasyWeChat\Kernel\BaseClient; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class Client. |
18
|
|
|
* |
19
|
|
|
* @author ClouderSky <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class Client extends BaseClient |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* 获取账号可以设置的所有类目. |
25
|
|
|
*/ |
26
|
|
|
public function getAllCategories() |
27
|
|
|
{ |
28
|
|
|
return $this->httpPostJson('cgi-bin/wxopen/getallcategories'); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* 添加类目. |
33
|
|
|
* |
34
|
|
|
* @param array $categories 类目数组 |
35
|
|
|
*/ |
36
|
|
|
public function addCategories(array $categories) |
37
|
|
|
{ |
38
|
|
|
$params = ['categories' => $categories]; |
39
|
|
|
|
40
|
|
|
return $this->httpPostJson('cgi-bin/wxopen/addcategory', $params); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* 删除类目. |
45
|
|
|
* |
46
|
|
|
* @param int $firstId 一级类目ID |
47
|
|
|
* @param int $secondId 二级类目ID |
48
|
|
|
*/ |
49
|
|
|
public function deleteCategories(int $firstId, int $secondId) |
50
|
|
|
{ |
51
|
|
|
$params = ['first' => $firstId, 'second' => $secondId]; |
52
|
|
|
|
53
|
|
|
return $this->httpPostJson('cgi-bin/wxopen/deletecategory', $params); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* 获取账号已经设置的所有类目. |
58
|
|
|
*/ |
59
|
|
|
public function getCategories() |
60
|
|
|
{ |
61
|
|
|
return $this->httpPostJson('cgi-bin/wxopen/getcategory'); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* 修改类目. |
66
|
|
|
* |
67
|
|
|
* @param array $category 单个类目 |
68
|
|
|
*/ |
69
|
|
|
public function updateCategory(array $category) |
70
|
|
|
{ |
71
|
|
|
return $this->httpPostJson('cgi-bin/wxopen/modifycategory', $category); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* 小程序名称设置及改名. |
76
|
|
|
* |
77
|
|
|
* @param string $nickname 昵称 |
78
|
|
|
* @param string $idCardMediaId 身份证照片素材ID |
79
|
|
|
* @param string $licenseMediaId 组织机构代码证或营业执照素材ID |
80
|
|
|
* @param string $otherStuffs 其他证明材料素材ID |
81
|
|
|
*/ |
82
|
|
|
public function setNickname( |
83
|
|
|
string $nickname, |
84
|
|
|
string $idCardMediaId = '', |
85
|
|
|
string $licenseMediaId = '', |
86
|
|
|
array $otherStuffs = [] |
87
|
|
|
) { |
88
|
|
|
$params = [ |
89
|
|
|
'nick_name' => $nickname, |
90
|
|
|
'id_card' => $idCardMediaId, |
91
|
|
|
'license' => $licenseMediaId, |
92
|
|
|
]; |
93
|
|
|
|
94
|
|
|
for ($i = \count($otherStuffs) - 1; $i >= 0; --$i) { |
95
|
|
|
$params['naming_other_stuff_'.($i + 1)] = $otherStuffs[$i]; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
return $this->httpPostJson('wxa/setnickname', $params); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* 小程序改名审核状态查询. |
103
|
|
|
* |
104
|
|
|
* @param int $auditId 审核单id |
105
|
|
|
*/ |
106
|
|
|
public function getNicknameAuditStatus($auditId) |
107
|
|
|
{ |
108
|
|
|
$params = ['audit_id' => $auditId]; |
109
|
|
|
|
110
|
|
|
return $this->httpPostJson('wxa/api_wxa_querynickname', $params); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* 微信认证名称检测. |
115
|
|
|
* |
116
|
|
|
* @param string $nickname 名称(昵称) |
117
|
|
|
*/ |
118
|
|
|
public function isAvailableNickname($nickname) |
119
|
|
|
{ |
120
|
|
|
$params = ['nick_name' => $nickname]; |
121
|
|
|
|
122
|
|
|
return $this->httpPostJson( |
123
|
|
|
'cgi-bin/wxverify/checkwxverifynickname', $params); |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
|