Пример #1
0
	public function service($api)
	{
		$token = md5(microtime());
		meta('epay_auth_domain_only',$token,60);
		$server = base64_decode('aHR0cDovL3BheW1lbnQudHR0dWFuZ291Lm5ldA==').$api.'?charset='.ini('settings.charset').'&';
		$url = $server."url=".ini('settings.site_url')."/index.php?mod=bankdirect&token={$token}";
		try{
			$res = dfopen($url, 10485760, '', '', true, 5, 'CENWOR.TTTG.AUTH.BDT.AGENT.'.SYS_VERSION.'.'.SYS_BUILD);
			if ($res)
			{
				if ($api == '/merchant/api-kernel-file')
				{
					if (preg_match('/\r?\n\w+\r?\n/', $res))
					{
						$res = preg_replace('/\r?\n\w+\r?\n/', '', $res);
					}
					return array('file.b64' => $res, 'file.md5' => md5($res));
				}
				$load = new Load();
				$load->lib('servicesJSON');
				$json = new servicesJSON(16);
				$res = $json->decode($res);
			}
			else
			{
				return __('网络错误');
			}
		} catch (Exception $e) {
		    return __('未知错误');
		}
		if ($res['status'] == 'ok') {
			return $res['data'];
		}else{
			$data = array(
				'client.url.found.no'	=>__('URL地址格式不正确'),
				'client.idx.found.no'	=>__('未在数据库中找到对应的URL地址记录'),
				'client.url.illegal'	=>__('URL地址和数据库中的记录不匹配'),
				'server.http.error'		=>__('服务器HTTP请求失败'),
				'client.http.error'		=>__('用户站点请求失败'),
				'client.token.error'	=>__('Token校验失败'),
				'client.license.overdue'=>__('授权已经过期 '),
				'client.license.disabled'=>__('授权已经禁用'),
				'api.file.missing' => __('接口文件未找到')
				);
			return $data[$res['errcode']];
		}
	}
Пример #2
0
 function json_decode($json_value, $bool = false)
 {
     if (!class_exists('servicesJSON')) {
         jext('servicesJSON');
     }
     $assoc = $bool ? 16 : 32;
     $json = new servicesJSON($assoc);
     return $json->decode($json_value);
 }
Пример #3
0
	function json_decode($json_value, $bool = false)
	{
		if(!class_exists('servicesJSON'))
		{
			$load = new Load();
			$load->lib('servicesJSON');
		}
		$assoc = ($bool) ? 16 : 32;
		$json = new servicesJSON($assoc);
		return $json->decode($json_value);
	}