@ 2015-04-19T11:35:06Z <?php
/**
* @file requestUserInfo.php
* @TIME
* @brief Brief
* @Author Author
* @Website www.lotto-pass.cn
*
*/
define('IN_ECS', true);
//echo "<p>in request:";
//print_r($_POST);
$current_path = dirname(__FILE__);
$base_path = substr($current_path, 0, strlen($current_path) - strlen("/webservice"));
require_once($base_path . '/includes/init.php');
require_once(ROOT_PATH . 'includes/cls_json.php');
require_once(ROOT_PATH . 'includes/lib_common.php');
// echo "<p>After include:";
require_once (ROOT_PATH . 'includes/utilities/dbutilities.php');
require_once (ROOT_PATH . 'includes/webservice/webserviceutilities.php');
require_once (ROOT_PATH . 'includes/utilities/userUtilities.php');
$device_id = getHttpRequest("device_id");
$trans_time = getHttpRequest("trans_time");
$card_number = getHttpRequest("card_number");
$sessionId = getHttpRequest("sessionId");
$sessionTime = getHttpRequest("sessionTime");
$min_required_points = getHttpRequest("mpb");
$check_sum = getHttpRequest("checksum");
$check_sum_array = (
"device_id" => $device_id,
"trans_time" => $trans_time,
"card_number" => $card_number,
"sessionId" => $sessionId,
"sessionTime" => $sessionTime,
"mpb" => $min_required_points,
"checksum" => $check_sum
);
$check_sum_str = constructHttpParameters($check_sum_array);
$resultcode = 0;
$xml_string = "";
$update_data = array();
$log_date = array();
$post_data = array();
$min_factor1=5; //最低积分的倍数;
$min_factor2=10;
$transfer_factor1 = 0; // Not enough, no transfer
$transfer_factor2 = 1; // Very low, send everything that enough for purchase
$transfer_factor3 = 2; // Not enough for 10 purchases, send half of the points
$transfer_factor4 = 10; // Sufficient, send points for 10 purchases.
$exist_card_number = 0;
$post_data['sessionId'] = $sessionId;
$post_data['device_id'] = $device_id;
$post_data['trans_time'] = $trans_time;
$post_data['mpb'] = $min_required_points;
$post_data['user_id'] = "";
$post_data['user_name'] = "";
$post_data['alias'] = "";//urlencode($alias);
$post_data['display_user_points'] = 0;
$post_data['message'] = "";
$post_data['transfer_points'] = 0;
$post_data['user_points'] = 0;
$post_data['fund_status'] = 100; //100 means not enough fund
// Retrieve the jackpot related information and messages
$jackpot_table_name = "jackpot_award";
$jackpot_key = "add_time";
$jackpot_sql_result = selectLastRecord($jackpot_key, $jackpot_table_name);
while($sql_data = mysql_fetch_array($jackpot_sql_result, MYSQL_ASSOC)){
// echo "<p>The sql_result:";
// print_r($sql_data);
$jackpot_amount = $sql_data['jackpot_amount'];
$jackpot_ceiling = $sql_data['jackpot_ceiling'];
$jackpot_preserved = $sql_data['jackpot_preserved'];
$message_front = $sql_data['message_front'];
$message_mid = $sql_data['message_mid'];
$message_end = $sql_data['message_end'];
$message_top = $sql_data['message_top'];
//echo "The messages:".$message_front."-".$message_mid."-".$message_end."-".$message_top;
$jackpot_data['jackpot_amount'] = $jackpot_amount;
$jackpot_data['jackpot_ceiling'] = $jackpot_ceiling;
$jackpot_data['jackpot_preserved'] = $jackpot_preserved;
$jackpot_data['message_front'] = $message_front;
$jackpot_data['message_mid'] = $message_mid;
$jackpot_data['message_end'] = $message_end;
$jackpot_data['message_top'] = $message_top;
$post_data['Jackpot'] = $jackpot_data;
}
mysql_free_result($sql_result);
// echo "<p>The post data:";
// print_r($post_data);
if (checkBcc($check_sum_str, $check_sum)) {
if (!existSessionId($sessionId, $sessionTime)) {
// Retrieve the user information and the points from database
$table_name = "users";
$conditions = "card_number = ".$card_number;
$sql_result = selectConditionalRecords($conditions, $table_name);
while($sql_data = mysql_fetch_array($sql_result, MYSQL_ASSOC)){
// echo "<p>The sql_result:";
// print_r($sql_data);
$exist_card_number++;
$user_id = $sql_data['user_id'];
$user_name = $sql_data['user_name'];
$alias = $sql_data['alias'];
$current_user_points = abs($sql_data['user_points']);
$current_frozen_points = abs($sql_data['frozen_points']);
$post_data['user_id'] = $user_id;
$post_data['user_name'] = $user_name;
$post_data['alias'] = $alias;
$post_data['display_user_points'] = abs(intval($current_user_points));
$usable_points = $current_user_points - $current_frozen_points;
// echo "<p>usable_points:".$usable_points;
switch ($usable_points) {
case ($usable_points < $min_required_points) :
// echo "<p>case: 100";
$post_data['message'] = "剩余积分不足, 请充值后再继续。";
//$usable_points = 0;
$transfer_points = $usable_points * $transfer_factor1;
$user_points = $current_user_points;
$frozen_points = $current_frozen_points + $transfer_points;
$post_data['transfer_points'] = abs(intval($transfer_points));
$post_data['user_points'] = abs(intval($user_points));
$post_data['fund_status'] = 100; //100 means not enough fund
break;
case ($usable_points >= $min_required_points and $usable_points <= $min_required_points*$min_factor1) :
// echo "<p>case: 200";
$post_data['message'] = "剩余积分很低,请速充值。";
$transfer_points = round($usable_points/($min_required_points * $transfer_factor2),0)*$min_required_points;
while ($transfer_points > $usable_points) {
$transfer_points = $transfer_points - $min_required_points;
}
$frozen_points = $current_frozen_points + $transfer_points;
$user_points = $current_user_points - $transfer_points;
// echo "<p> transfer_points:".$transfer_points;
$post_data['frozen_points'] = abs(intval($frozen_points));
$post_data['transfer_points'] = abs(intval($transfer_points));
$post_data['user_points'] = abs(intval($user_points));
$post_data['fund_status'] = 200; //200 means very low fund
break;
case ($usable_points > $min_required_points*$min_factor1 and $usable_points <= $min_required_points*$min_factor2) :
// echo "<p>case: 300";
$post_data['message'] = "剩余积分低,请速充值。";
$transfer_points = round($usable_points /($min_required_points * $transfer_factor3),0)*$min_required_points;
while ($transfer_points > $usable_points) {
$transfer_points = $transfer_points - $min_required_points;
}
$frozen_points = $current_frozen_points + $transfer_points;
$user_points = $current_user_points - $transfer_points;
// echo "<p> transfer_points:".$transfer_points;
$post_data['frozen_points'] = abs(intval($frozen_points));
$post_data['transfer_points'] = abs(intval($transfer_points));
$post_data['user_points'] = abs(intval($user_points));
$post_data['fund_status'] = 300; //300 means low fund
break;
case ($usable_points >= $min_required_points*$min_factor4) :
// echo "<p>case: default";
$post_data['message'] = "感谢参与公益购彩。";
$transfer_points = $min_required_points*$transfer_factor4;
$frozen_points = $current_frozen_points + $transfer_points;
$user_points = $current_user_points - $transfer_points;
// echo "<p> transfer_points:".$transfer_points;
$post_data['frozen_points'] = abs(intval($frozen_points));
$post_data['transfer_points'] = abs(intval($transfer_points));
$post_data['user_points'] = abs(intval($user_points));
$post_data['fund_status'] = 1000; //1000 means sufficient fund
break;
default :
// echo "<p>case: 0";
$post_data['message'] = "无法获取有效积分,请重试。";
$usable_points = 0;
$transfer_points = 0;
$user_points = 0;
$post_data['transfer_points'] = 0;
$post_data['user_points'] = 0;
$post_data['fund_status'] = 0; //0 means not processed
}
}
mysql_free_result($sql_result);
// print_r($post_data);
// Update
if ($exist_card_number > 0) {
$post_data['card_number'] = $card_number;
$user_point_change = - $transfer_points;
$frozen_points_change = $transfer_points;
$change_desc = "可用积分".$usable_points.",向".$device_id."上划拨".$frozen_points."积分,资金状态".$post_data['fund_status'];
log_account_change($user_id, 0, 0, 0, $user_point_change, $frozen_points_change, 0, 0, $change_desc);
$resultcode = 1;
$post_data['status'] = $resultcode;
// Check if there is any voucher need to be printed for this user.
$voucher_table_name = "active_vouchers";
$conditions = "user_id = ".$user_id." AND status = 0";
$voucher_sql_result = selectConditionalRecords($conditions, $voucher_table_name);;
while($sql_data = mysql_fetch_array($voucher_sql_result, MYSQL_ASSOC)){
// echo "<p>The sql_result:";
// print_r($sql_data);
$voucher_id = $sql_data['id'];
$voucher_template_id = $sql_data['voucher_id'];
$qr_message = $sql_data['qr_message'];
$voucher_message = $sql_data['message'];
$voucher_data['voucher_id'] = $voucher_id;
$voucher_data['voucher_template_id'] = $voucher_template_id;
$voucher_data['qr_message'] = $qr_message;
$voucher_data['voucher_message'] = $voucher_message;
$post_data['Coupon'] = $voucher_data;
}
mysql_free_result($sql_result);
} else {
$post_data['card_number'] = -1;
}
$xml_string = getArrayToXML($post_data);
//echo $xml_string;
$dbStatus = setSessionId($sessionId, $sessionTime, $frozen_points, $xml_string);
// echo "<p> The XML_data:".$xml_string;
} else {
$resultcode = 2;//重发
$xml_string = getTransferred($sessionId, $sessionTime);
}
} else {
$resultcode = 0;
}
header("Expires: date('Y-m-d H:i:s')");
echo $xml_string;
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.6.8 0.007 0.047 20.53 5.5.24 0.010 0.057 20.19 5.4.40 0.030 0.037 18.62 5.4.39 0.017 0.053 18.52 5.4.38 0.020 0.053 18.46 5.4.37 0.023 0.070 18.59 5.4.36 0.023 0.067 18.84 5.4.35 0.030 0.063 18.46 5.4.34 0.027 0.047 18.54 5.4.32 0.010 0.060 18.71 5.4.31 0.013 0.067 18.79 5.4.30 0.020 0.050 18.77 5.4.29 0.023 0.047 18.57 5.4.28 0.013 0.060 18.75 5.4.27 0.010 0.060 18.73 5.4.26 0.017 0.050 18.51 5.4.25 0.010 0.060 18.55 5.4.24 0.023 0.060 18.76 5.4.23 0.013 0.057 18.81 5.4.22 0.007 0.063 18.57 5.4.21 0.013 0.060 18.76 5.4.20 0.010 0.057 16.80 5.4.19 0.007 0.060 18.71 5.4.18 0.023 0.047 18.55 5.4.17 0.023 0.047 18.50 5.4.16 0.020 0.053 18.73 5.4.15 0.020 0.070 18.77 5.4.14 0.010 0.053 16.22 5.4.13 0.027 0.063 16.27 5.4.12 0.010 0.080 16.30 5.4.11 0.020 0.070 16.17 5.4.10 0.013 0.080 16.43 5.4.9 0.027 0.057 16.14 5.4.8 0.013 0.057 16.43 5.4.7 0.013 0.053 16.21 5.4.6 0.030 0.057 16.26 5.4.5 0.017 0.067 16.21 5.4.4 0.017 0.050 16.27 5.4.3 0.017 0.050 16.27 5.4.2 0.010 0.057 16.27 5.4.1 0.013 0.060 16.29 5.4.0 0.013 0.073 15.64 5.3.29 0.020 0.050 14.72 5.3.28 0.023 0.070 14.52 5.3.27 0.030 0.050 14.66 5.3.26 0.027 0.050 14.61 5.3.25 0.020 0.053 14.59 5.3.24 0.023 0.047 14.57 5.3.23 0.023 0.047 14.51 5.3.22 0.023 0.043 14.55 5.3.21 0.020 0.057 14.48 5.3.20 0.013 0.053 14.54 5.3.19 0.027 0.050 14.57 5.3.18 0.020 0.047 14.57 5.3.17 0.013 0.050 14.59 5.3.16 0.013 0.050 14.62 5.3.15 0.023 0.070 14.54 5.3.14 0.017 0.077 14.47 5.3.13 0.033 0.063 14.67 5.3.12 0.020 0.073 14.65 5.3.11 0.007 0.060 14.64 5.3.10 0.023 0.060 14.14 5.3.9 0.020 0.047 13.95 5.3.8 0.027 0.063 14.09 5.3.7 0.017 0.057 14.01 5.3.6 0.023 0.043 14.00 5.3.5 0.013 0.060 13.89 5.3.4 0.010 0.053 13.85 5.3.3 0.010 0.053 13.86 5.3.2 0.023 0.040 13.69 5.3.1 0.013 0.050 13.64 5.3.0 0.013 0.053 13.66 5.2.17 0.013 0.043 11.21 5.2.16 0.007 0.043 11.20 5.2.15 0.013 0.040 11.21 5.2.14 0.017 0.043 11.18 5.2.13 0.007 0.043 11.05 5.2.12 0.010 0.037 11.07 5.2.11 0.000 0.050 11.15 5.2.10 0.007 0.043 11.14 5.2.9 0.090 0.040 11.08 5.2.8 0.077 0.040 11.17 5.2.7 0.073 0.043 11.02 5.2.6 0.073 0.050 11.07 5.2.5 0.087 0.043 11.00 5.2.4 0.060 0.040 11.01 5.2.3 0.053 0.047 10.97 5.2.2 0.067 0.033 11.12 5.2.1 0.077 0.040 10.97 5.2.0 0.057 0.043 10.87 5.1.6 0.060 0.040 10.02 5.1.5 0.060 0.037 10.03 5.1.4 0.057 0.043 10.00 5.1.3 0.057 0.040 10.50 5.1.2 0.070 0.023 10.39 5.1.1 0.057 0.033 10.18 5.1.0 0.057 0.037 10.20 5.0.5 0.023 0.037 8.55 5.0.4 0.030 0.030 8.46 5.0.3 0.030 0.043 8.26 5.0.2 0.037 0.020 8.28 5.0.1 0.030 0.037 8.32 5.0.0 0.043 0.037 8.21 4.4.9 0.040 0.013 5.90 4.4.8 0.023 0.027 5.90 4.4.7 0.033 0.023 5.87 4.4.6 0.030 0.023 5.95 4.4.5 0.027 0.023 5.93 4.4.4 0.040 0.040 5.90 4.4.3 0.037 0.027 5.84 4.4.2 0.030 0.027 5.91 4.4.1 0.033 0.027 5.98 4.4.0 0.037 0.030 5.96 4.3.11 0.030 0.023 5.90 4.3.10 0.040 0.013 5.85 4.3.9 0.033 0.027 5.80 4.3.8 0.037 0.043 5.79 4.3.7 0.030 0.020 5.79 4.3.6 0.027 0.023 5.82 4.3.5 0.040 0.023 5.82 4.3.4 0.033 0.037 5.90 4.3.3 0.017 0.023 4.70 4.3.2 0.013 0.023 4.57 4.3.1 0.013 0.023 4.50 4.3.0 0.013 0.023 7.51
preferences:dark mode live preview
152.63 ms | 939 KiB | 8 Q