微信卡券：JSAPI 卡券Package - 基础参数没有附带任何值 - 再生产环境中需要根据实际情况进行修改

@param string $card_id
@param int    $code
@param int    $openid
@param int    $outer_id
@param int    $timestamp
@param int    $api_ticket

@return array
760855
public function wxCardPackage(array $card_list, $timestamp = null, $api_ticket = null)
    {
        if (!is_array($card_list)) {
            $this->setError('参数缺失');

            return false;
        }

        if (empty($timestamp) || $timestamp == '') {
            $timestamp = time();
        }

        if (empty($api_ticket) || $api_ticket == '') {
            $api_ticket = $this->cardApiTicket();
        }

        $resultArray = [];
        foreach ($card_list as $key => $value) {
            if (empty($value['code']) || !isset($value['code'])) {
                $value['code'] = '';
            }
            if (empty($value['openid']) || !isset($value['openid'])) {
                $value['openid'] = '';
            }
            $arrays = [$api_ticket, $timestamp, $value['card_id'], $value['code'], $value['openid']];
            sort($arrays, SORT_STRING);
            $string = sha1(implode($arrays));

            $resultArray['cardList'][$key]['cardId']            = $value['card_id'];
            $resultArray['cardList'][$key]['cardExt']['code']   = $value['code'];
            $resultArray['cardList'][$key]['cardExt']['openid'] = $value['openid'];

            $resultArray['cardList'][$key]['cardExt']['timestamp'] = $timestamp;
            $resultArray['cardList'][$key]['cardExt']['signature'] = $string;

            if (!empty($value['outer_id'])) {
                $resultArray['cardList'][$key]['cardExt']['outer_id'] = $value['outer_id'];
            }
            $resultArray['cardList'][$key]['cardExt'] = json_encode($resultArray['cardList'][$key]['cardExt']);
        }
        $resultJson = json_encode($resultArray);

        return $resultJson;
    }
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;
    }
133160
public function lists($offset = 0, $count = 10, $statusList = array())
    {
        $params = array(
            'offset' => $offset,
            'count' => $count,
            'status_list' => $statusList,
        );

        $result = $this->http->jsonPost(self::API_LIST, $params);

        return $result['card_id_list'];
    }
233359
protected function get_access_token_params( $code, $client_id, $client_secret ) {
		return $this->filter_access_token_params( [
			'code'          => $code,
			'redirect_uri'  => $this->apply_filters( $this->get_service_name() . '_oauth_redirect_uri' ),
			'client_id'     => $client_id,
			'client_secret' => $client_secret,
		], $code, $client_id, $client_secret );
	}
580444
public function getNewsHtml($card_id)
    {
        $url = "https://api.weixin.qq.com/card/mpnews/gethtml?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['card_id' => $card_id]);
    }
899244
public function consume(string $code, string $cardId = null)
    {
        $params = [
            'code' => $code,
        ];

        if (!is_null($cardId)) {
            $params['card_id'] = $cardId;
        }

        return $this->httpPostJson('card/code/consume', $params);
    }
26399
public function codeUpdate($code, $new_code, $card_id)
    {
        if (empty($code) || empty($new_code)) {
            $this->setError('缺少错误');

            return false;
        }

        $queryStr             = [];
        $queryStr['code']     = $code;
        $queryStr['new_code'] = $new_code;
        if (!empty($card_id)) {
            $queryStr['card_id'] = $card_id;
        }

        $this->apitype = 'card';
        $this->module  = 'code';

        $res = $this->_post('update', $queryStr);

        return $res;
    }
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;
    }
907486
public function getdepositcount($card_id)
    {
        if (!is_string($card_id)) {
            $this->setError('参数错误');

            return false;
        }

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

        $this->apitype = 'card';
        $this->module  = 'code';
        $res           = $this->_post('getdepositcount', $queryStr);

        return $res;
    }
300817
public function codeGet($code, $check_consume = true, $card_id = '')
    {
        if (empty($code) || !is_bool($check_consume)) {
            $this->setError('参数错误');

            return false;
        }

        $queryStr = [];
        if (!empty($card_id)) {
            $queryStr['card_id'] = $card_id;
        }
        $queryStr['code']          = $code;
        $queryStr['check_consume'] = $check_consume;

        $this->apitype = 'card';
        $this->module  = 'code';
        $res           = $this->_post('get', $queryStr);

        return $res;
    }
746236
public function getJsTicket($appid='',$jsapi_ticket=''){
		if (!$this->access_token && !$this->checkAuth()) return false;
		if (!$appid) $appid = $this->appid;
		if ($jsapi_ticket) { //手动指定token，优先使用
		    $this->jsapi_ticket = $jsapi_ticket;
		    return $this->jsapi_ticket;
		}
		$authname = 'qywechat_jsapi_ticket'.$appid;
		if ($rs = $this->getCache($authname))  {
			$this->jsapi_ticket = $rs;
			return $rs;
		}
		$result = $this->http_get(self::API_URL_PREFIX.self::TICKET_GET_URL.'access_token='.$this->access_token);
		if ($result)
		{
			$json = json_decode($result,true);
			if (!$json || !empty($json['errcode'])) {
				$this->errCode = $json['errcode'];
				$this->errMsg = $json['errmsg'];
				return false;
			}
			$this->jsapi_ticket = $json['ticket'];
			$expire = $json['expires_in'] ? intval($json['expires_in'])-100 : 3600;
			$this->setCache($authname, $this->jsapi_ticket, $expire);
			return $this->jsapi_ticket;
		}
		return false;
	}
1356535
private function getJsApiTicket() {
        $key  = md5(__FILE__ . 'jsapi_ticket');
        $data = to_array(cache::get($key));
        if (!cache::check($key) || $data['expire_time'] < time()) {
            $accessToken = $this->getAccessToken();
            #提交URL地址
            $url  = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=$accessToken";
            $res  = to_array($this->httpGet($url));
            $data = array();
            #返回Ticket信息
            $ticket = $res['ticket'];
            if ($ticket) {
                $data['expire_time']  = time() + 7000;
                $data['jsapi_ticket'] = $ticket;
                cache::set($key, to_json($data), 7000);
            }
        } else {
            $ticket = $data['jsapi_ticket'];
        }
        return $ticket;
    }
1226087
public function deactivate(string $cardId, string $code)
    {
        $params = [
            'card_id' => $cardId,
            'code' => $code,
        ];

        return $this->httpPostJson('card/generalcard/unactivate', $params);
    }
654326
public function getCard($card_id)
    {
        $url = "https://api.weixin.qq.com/card/get?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['card_id' => $card_id]);
    }
660212
public function getIdByCode($alias, $code, $id_only = true, array $options = []) {
		$class = $this->data[$alias]['no_data_alias_model'];
		$model = new $class();
		$columns = [];
		if ($id_only) {
			$columns[] = $model->column_prefix . 'id';
		}
		$data = $model->get([
			'columns' => $columns,
			'where' => [
				$this->data[$alias]['no_data_alias_column'] => $code . ''
			],
			'pk' => null,
			'skip_acl' => $options['skip_acl'] ?? false,
			'no_cache' => true,
		]);
		// if we have results we need to make it single row
		if (isset($data[0])) {
			$data = $data[0];
		}
		if (!$id_only) {
			return $data;
		} else {
			return $data[$model->column_prefix . 'id'] ?? null;
		}
	}
1299148
public function updateStatus(string $id, string $code, string $status): array
    {
        return $this->httpClient->postJson('card/invoice/reimburse/updateinvoicestatus', ['card_id' => $id, 'encrypt_code' => $code, 'reimburse_status' => $status]);
    }
123557
public function previewWxcard($card_id = '', $userid = '', $type = 'openid')
    {
        $queryStr = [];

        if ($type == 'towxname') {
            $queryStr['towxname'] = $userid;
        } else {
            $queryStr['touser'] = $userid;
        }

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

        $this->module = 'message';

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

        return $res;
    }