Code Duplication    Length = 21-22 lines in 2 locations

src/API/CardApi.php 2 locations

@@ 397-417 (lines=21) @@
394
     *
395
     * @return array
396
     */
397
    public function codeGet($code, $check_consume = true, $card_id = '')
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
     * 核销卡券
@@ 661-682 (lines=22) @@
658
     *
659
     * @return
660
     */
661
    public function codeUpdate($code, $new_code, $card_id)
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
     * 删除卡券接口