This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Wechat\API; |
||
3 | |||
4 | use Wechat\Api; |
||
5 | |||
6 | /** |
||
7 | * 卡券相关接口. |
||
8 | * |
||
9 | * @author Tian. |
||
10 | */ |
||
11 | class CardApi extends BaseApi |
||
12 | { |
||
13 | /** |
||
14 | * 获取卡券颜色 |
||
15 | * |
||
16 | * @return array [颜色列表] |
||
17 | */ |
||
18 | public function getcolors() |
||
19 | { |
||
20 | $queryStr = []; |
||
21 | |||
22 | $this->apitype = 'card'; |
||
23 | $this->module = 'getcolors'; |
||
24 | |||
25 | $res = $this->_get('', $queryStr); |
||
26 | |||
27 | return $res; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * 创建卡券 |
||
32 | * |
||
33 | * @param string $type [卡券类型] |
||
34 | * @param array $base_info [必要字段] |
||
35 | * @param array $especial [特殊字段] |
||
36 | * @param array $advanced_info [图文列表] |
||
37 | * |
||
38 | * @return string [CardId] |
||
39 | */ |
||
40 | public function create($type = 'member_card', $base_info = [], $especial = [], $advanced_info = []) |
||
41 | { |
||
42 | View Code Duplication | if (!is_string($type) || !is_array($base_info) || !is_array($especial)) { |
|
0 ignored issues
–
show
|
|||
43 | $this->setError('参数缺失'); |
||
44 | |||
45 | return false; |
||
46 | } |
||
47 | |||
48 | $card = []; |
||
49 | $card['card'] = []; |
||
50 | $card['card']['card_type'] = strtoupper($type); |
||
51 | |||
52 | $type = strtolower($type); |
||
53 | |||
54 | $card['card'][$type] = []; |
||
55 | |||
56 | $card_info = []; |
||
57 | $card_info['base_info'] = $base_info; |
||
58 | |||
59 | $card['card'][$type] = array_merge($card_info, $especial, $advanced_info); |
||
60 | |||
61 | $this->apitype = 'card'; |
||
62 | $this->module = 'create'; |
||
63 | |||
64 | $res = $this->_post('', $card); |
||
65 | |||
66 | return $res; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * 卡券二维码 |
||
71 | * |
||
72 | * @param $card |
||
73 | * |
||
74 | * @return array|bool |
||
75 | */ |
||
76 | View Code Duplication | public function qrcode($card) |
|
0 ignored issues
–
show
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. ![]() |
|||
77 | { |
||
78 | if (!is_array($card)) { |
||
79 | $this->setError('参数缺失'); |
||
80 | |||
81 | return false; |
||
82 | } |
||
83 | |||
84 | $this->apitype = 'card'; |
||
85 | $this->module = 'qrcode'; |
||
86 | |||
87 | $res = $this->_post('create', $card); |
||
88 | |||
89 | return $res; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * 通过ticket换取二维码 |
||
94 | * |
||
95 | * @param string $ticket 获取的二维码ticket,凭借此ticket可以在有效时间内换取二维码。 |
||
96 | * |
||
97 | * @return array|bool 是一张图片,可以直接展示或者下载 |
||
98 | */ |
||
99 | View Code Duplication | public function showqrcode($ticket = '') |
|
0 ignored issues
–
show
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. ![]() |
|||
100 | { |
||
101 | Api::setApiUrl('https://mp.weixin.qq.com/'); |
||
102 | |||
103 | $this->apitype = 'cgi-bin'; |
||
104 | $this->module = 'showqrcode'; |
||
105 | |||
106 | $queryStr = ['ticket' => $ticket]; |
||
107 | |||
108 | $res = $this->_get('', $queryStr); |
||
109 | |||
110 | return $res; |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * 通过ticket换取二维码 链接 |
||
115 | * |
||
116 | * @param string $ticket 获取的二维码ticket,凭借此ticket可以在有效时间内换取二维码。 |
||
117 | * |
||
118 | * @return array|bool 是一张图片,可以直接展示或者下载 |
||
119 | */ |
||
120 | public function showqrcode_url($ticket = '') |
||
121 | { |
||
122 | if (!is_string($ticket) || $ticket == '') { |
||
123 | $this->setError('参数错误'); |
||
124 | |||
125 | return false; |
||
126 | } |
||
127 | |||
128 | $url = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $ticket; |
||
129 | |||
130 | return $url; |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * 获取 卡券 Api_ticket |
||
135 | * |
||
136 | * @param boolean $jus 是否强制刷新 |
||
137 | * |
||
138 | * @return string $api_ticket api_ticket |
||
139 | */ |
||
140 | public function cardApiTicket($jus = false) |
||
141 | { |
||
142 | $key = $this->getAppId() . 'card_api_ticket'; |
||
143 | $api_ticket = $this->cache($key); |
||
144 | |||
145 | if (false == $api_ticket || $jus) { |
||
146 | $this->apitype = 'cgi-bin'; |
||
147 | $this->module = 'ticket'; |
||
148 | |||
149 | $queryStr = ['type' => 'wx_card']; |
||
150 | |||
151 | $res = $this->_get('getticket', $queryStr); |
||
152 | |||
153 | if (false === $res) { |
||
154 | exit('获取Card Api Ticket失败!'); |
||
0 ignored issues
–
show
The method
cardApiTicket() contains an exit expression.
An exit expression should only be used in rare cases. For example, if you write a short command line script. In most cases however, using an ![]() |
|||
155 | } |
||
156 | |||
157 | $api_ticket = $res['ticket']; |
||
158 | |||
159 | $this->cache($key, $api_ticket, 3000); |
||
160 | } |
||
161 | |||
162 | return $api_ticket; |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * 微信卡券:JSAPI 卡券Package - 基础参数没有附带任何值 - 再生产环境中需要根据实际情况进行修改 |
||
167 | * |
||
168 | * @param string $card_id |
||
0 ignored issues
–
show
There is no parameter named
$card_id . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
169 | * @param int $code |
||
0 ignored issues
–
show
There is no parameter named
$code . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
170 | * @param int $openid |
||
0 ignored issues
–
show
There is no parameter named
$openid . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
171 | * @param int $outer_id |
||
0 ignored issues
–
show
There is no parameter named
$outer_id . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
172 | * @param int $timestamp |
||
173 | * @param int $api_ticket |
||
174 | * |
||
175 | * @return array |
||
176 | */ |
||
177 | public function wxCardPackage(array $card_list, $timestamp = null, $api_ticket = null) |
||
178 | { |
||
179 | if (!is_array($card_list)) { |
||
180 | $this->setError('参数缺失'); |
||
181 | |||
182 | return false; |
||
183 | } |
||
184 | |||
185 | if (empty($timestamp) || $timestamp == '') { |
||
186 | $timestamp = time(); |
||
187 | } |
||
188 | |||
189 | if (empty($api_ticket) || $api_ticket == '') { |
||
190 | $api_ticket = $this->cardApiTicket(); |
||
191 | } |
||
192 | |||
193 | $resultArray = []; |
||
194 | foreach ($card_list as $key => $value) { |
||
195 | View Code Duplication | if (empty($value['code']) || !isset($value['code'])) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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. ![]() |
|||
196 | $value['code'] = ''; |
||
197 | } |
||
198 | View Code Duplication | if (empty($value['openid']) || !isset($value['openid'])) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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. ![]() |
|||
199 | $value['openid'] = ''; |
||
200 | } |
||
201 | $arrays = [$api_ticket, $timestamp, $value['card_id'], $value['code'], $value['openid']]; |
||
202 | sort($arrays, SORT_STRING); |
||
203 | $string = sha1(implode($arrays)); |
||
204 | |||
205 | $resultArray['cardList'][$key]['cardId'] = $value['card_id']; |
||
206 | $resultArray['cardList'][$key]['cardExt']['code'] = $value['code']; |
||
207 | $resultArray['cardList'][$key]['cardExt']['openid'] = $value['openid']; |
||
208 | |||
209 | $resultArray['cardList'][$key]['cardExt']['timestamp'] = $timestamp; |
||
210 | $resultArray['cardList'][$key]['cardExt']['signature'] = $string; |
||
211 | |||
212 | if (!empty($value['outer_id'])) { |
||
213 | $resultArray['cardList'][$key]['cardExt']['outer_id'] = $value['outer_id']; |
||
214 | } |
||
215 | $resultArray['cardList'][$key]['cardExt'] = json_encode($resultArray['cardList'][$key]['cardExt']); |
||
216 | } |
||
217 | $resultJson = json_encode($resultArray); |
||
218 | |||
219 | return $resultJson; |
||
220 | } |
||
221 | |||
222 | /** |
||
223 | * 创建货架接口 |
||
224 | * |
||
225 | * @ string url $banner 页面的banner图片链接 |
||
226 | * |
||
227 | * @param string $page_title 页面的title |
||
228 | * @param boolean $can_share 页面是否可以分享,填入true/false |
||
229 | * @param string $scene 投放页面的场景值 SCENE_NEAR_BY 附近 SCENE_MENU 自定义菜单 SCENE_QRCODE 二维码 SCENE_ARTICLE 公众号文章 SCENE_H5 h5页面 SCENE_IVR 自动回复 SCENE_CARD_CUSTOM_CELL 卡券自定义cell |
||
230 | * @param array $card_list 卡券列表,每个item有两个字段 |
||
231 | * @ string $card_list ->cardid 所要在页面投放的cardid |
||
232 | * @ string url $card_list ->thumb_url 缩略图url |
||
233 | * |
||
234 | * @return string url 货架链接 page_id 货架ID。货架的唯一标识。 |
||
235 | */ |
||
236 | public function landingpage($banner, $page_title, $can_share = false, $scene = 'SCENE_CARD_CUSTOM_CELL', $card_list = []) |
||
237 | { |
||
238 | View Code Duplication | if (empty($banner) || empty($page_title) || !is_bool($can_share) || !is_string($scene) || !is_array($card_list)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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. ![]() |
|||
239 | $this->setError('参数错误'); |
||
240 | |||
241 | return false; |
||
242 | } |
||
243 | |||
244 | $queryStr = []; |
||
245 | $queryStr['banner'] = $banner; |
||
246 | $queryStr['page_title'] = $page_title; |
||
247 | $queryStr['can_share'] = (bool) $can_share; |
||
248 | $queryStr['scene'] = strtoupper($scene); |
||
249 | $queryStr['card_list'] = $card_list; |
||
250 | |||
251 | $this->apitype = 'card'; |
||
252 | $this->module = 'landingpage'; |
||
253 | $res = $this->_post('create', $queryStr); |
||
254 | |||
255 | return $res; |
||
256 | } |
||
257 | |||
258 | /** |
||
259 | * 导入code接口 |
||
260 | * |
||
261 | * @param string $card_id 卡券Id |
||
262 | * @param array $code 自定义code 数组 |
||
263 | * |
||
264 | * @return array |
||
265 | */ |
||
266 | View Code Duplication | public function deposit($card_id, $code = []) |
|
0 ignored issues
–
show
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. ![]() |
|||
267 | { |
||
268 | if (!is_string($card_id) || !is_array($code)) { |
||
269 | $this->setError('参数错误'); |
||
270 | |||
271 | return false; |
||
272 | } |
||
273 | |||
274 | $queryStr = []; |
||
275 | $queryStr['card_id'] = $card_id; |
||
276 | $queryStr['code'] = $code; |
||
277 | |||
278 | $this->apitype = 'card'; |
||
279 | $this->module = 'code'; |
||
280 | $res = $this->_post('deposit', $queryStr); |
||
281 | |||
282 | return $res; |
||
283 | } |
||
284 | |||
285 | /** |
||
286 | * 查询导入code数目 |
||
287 | * |
||
288 | * @param string $card_id 卡券ID |
||
289 | * |
||
290 | * @return int |
||
291 | */ |
||
292 | public function getdepositcount($card_id) |
||
293 | { |
||
294 | if (!is_string($card_id)) { |
||
295 | $this->setError('参数错误'); |
||
296 | |||
297 | return false; |
||
298 | } |
||
299 | |||
300 | $queryStr = []; |
||
301 | $queryStr['card_id'] = $card_id; |
||
302 | |||
303 | $this->apitype = 'card'; |
||
304 | $this->module = 'code'; |
||
305 | $res = $this->_post('getdepositcount', $queryStr); |
||
306 | |||
307 | return $res; |
||
308 | } |
||
309 | |||
310 | /** |
||
311 | * 核查code接口 |
||
312 | * |
||
313 | * @param [string] $card_id 卡券Id |
||
0 ignored issues
–
show
The doc-type
[string] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
314 | * @param [array] $code 自定义code 数组 |
||
0 ignored issues
–
show
The doc-type
[array] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
315 | * |
||
316 | */ |
||
317 | View Code Duplication | public function checkcode($card_id, $code = []) |
|
0 ignored issues
–
show
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. ![]() |
|||
318 | { |
||
319 | if (!is_string($card_id) || !is_array($code)) { |
||
320 | $this->setError('参数错误'); |
||
321 | |||
322 | return false; |
||
323 | } |
||
324 | |||
325 | $queryStr = []; |
||
326 | $queryStr['card_id'] = $card_id; |
||
327 | $queryStr['code'] = $code; |
||
328 | |||
329 | $this->apitype = 'card'; |
||
330 | $this->module = 'code'; |
||
331 | $res = $this->_post('checkcode', $queryStr); |
||
332 | |||
333 | return $res; |
||
334 | } |
||
335 | |||
336 | /** |
||
337 | * 图文消息群发卡券 |
||
338 | * |
||
339 | * @param [type] $card_id [description] |
||
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
340 | * |
||
341 | * @return array |
||
342 | */ |
||
343 | public function gethtml($card_id) |
||
344 | { |
||
345 | if (!is_string($card_id)) { |
||
346 | $this->setError('参数错误'); |
||
347 | |||
348 | return false; |
||
349 | } |
||
350 | |||
351 | $queryStr = []; |
||
352 | $queryStr['card_id'] = $card_id; |
||
353 | |||
354 | $this->apitype = 'card'; |
||
355 | $this->module = 'mpnews'; |
||
356 | $res = $this->_post('gethtml', $queryStr); |
||
357 | |||
358 | return $res; |
||
359 | } |
||
360 | |||
361 | /** |
||
362 | * 设置测试白名单 |
||
363 | * |
||
364 | * @param array $openid 白名单 openid 列表 |
||
365 | * @param array $username 白名单 微信号 列表 |
||
366 | * |
||
367 | * @return |
||
368 | */ |
||
369 | View Code Duplication | public function testwhitelist($openid = [], $username = []) |
|
0 ignored issues
–
show
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. ![]() |
|||
370 | { |
||
371 | if (!is_array($openid) || !is_array($username)) { |
||
372 | $this->setError('参数错误'); |
||
373 | |||
374 | return false; |
||
375 | } |
||
376 | |||
377 | $queryStr = []; |
||
378 | $queryStr['openid'] = $openid; |
||
379 | $queryStr['username'] = $username; |
||
380 | |||
381 | $this->apitype = 'card'; |
||
382 | $this->module = 'testwhitelist'; |
||
383 | $res = $this->_post('set', $queryStr); |
||
384 | |||
385 | return $res; |
||
386 | } |
||
387 | |||
388 | /** |
||
389 | * 查询Code接口 |
||
390 | * |
||
391 | * @param string $code 单张卡券的唯一标准。 |
||
392 | * @param boolean $check_consume 是否校验code核销状态,填入true和false时的code异常状态返回数据不同。 |
||
393 | * @param string $card_id 卡券ID代表一类卡券。自定义code卡券必填。 |
||
394 | * |
||
395 | * @return array |
||
396 | */ |
||
397 | View Code Duplication | public function codeGet($code, $check_consume = true, $card_id = '') |
|
0 ignored issues
–
show
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. ![]() |
|||
398 | { |
||
399 | if (empty($code) || !is_bool($check_consume)) { |
||
400 | $this->setError('参数错误'); |
||
401 | |||
402 | return false; |
||
403 | } |
||
404 | |||
405 | $queryStr = []; |
||
406 | if (!empty($card_id)) { |
||
407 | $queryStr['card_id'] = $card_id; |
||
408 | } |
||
409 | $queryStr['code'] = $code; |
||
410 | $queryStr['check_consume'] = $check_consume; |
||
411 | |||
412 | $this->apitype = 'card'; |
||
413 | $this->module = 'code'; |
||
414 | $res = $this->_post('get', $queryStr); |
||
415 | |||
416 | return $res; |
||
417 | } |
||
418 | |||
419 | /** |
||
420 | * 核销卡券 |
||
421 | * |
||
422 | * @param [type] $code 需核销的Code码 |
||
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
423 | * @param string $card_id 卡券ID。创建卡券时use_custom_code填写true时必填。非自定义Code不必填写。 |
||
424 | * |
||
425 | * @return array |
||
426 | */ |
||
427 | View Code Duplication | public function consume($code, $card_id = '') |
|
0 ignored issues
–
show
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. ![]() |
|||
428 | { |
||
429 | if (empty($code)) { |
||
430 | $this->setError('参数错误'); |
||
431 | |||
432 | return false; |
||
433 | } |
||
434 | |||
435 | $queryStr = []; |
||
436 | |||
437 | if (!empty($card_id)) { |
||
438 | $queryStr['card_id'] = $card_id; |
||
439 | } |
||
440 | |||
441 | $queryStr['code'] = $code; |
||
442 | |||
443 | $this->apitype = 'card'; |
||
444 | $this->module = 'code'; |
||
445 | $res = $this->_post('consume', $queryStr); |
||
446 | |||
447 | return $res; |
||
448 | } |
||
449 | |||
450 | /** |
||
451 | * Code解码接口 |
||
452 | * |
||
453 | * @param [string] $encrypt_code 经过加密的Code码。 |
||
0 ignored issues
–
show
The doc-type
[string] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
454 | * |
||
455 | * @return [string] code |
||
0 ignored issues
–
show
The doc-type
[string] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
456 | */ |
||
457 | public function decrypt($encrypt_code) |
||
458 | { |
||
459 | if (!is_string($encrypt_code)) { |
||
460 | $this->setError('参数错误'); |
||
461 | |||
462 | return false; |
||
463 | } |
||
464 | |||
465 | $queryStr = []; |
||
466 | $queryStr['encrypt_code'] = $encrypt_code; |
||
467 | |||
468 | $this->apitype = 'card'; |
||
469 | $this->module = 'code'; |
||
470 | $res = $this->_post('decrypt', $queryStr); |
||
471 | |||
472 | return $res; |
||
473 | } |
||
474 | |||
475 | /** |
||
476 | * 用于获取用户卡包里的,属于该appid下的卡券 |
||
477 | * |
||
478 | * @param string $openid 需要查询的用户openid |
||
479 | * @param string $card_id 卡券ID。不填写时默认查询当前appid下的卡券 |
||
480 | * |
||
481 | * @return array |
||
482 | */ |
||
483 | View Code Duplication | public function getcardlist($openid, $card_id = '') |
|
0 ignored issues
–
show
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. ![]() |
|||
484 | { |
||
485 | if (empty($openid)) { |
||
486 | $this->setError('缺少openid'); |
||
487 | |||
488 | return false; |
||
489 | } |
||
490 | |||
491 | $queryStr = []; |
||
492 | $queryStr['openid'] = $openid; |
||
493 | |||
494 | if (!empty($card_id)) { |
||
495 | $queryStr['card_id'] = $card_id; |
||
496 | } |
||
497 | |||
498 | $this->apitype = 'card'; |
||
499 | $this->module = 'user'; |
||
500 | $res = $this->_post('getcardlist', $queryStr); |
||
501 | |||
502 | return $res; |
||
503 | } |
||
504 | |||
505 | /** |
||
506 | * 获取卡券内容 |
||
507 | * |
||
508 | * @param string $card_id 卡券ID |
||
509 | * |
||
510 | * @return array |
||
511 | */ |
||
512 | View Code Duplication | public function cardGet($card_id) |
|
0 ignored issues
–
show
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. ![]() |
|||
513 | { |
||
514 | if (empty($card_id)) { |
||
515 | $this->setError('缺少card_id'); |
||
516 | |||
517 | return false; |
||
518 | } |
||
519 | |||
520 | $queryStr = []; |
||
521 | $queryStr['card_id'] = $card_id; |
||
522 | |||
523 | $this->apitype = 'card'; |
||
524 | $this->module = 'get'; |
||
525 | $res = $this->_post('', $queryStr); |
||
526 | |||
527 | return $res; |
||
528 | } |
||
529 | |||
530 | /** |
||
531 | * 批量查询卡列表 |
||
532 | * |
||
533 | * @param integer $offset 查询卡列表的起始偏移量,从0开始,即offset: 5是指从从列表里的第六个开始读取 |
||
534 | * @param integer $count 需要查询的卡片的数量(数量最大50)。 |
||
535 | * @param string $status_list 支持开发者拉出指定状态的卡券列表 |
||
536 | * |
||
537 | * @return array |
||
538 | */ |
||
539 | public function batchget($offset = 0, $count = 10, $status_list = 'CARD_STATUS_VERIFY_OK') |
||
540 | { |
||
541 | if (!is_numeric($offset) || $offset < 0) { |
||
542 | $this->setError('offset 参数不正确'); |
||
543 | |||
544 | return false; |
||
545 | } |
||
546 | |||
547 | if (!is_numeric($count) || $count < 0 || $count > 50) { |
||
548 | $this->setError('count 参数不正确'); |
||
549 | |||
550 | return false; |
||
551 | } |
||
552 | |||
553 | $queryStr = []; |
||
554 | $queryStr['offset'] = $offset; |
||
555 | $queryStr['count'] = $count; |
||
556 | $queryStr['status_list'] = $status_list; |
||
557 | |||
558 | $this->apitype = 'card'; |
||
559 | $this->module = 'batchget'; |
||
560 | $res = $this->_post('', $queryStr); |
||
561 | |||
562 | return $res; |
||
563 | } |
||
564 | |||
565 | /** |
||
566 | * 修改卡券 |
||
567 | * |
||
568 | * @param string $card_id [卡券ID] |
||
569 | * @param string $type [卡券类型] |
||
570 | * @param array $base_info [必要字段] |
||
571 | * @param array $especial [特殊字段] |
||
572 | * |
||
573 | * @return bool send_check 是否提交审核,false为修改后不会重新提审,true为修改字段后重新提审,该卡券的状态变为审核中 |
||
574 | */ |
||
575 | public function update($card_id, $type, $base_info = [], $especial = []) |
||
576 | { |
||
577 | View Code Duplication | if (empty($card_id) || empty($type) || !is_array($base_info) || !is_array($especial)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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. ![]() |
|||
578 | $this->setError('参数缺失'); |
||
579 | |||
580 | return false; |
||
581 | } |
||
582 | |||
583 | $card = []; |
||
584 | $card['card_id'] = $card_id; |
||
585 | $card[$type] = []; |
||
586 | |||
587 | $card_info = []; |
||
588 | $card_info['base_info'] = $base_info; |
||
589 | |||
590 | $card[$type] = array_merge($card_info, $especial); |
||
591 | |||
592 | $this->apitype = 'card'; |
||
593 | $this->module = 'update'; |
||
594 | $res = $this->_post('', $card); |
||
595 | |||
596 | return $res; |
||
597 | } |
||
598 | |||
599 | /** |
||
600 | * 设置微信买单接口 |
||
601 | * |
||
602 | * @param string $card_id 卡券ID |
||
603 | * @param boolean $is_open 是否开启买单功能,填true/false |
||
604 | * |
||
605 | * @return bool|array |
||
606 | */ |
||
607 | View Code Duplication | public function paycellSet($card_id, $is_open = true) |
|
0 ignored issues
–
show
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. ![]() |
|||
608 | { |
||
609 | $queryStr = []; |
||
610 | $queryStr['card_id'] = $card_id; |
||
611 | $queryStr['is_open'] = $is_open; |
||
612 | |||
613 | $this->apitype = 'card'; |
||
614 | $this->module = 'paycell'; |
||
615 | |||
616 | $res = $this->_post('set', $queryStr); |
||
617 | |||
618 | return $res; |
||
619 | } |
||
620 | |||
621 | /** |
||
622 | * 修改库存接口 |
||
623 | * |
||
624 | * @param string $card_id 卡券ID |
||
625 | * @param string $stock 操作 increase(增加) reduce(减少) |
||
626 | * @param integer $value 数值 |
||
627 | * |
||
628 | * @return [type] [description] |
||
0 ignored issues
–
show
The doc-type
[type] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
629 | */ |
||
630 | public function modifystock($card_id, $stock = 'increase', $value = 0) |
||
631 | { |
||
632 | $queryStr = []; |
||
633 | $queryStr['card_id'] = $card_id; |
||
634 | if ($stock == 'increase') { |
||
635 | $queryStr['increase_stock_value'] = intval($value); |
||
636 | } elseif ($stock == 'reduce') { |
||
637 | $queryStr['reduce_stock_value'] = intval($value); |
||
638 | } else { |
||
639 | $this->setError('$stock 参数错误'); |
||
640 | |||
641 | return false; |
||
642 | } |
||
643 | |||
644 | $this->apitype = 'card'; |
||
645 | $this->module = 'modifystock'; |
||
646 | |||
647 | $res = $this->_post('', $queryStr); |
||
648 | |||
649 | return $res; |
||
650 | } |
||
651 | |||
652 | /** |
||
653 | * 更改Code接口 |
||
654 | * |
||
655 | * @param string $code 需变更的Code码 |
||
656 | * @param string $new_code 变更后的有效Code码 |
||
657 | * @param string $card_id 卡券ID。自定义Code码卡券为必填 |
||
658 | * |
||
659 | * @return |
||
660 | */ |
||
661 | View Code Duplication | public function codeUpdate($code, $new_code, $card_id) |
|
0 ignored issues
–
show
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. ![]() |
|||
662 | { |
||
663 | if (empty($code) || empty($new_code)) { |
||
664 | $this->setError('缺少错误'); |
||
665 | |||
666 | return false; |
||
667 | } |
||
668 | |||
669 | $queryStr = []; |
||
670 | $queryStr['code'] = $code; |
||
671 | $queryStr['new_code'] = $new_code; |
||
672 | if (!empty($card_id)) { |
||
673 | $queryStr['card_id'] = $card_id; |
||
674 | } |
||
675 | |||
676 | $this->apitype = 'card'; |
||
677 | $this->module = 'code'; |
||
678 | |||
679 | $res = $this->_post('update', $queryStr); |
||
680 | |||
681 | return $res; |
||
682 | } |
||
683 | |||
684 | /** |
||
685 | * 删除卡券接口 |
||
686 | * |
||
687 | * @param string $card_id 变更后的有效Code码。 |
||
688 | * |
||
689 | * @return |
||
690 | */ |
||
691 | View Code Duplication | public function cardDelete($card_id) |
|
0 ignored issues
–
show
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. ![]() |
|||
692 | { |
||
693 | if (empty($card_id)) { |
||
694 | $this->setError('缺少错误'); |
||
695 | |||
696 | return false; |
||
697 | } |
||
698 | |||
699 | $queryStr = []; |
||
700 | $queryStr['card_id'] = $card_id; |
||
701 | |||
702 | $this->apitype = 'card'; |
||
703 | $this->module = 'delete'; |
||
704 | $res = $this->_post('', $queryStr); |
||
705 | |||
706 | return $res; |
||
707 | } |
||
708 | |||
709 | /** |
||
710 | * 设置卡券失效 |
||
711 | * |
||
712 | * @param string $code 设置失效的Code码。 |
||
713 | * @param string $card_id 卡券ID 非自定义code 可不填。 |
||
714 | * |
||
715 | * @return |
||
716 | */ |
||
717 | View Code Duplication | public function unavailable($code, $card_id) |
|
0 ignored issues
–
show
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. ![]() |
|||
718 | { |
||
719 | if (empty($code)) { |
||
720 | $this->setError('缺少错误'); |
||
721 | |||
722 | return false; |
||
723 | } |
||
724 | |||
725 | $queryStr = []; |
||
726 | $queryStr['code'] = $code; |
||
727 | |||
728 | if (!empty($card_id)) { |
||
729 | $queryStr['card_id'] = $card_id; |
||
730 | } |
||
731 | |||
732 | $this->apitype = 'card'; |
||
733 | $this->module = 'code'; |
||
734 | $res = $this->_post('unavailable', $queryStr); |
||
735 | |||
736 | return $res; |
||
737 | } |
||
738 | |||
739 | /** |
||
740 | * 拉取卡券概况数据接口 |
||
741 | * |
||
742 | * @param string $begin_date 查询数据的起始时间。 |
||
743 | * @param int $end_date 查询数据的截至时间。 |
||
744 | * @param int $cond_source 卡券来源,0为公众平台创建的卡券数据、1是API创建的卡券数据 |
||
745 | * |
||
746 | * @return array |
||
747 | */ |
||
748 | View Code Duplication | public function getcardbizuininfo($begin_date, $end_date, $cond_source = 0) |
|
0 ignored issues
–
show
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. ![]() |
|||
749 | { |
||
750 | if (empty($begin_date) || empty($end_date) || !is_numeric($cond_source) || $cond_source < 0 || $cond_source > 1) { |
||
751 | $this->setError('参数错误'); |
||
752 | |||
753 | return false; |
||
754 | } |
||
755 | |||
756 | if (is_numeric($begin_date)) { |
||
757 | $begin_date = date('Y-m-d', $begin_date); |
||
758 | } |
||
759 | |||
760 | if (is_numeric($end_date)) { |
||
761 | $end_date = date('Y-m-d', $end_date); |
||
762 | } |
||
763 | |||
764 | $queryStr = []; |
||
765 | $queryStr['begin_date'] = $begin_date; |
||
766 | $queryStr['end_date'] = $end_date; |
||
767 | $queryStr['cond_source'] = intval($cond_source); |
||
768 | |||
769 | $this->apitype = 'datacube'; |
||
770 | $this->module = 'getcardbizuininfo'; |
||
771 | $res = $this->_post('', $queryStr); |
||
772 | |||
773 | return $res; |
||
774 | } |
||
775 | |||
776 | /** |
||
777 | * 获取免费券数据接口 |
||
778 | * |
||
779 | * @param string $begin_date 查询数据的起始时间。 |
||
780 | * @param int $end_date 查询数据的截至时间。 |
||
781 | * @param int $cond_source 卡券来源,0为公众平台创建的卡券数据、1是API创建的卡券数据 |
||
782 | * @param string $card_id 卡券来源,0为公众平台创建的卡券数据、1是API创建的卡券数据 |
||
783 | * |
||
784 | * @return array |
||
785 | */ |
||
786 | public function getcardcardinfo($begin_date, $end_date, $cond_source = 0, $card_id = '') |
||
787 | { |
||
788 | if (empty($begin_date) || empty($end_date) || !is_numeric($cond_source) || $cond_source < 0 || $cond_source > 1) { |
||
789 | $this->setError('参数错误'); |
||
790 | |||
791 | return false; |
||
792 | } |
||
793 | |||
794 | if (is_numeric($begin_date)) { |
||
795 | $begin_date = date('Y-m-d', $begin_date); |
||
796 | } |
||
797 | |||
798 | if (is_numeric($end_date)) { |
||
799 | $end_date = date('Y-m-d', $end_date); |
||
800 | } |
||
801 | |||
802 | $queryStr = []; |
||
803 | $queryStr['begin_date'] = $begin_date; |
||
804 | $queryStr['end_date'] = $end_date; |
||
805 | $queryStr['cond_source'] = intval($cond_source); |
||
806 | |||
807 | if (!empty($card_id)) { |
||
808 | $queryStr['card_id'] = $card_id; |
||
809 | } |
||
810 | |||
811 | $this->apitype = 'datacube'; |
||
812 | $this->module = 'getcardcardinfo'; |
||
813 | $res = $this->_post('', $queryStr); |
||
814 | |||
815 | return $res; |
||
816 | } |
||
817 | |||
818 | /** |
||
819 | * 拉取会员卡数据接口 |
||
820 | * |
||
821 | * @param string $begin_date 查询数据的起始时间。 |
||
822 | * @param int $end_date 查询数据的截至时间。 |
||
823 | * @param int $cond_source 卡券来源,0为公众平台创建的卡券数据、1是API创建的卡券数据 |
||
824 | * |
||
825 | * @return array |
||
826 | */ |
||
827 | View Code Duplication | public function getcardmembercardinfo($begin_date, $end_date, $cond_source = 0) |
|
0 ignored issues
–
show
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. ![]() |
|||
828 | { |
||
829 | if (empty($begin_date) || empty($end_date) || !is_numeric($cond_source) || $cond_source < 0 || $cond_source > 1) { |
||
830 | $this->setError('参数错误'); |
||
831 | |||
832 | return false; |
||
833 | } |
||
834 | |||
835 | if (is_numeric($begin_date)) { |
||
836 | $begin_date = date('Y-m-d', $begin_date); |
||
837 | } |
||
838 | |||
839 | if (is_numeric($end_date)) { |
||
840 | $end_date = date('Y-m-d', $end_date); |
||
841 | } |
||
842 | |||
843 | $queryStr = []; |
||
844 | $queryStr['begin_date'] = $begin_date; |
||
845 | $queryStr['end_date'] = $end_date; |
||
846 | $queryStr['cond_source'] = intval($cond_source); |
||
847 | |||
848 | $this->apitype = 'datacube'; |
||
849 | $this->module = 'getcardmembercardinfo'; |
||
850 | $res = $this->_post('', $queryStr); |
||
851 | |||
852 | return $res; |
||
853 | } |
||
854 | |||
855 | /** |
||
856 | * 会员卡接口激活 |
||
857 | * |
||
858 | * @param array $activate 数据 |
||
859 | * |
||
860 | * @return |
||
861 | */ |
||
862 | public function activate($activate = []) |
||
863 | { |
||
864 | if (empty($activate) || !is_array($activate)) { |
||
865 | $this->setError('参数错误'); |
||
866 | |||
867 | return false; |
||
868 | } |
||
869 | |||
870 | $queryStr = $activate; |
||
871 | |||
872 | $this->apitype = 'card'; |
||
873 | $this->module = 'membercard'; |
||
874 | $res = $this->_post('activate', $queryStr); |
||
875 | |||
876 | return $res; |
||
877 | } |
||
878 | |||
879 | /** |
||
880 | * 设置开卡字段接口 |
||
881 | * |
||
882 | * @param string $card_id 卡券ID。 |
||
883 | * @param array $required_form 会员卡激活时的必填选项。 |
||
884 | * @param array $optional_form 会员卡激活时的选填项。 |
||
885 | * |
||
886 | * string common_field_id_list 微信格式化的选项类型。见以下列表。 |
||
887 | * string custom_field_list 喜欢的家具风格 自定义选项名称。 |
||
888 | * |
||
889 | * @return array|bool |
||
890 | */ |
||
891 | public function activateuserform($card_id, $required_form = [], $optional_form = []) |
||
892 | { |
||
893 | if (empty($card_id) || !is_array($required_form) || !is_array($optional_form)) { |
||
894 | $this->setError('参数错误'); |
||
895 | |||
896 | return false; |
||
897 | } |
||
898 | |||
899 | $queryStr = []; |
||
900 | $queryStr['card_id'] = $card_id; |
||
901 | |||
902 | $queryStr = array_merge($queryStr, $required_form, $optional_form); |
||
903 | |||
904 | $this->apitype = 'card'; |
||
905 | $this->module = 'membercard'; |
||
906 | $res = $this->_post('activateuserform/set', $queryStr); |
||
907 | |||
908 | return $res; |
||
909 | } |
||
910 | |||
911 | /** |
||
912 | * 拉取会员信息接口 |
||
913 | * |
||
914 | * @param string $card_id CardID |
||
915 | * @param string $code Code |
||
916 | * |
||
917 | * @return array |
||
918 | */ |
||
919 | View Code Duplication | public function membercardUserinfo($card_id, $code) |
|
0 ignored issues
–
show
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. ![]() |
|||
920 | { |
||
921 | if (empty($card_id) || empty($code)) { |
||
922 | $this->setError('缺少参数'); |
||
923 | |||
924 | return false; |
||
925 | } |
||
926 | |||
927 | $queryStr = []; |
||
928 | $queryStr['card_id'] = $card_id; |
||
929 | $queryStr['code'] = $code; |
||
930 | |||
931 | $this->apitype = 'card'; |
||
932 | $this->module = 'membercard'; |
||
933 | $res = $this->_post('userinfo/get', $queryStr); |
||
934 | |||
935 | return $res; |
||
936 | } |
||
937 | |||
938 | /** |
||
939 | * 更新会员信息 |
||
940 | * |
||
941 | * @param array $updateuser 参数 |
||
942 | * |
||
943 | * @return array|bool |
||
944 | */ |
||
945 | public function membercardUpdateuser($updateuser = []) |
||
946 | { |
||
947 | if (empty($updateuser) || !is_array($updateuser)) { |
||
948 | $this->setError('参数错误'); |
||
949 | |||
950 | return false; |
||
951 | } |
||
952 | |||
953 | $queryStr = $updateuser; |
||
954 | |||
955 | $this->apitype = 'card'; |
||
956 | $this->module = 'membercard'; |
||
957 | $res = $this->_post('updateuser', $queryStr); |
||
958 | |||
959 | return $res; |
||
960 | } |
||
961 | |||
962 | /** |
||
963 | * 添加子商户 |
||
964 | * |
||
965 | * @param string $brand_name 子商户名称(12个汉字内),该名称将在制券时填入并显示在卡券页面上 |
||
966 | * @param string $logo_url 子商户logo,可通过上传logo接口获取。该logo将在制券时填入并显示在卡券页面上 |
||
967 | * @param string $protocol 授权函ID,即通过上传临时素材接口上传授权函后获得的meida_id |
||
968 | * @param int $end_time 授权函有效期截止时间(东八区时间,单位为秒),需要与提交的扫描件一致 |
||
969 | * @param string $primary_category_id 一级类目id,可以通过本文档中接口查询 |
||
970 | * @param string $secondary_category_id 二级类目id,可以通过本文档中接口查询 |
||
971 | * @param string $agreement_media_id 营业执照或个体工商户营业执照彩照或扫描件 |
||
972 | * @param string $operator_media_id 营业执照内登记的经营者身份证彩照或扫描件 |
||
973 | * @param string $app_id 子商户的公众号app_id,配置后子商户卡券券面上的app_id为该app_id。注意:该app_id须经过认证 |
||
974 | * |
||
975 | * @return bool|array |
||
976 | */ |
||
977 | public function submerchant($brand_name, $logo_url, $protocol, $end_time, $primary_category_id, $secondary_category_id, $agreement_media_id, $operator_media_id, $app_id = '') |
||
978 | { |
||
979 | $queryStr = []; |
||
980 | if (!empty($app_id)) { |
||
981 | $queryStr['info']['app_id'] = $app_id; |
||
982 | } |
||
983 | $queryStr['info']['brand_name'] = $brand_name; |
||
984 | $queryStr['info']['logo_url'] = $logo_url; |
||
985 | $queryStr['info']['protocol'] = $protocol; |
||
986 | $queryStr['info']['end_time'] = intval($end_time); |
||
987 | $queryStr['info']['primary_category_id'] = $primary_category_id; |
||
988 | $queryStr['info']['secondary_category_id'] = $secondary_category_id; |
||
989 | $queryStr['info']['agreement_media_id'] = $agreement_media_id; |
||
990 | $queryStr['info']['operator_media_id'] = $operator_media_id; |
||
991 | |||
992 | $this->apitype = 'card'; |
||
993 | $this->module = 'submerchant'; |
||
994 | |||
995 | $res = $this->_post('submit', $queryStr); |
||
996 | |||
997 | return $res; |
||
998 | } |
||
999 | |||
1000 | /** |
||
1001 | * 卡券开放类目查询接口 |
||
1002 | * |
||
1003 | * @return array|bool |
||
1004 | */ |
||
1005 | public function getapplyprotocol() |
||
1006 | { |
||
1007 | $this->apitype = 'card'; |
||
1008 | $this->module = 'getapplyprotocol'; |
||
1009 | |||
1010 | $queryStr = []; |
||
1011 | $res = $this->_get('', $queryStr); |
||
1012 | |||
1013 | return $res; |
||
1014 | } |
||
1015 | |||
1016 | /** |
||
1017 | * 朋友券锁定接口 |
||
1018 | * |
||
1019 | * @author yangyang <[email protected]> |
||
1020 | * |
||
1021 | * @date 2016-10-12 |
||
1022 | * |
||
1023 | * @param int $code 需要锁定的code码 |
||
1024 | * @param string $card_id 需要锁定的card_id |
||
1025 | * @param string $openid 领取者的openid |
||
1026 | * @param boolean $is_mark 是否要mark(占用)这个code,填写true或者false,表示占用或解除占用 |
||
1027 | * |
||
1028 | * @return array|bool |
||
1029 | */ |
||
1030 | public function mark($code, $card_id, $openid, $is_mark = true) |
||
1031 | { |
||
1032 | if (empty($code) || empty($card_id) || empty($openid)) { |
||
1033 | $this->setError('参数错误'); |
||
1034 | |||
1035 | return false; |
||
1036 | } |
||
1037 | |||
1038 | $queryStr = []; |
||
1039 | |||
1040 | $queryStr['code'] = $code; |
||
1041 | $queryStr['card_id'] = $card_id; |
||
1042 | $queryStr['openid'] = $openid; |
||
1043 | $queryStr['is_mark'] = $is_mark; |
||
1044 | |||
1045 | $this->apitype = 'card'; |
||
1046 | $this->module = 'code'; |
||
1047 | $res = $this->_post('mark', $queryStr); |
||
1048 | |||
1049 | return $res; |
||
1050 | } |
||
1051 | |||
1052 | } |
||
1053 |
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.