<?php include "../inc/odbc.php"; ?>
|
<?php include "../inc/function.php"; ?>
|
<?php
|
function object_array($array) {
|
if(is_object($array)) {
|
$array = (array)$array;
|
}
|
if(is_array($array)) {
|
foreach($array as $key=>$value) {
|
$array[$key] = object_array($value);
|
}
|
}
|
return $array;
|
}
|
|
$postData = json_decode(file_get_contents('php://input',true),true);
|
|
// var_dump($postData);exit;
|
$num = 0;
|
$formID_arr = json_decode(($postData["formID"]),true);
|
if (isset($formID_arr)){
|
foreach($formID_arr as $v){
|
if(empty(object_array($v)["formID"]) || empty($postData["openId"]) || empty($postData["regiOPENID"]) || empty($postData["formID_status"]) || object_array($v)["formID"] == "the formId is a mock one"){
|
$num -= 1;
|
}else{
|
$num += 1;
|
}
|
if(object_array($v)["formID"] != "the formId is a mock one"){
|
$formID = object_array($v)["formID"];
|
$openId = $postData["openId"];
|
|
$regiOPENID = $postData["regiOPENID"];
|
|
$formID_status = $postData["formID_status"];
|
|
|
$insert_sql = "INSERT INTO weixinUserFormID (formID_detail,formID_openId,formID_regiOPENID,formID_status) VALUES ('$formID','$openId','$regiOPENID',$formID_status)";
|
|
$res = sqlsrv_query($conn,$insert_sql);
|
}
|
|
}
|
}
|
if($num>0){
|
$msg = array(
|
"result"=>1,
|
"msg"=>"成功"
|
);
|
}else{
|
$msg = array(
|
"result"=>0,
|
"msg"=>"失败"
|
);
|
}
|
|
echo json_encode($msg,JSON_UNESCAPED_UNICODE);
|
|
?>
|