示例#1
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;
	}
示例#2
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;
    }
示例#3
0
/**
 * 输出json数据
 * @param mixed $data 主数据
 * @param int $error error code
 * @param string $msg error message
 */
function printJson($data = null, $error = 0, $msg = '', $exit = true)
{
    $ar = array('data' => $data, 'error' => $error, 'msg' => $msg);
    if (function_exists('code_unescaped')) {
        echo code_unescaped($ar);
    } else {
        echo json_encode($ar);
    }
    if ($exit === true) {
        exit;
    }
}