设置买单接口
@param string $card_id
@param bool $is_open
@return array
@throws Exceptions\InvalidResponseException
@throws Exceptions\LocalCacheException
760242
public function setPaycell($card_id, $is_open = true)
    {
        $url = "https://api.weixin.qq.com/card/paycell/set?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['card_id' => $card_id, 'is_open' => $is_open]);
    }
699718
public function consume($code, $card_id = null)
    {
        $data = ['code' => $code];
        is_null($card_id) || $data['card_id'] = $card_id;
        $url = "https://api.weixin.qq.com/card/code/consume?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
819812
String getContentByCardId(String cardId) {
        Map<String, Object> request = new HashMap<>();
        request.put("card_id", cardId);

        String url = WxEndpoint.get("url.card.mpnews.gethtml");
        String json = JsonMapper.defaultMapper().toJson(request);
        logger.debug("get mpnews content by card id: {}", json);
        String response = wxClient.post(url, json);
        Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response);
        if (result.containsKey("content")) {
            return result.get("content").toString();
        } else {
            throw new WxRuntimeException(999, "get html content by card id failed.");
        }
    }
192058
public function unAvailable($code, $card_id, $reason = null)
    {
        $data = ['code' => $code, 'card_id' => $card_id];
        is_null($reason) || $data['reason'] = $reason;
        $url = "https://api.weixin.qq.com/card/code/unavailable?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
302303
public function getCard($card_id)
    {
        if (empty($card_id)) {
            return false;
        }
        $result = $this->httpRaw(static::WECHAT_GET_CARD_URL . 'access_token=' . $this->getAccessToken(), Json::encode([
            'card_id' => $card_id
        ]));

        return isset($result['card']) ? $result['card'] : false;
    }
995522
public function customWxcard($card_id = '', $card_ext = [], $openid, $kf_account = '')
    {
        $queryStr                       = [];
        $queryStr['touser']             = $openid;
        $queryStr['msgtype']            = 'wxcard';
        $queryStr['wxcard']['card_id']  = $card_id;
        $queryStr['wxcard']['card_ext'] = $card_ext;

        $queryStr['customservice']['kf_account'] = $kf_account;

        $this->module = 'message';

        $res = $this->_post('custom/send', $queryStr);

        return $res;
    }
193079
public function deleteCard($card_id)
    {
        if (empty($card_id)) {
            return false;
        }

        $result = $this->httpPost(static::WECHAT_DELETE_CARD_URL . 'access_token=' . $this->getAccessToken(), [
            'card_id' => $card_id
        ]);

        return isset($result['errmsg']) && $result['errmsg'] === 'ok' ? true : false;
    }
354722
public function getCardMemberCard($card_id, $code)
    {
        $data = ['card_id' => $card_id, 'code' => $code];
        $url = "https://api.weixin.qq.com/card/membercard/userinfo/get?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
1179624
public function update($card_id, $type, $base_info = [], $especial = [])
    {
        if (empty($card_id) || empty($type) || !is_array($base_info) || !is_array($especial)) {
            $this->setError('参数缺失');

            return false;
        }

        $card            = [];
        $card['card_id'] = $card_id;
        $card[$type]     = [];

        $card_info              = [];
        $card_info['base_info'] = $base_info;

        $card[$type] = array_merge($card_info, $especial);

        $this->apitype = 'card';
        $this->module  = 'update';
        $res           = $this->_post('', $card);

        return $res;
    }
1025243
public function getCardList($openid, $card_id = null)
    {
        $data = ['openid' => $openid];
        is_null($card_id) || $data['card_id'] = $card_id;
        $url = "https://api.weixin.qq.com/card/user/getcardlist?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
473058
public function openidWxcard($card_id = '', $openids = [])
    {
        $queryStr                      = [];
        $queryStr['touser']            = $openids;
        $queryStr['wxcard']['card_id'] = $card_id;
        $queryStr['msgtype']           = 'wxcard';

        $this->module = 'message';

        $res = $this->_post('mass/send', $queryStr);

        return $res;
    }
1011831
public function getMembercardUserInfo($code, $card_id)
    {
        $params = array();
        $params['code'] = $code;
        $params['card_id'] = $card_id;
        $rst = $this->_request->post($this->_url . 'card/membercard/userinfo/get', $params);
        return $this->_client->rst($rst);
    }
300531
public function updateCardCode($cardId, $code, $newCode)
    {
        $data = json_encode([
            'code' => (string) $code,
            'card_id' => (string) $cardId,
            'new_code' => (string) $newCode,
        ], JSON_UNESCAPED_UNICODE);

        return $this->auth(function () use ($data) {
            $result = $this->http->postJson(
                $this->baseUrl . 'card/code/update?access_token=' . $this->accessToken,
                $data
            );

            return $result;
        });
    }
1222641
public function activateuserform($card_id, $required_form = [], $optional_form = [])
    {
        if (empty($card_id) || !is_array($required_form) || !is_array($optional_form)) {
            $this->setError('参数错误');

            return false;
        }

        $queryStr            = [];
        $queryStr['card_id'] = $card_id;

        $queryStr = array_merge($queryStr, $required_form, $optional_form);

        $this->apitype = 'card';
        $this->module  = 'membercard';
        $res           = $this->_post('activateuserform/set', $queryStr);

        return $res;
    }
719882
public function updateCardCode($code,$card_id,$new_code) {
        $data = array(
            'code' => $code,
            'card_id' => $card_id,
            'new_code' => $new_code,
        );
        if (!$this->access_token && !$this->checkAuth()) return false;
        $result = $this->http_post(self::API_BASE_URL_PREFIX . self::CARD_CODE_UPDATE . 'access_token=' . $this->access_token, self::json_encode($data));
        if ($result) {
            $json = json_decode($result, true);
            if (!$json || !empty($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg  = $json['errmsg'];
                return false;
            }
            return true;
        }
        return false;
    }
1075246
public function setCodeUnavailable($code, $card_id = null)
    {
        if (empty($code)) {
            return false;
        }
        $result = $this->httpRaw(static::WECHAT_SET_CARD_CODE_UNAVAILABLE_URL . 'access_token=' . $this->getAccessToken(), [
            'code' => $code,
            empty($card_id) && 'card_id' => $card_id
        ]);
        return isset($result['errmsg']) && $result['errmsg'] === 'ok' ? true : false;
    }
610803
public function getPayprice($card_id, $quantity)
    {
        $url = "POST https://api.weixin.qq.com/card/pay/getpayprice?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['card_id' => $card_id, 'quantity' => $quantity]);
    }