Ejemplo n.º 1
0
    /**
     * 查看会员信息
     */
    public function getMemberCardUserInfo($data) {
        $url = sprintf(self::get_member_card_user_info, $this->_token);
        $json = code_unescaped($data);
        $result = WeiXinApiRequest::post($url, $json, false, false);
        // 写入系统日志
        $this->_debug && Factory::getSystemLog()->push("getMemberCardUserInfo  拉取会员信息(积分查询)接口:", array(
                    'data' => $data,
                    'json' => $json,
                    'result' => $result
        ));

        if ($result ['errcode'] != 0) {
            $this->error = array(
                'errcode' => $result ['errcode'],
                'errmsg' => $result ['errmsg']
            );
            return $this->error;
        }
        return $result;
    }
Ejemplo n.º 2
0
	public function code_info($code, $card_id) {
		$url = sprintf(self::code_info, $this->token);
		
		$json = code_unescaped(array('code'=>$code, 'card_id'=>$card_id));
		$result = WeiXinApiRequest::post($url, $json, false, false);
		
		//写入系统日志
		$this->debug && Factory::getSystemLog()->push("CardPacket code_info获取卡券领取信息:", array('code'=>$code, 'card_id'=>$card_id, 'result'=>$result));
		
		if($result['errcode']==0){
			return $result['openid'];
		}
		
		return FALSE;
	}
Ejemplo n.º 3
0
	/**
     * 上传附件
     *
     * 对应API:{@link http://api.weixin.qq.com/cgi-bin/media/upload}
     *
     * @param stirng $type 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
     * @param string $attachment 要上传附件的路径:绝对路径
     * @return array $media array('media_id' => , 'thumb_media_id' => )
     */
	protected function _upload($type, $attachment)
	{
		$params = array ();
		$params['type'] = $type;
		$params['media'] = '@' . $attachment;
		$path = 'media/upload';
		$response = WeiXinApiRequest::post($this->_genUrl($path, array(), true), $params, false, false);
		return call_user_func_array(array (
				$this,
				'_parse'
		), array (
				WeiXinApiRequest::$http_code,
				$response,
				'_parseUpload'
		));
	}
Ejemplo n.º 4
0
	/**
	 * 解密code
	 * https://api.weixin.qq.com/card/code/decrypt?access_token=TOKEN
	 * @param string $encrypt_code 加密的code
	 * @return string $decrypt_code 
	 */
	public function decryptCode($encrypt_code)
	{
		// 参数验证
		if (empty($encrypt_code)) {
			return false;
		}
		$param = array(
				'$encrypt_code' => $encrypt_code,
		);
		$url = $this->_getUrl('card/code/decrypt');
		// WeiXinApiRequest::$debug = 1;
		$json = new Json();
		$param = $json->encode($param, false);
		$response = WeiXinApiRequest::post($url, $param);
		return call_user_func_array(array(
				$this,
				'_parse'
		), array(
				WeiXinApiRequest::$http_code,
				$response,
				'_parseDecryptCode'
		));
	}