<?php
header("content-type:text/html; charset=utf-8");
set_time_limit(0);
//产品验真+产品详情信息
function checkKey($code){
$ws = "http://220.165.15.56/grxService/GrxService.svc?wsdl";
$wcfClient = new SoapClient ($ws);
$parameters = array('memSysPswd'=>'abcd1234',
'scrapingCode'=>$code);
$wcfResult_va = $wcfClient->ProductValidation($parameters);
$wcfResult_info = $wcfClient->GetMemSysProductInfo($parameters);
$wcfResult_info = get_object_vars($wcfResult_info->GetMemSysProductInfoResult);
if($wcfResult_va->ProductValidationResult==true){
array_shift($wcfResult_info);
return $wcfResult_info;
}else{
return false;
}
}
//积分领取记录
/*
$parameters_po = array('memSysPswd'=>'abcd1234',
'productId'=>$wcfResult_info->GetMemSysProductInfoResult->ID);
$wcfResult_po;
$wcfResult_po = $wcfClient->GetEarnPointsLog($parameters_po);
*/
//领取积分
/*
$parameters_ep = array('memSysPswd'=>'abcd1234',
'memId'=>'',
'memName'=>'',
'scrapingCode'=>'E21342Z6');
$wcfResult_ep = $wcfClient->EarnPoints($parameters_ep);
var_dump($wcfResult_ep);
*/
//获取服务器上的方法和数据类型
/*
echo ("服务器返回值");
echo ("SOAP服务器提供的开放函数:");
var_dump ( $wcfClient->__getFunctions () );
echo ("SOAP服务器提供的数据类型:");
var_dump ( $wcfClient->__getTypes () );
*/
//产品验真
if($g['act']=="checkKey"){
if ($_SESSION['memberauth_id']){
$key = trim($g['key']);
$code = trim($g['code']);
if($code==$_SESSION["login_check_num"]){
//验证码正确
$rs = checkKey($key);//如果验证成功返回产品详情数组否则返回false
if($rs==false){
echo "keyHad";
}else{
$str = "产品名称:".$rs["ProductName"]."<br/>";
$str.= "产地:".$rs["Production"]."<br/>";
$str.= "储藏年份:".$rs["Corruptyear"]."年<br/>";
$str.= "重量:".$rs["Weight"]."克<br/>";
echo $str;
}
}else{
//验证码错误
echo "codeHad";
}
}else{
echo "sessionHad";
}
return;
}
function checkKey(){
var key = $("#key").val();
var code = $("#code").val();
//alert(ajaxurl+"ajax.php?act=checkKey&key="+key+"&code="+code);
$("#checkKeyButton").val("正在查询请稍后");
$.ajax({
type: "GET",
url: ajaxurl+"ajax.php?act=checkKey&key="+key+"&code="+code,
success: function (msg) {
if(msg=="sessionHad"){
if(confirm("请先登录")){location.href = "user.php?action=login"};
}else if(msg=="codeHad"){
alert("验证码错误");
}else if(msg=="keyHad"){
$("#queryResult").text("没有找到对应产品!");
}else{
$("#queryResult").text("你的产品是正品,请放心食用");
$("#queryResultDetails").addClass("active");
$("#queryResultDetails").text(msg);
}
$("#checkKeyButton").val("查询");
}
})
}
extension=php_openssl.dll
extension=php_soap.dll
set_time_limit(0);
get_object_vars(0);
array_shift($wcfResult_info);
产品详情信息
[16]=>
string(83) "GetMemSysProductInfoResponse GetMemSysProductInfo(GetMemSysProductInfo $parameters)"
[45]=>
string(73) "struct GetMemSysProductInfo {string memSysPswd;
string scrapingCode;
}"
return object
产品验真
[17]=>
string(74) "ProductValidationResponse ProductValidation(ProductValidation $parameters)"
[47]=>
string(70) "struct ProductValidation {
string memSysPswd;
string scrapingCode;
}"
return bool
积分领取记录
[18]=>
string(71) "GetEarnPointsLogResponse GetEarnPointsLog(GetEarnPointsLog $parameters)"
[49]=>
string(63) "struct GetEarnPointsLog {
string memSysPswd;
int productId;
}"
领取积分
[19]=>
string(53) "EarnPointsResponse EarnPoints(EarnPoints $parameters)"
[51]=>
string(92) "struct EarnPoints {
string memSysPswd;
int memId;
string memName;
string scrapingCode;
}"