0, 'errmsg' => '', 'payable' => 1 )); die(); }*/ //error_log(json_encode($_REQUEST)); $payable = 0; /* 1:玩家进入第一天,战斗7次,开放充值(除北上广深成)。 2:玩家进入第二天,战斗7次,已充值玩家战斗2次(除北上广深成)。 3:玩家进入第三天,战斗7次,已充值玩家战斗2次。 */ if (phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) { $recharge_times = 0; $conn = $this->getMysql($_REQUEST['account_id']); $row = $conn->execQueryOne('SELECT recharge_times_total FROM user WHERE accountid=:accountid;', array( ':accountid' => $_REQUEST['account_id'] )); if ($row) { $recharge_times = $row['recharge_times_total']; } $register_time = phpcommon\extractRegisterTimeFromSessionId($_REQUEST['session_id']); $nowtime = phpcommon\getNowTime(); $register_time = phpcommon\getdayseconds($register_time); $nowtime = phpcommon\getdayseconds($nowtime); if ($nowtime - $register_time > 3600 * 24 * 2) { //第三天 if ($_REQUEST['battle_times'] >= 2) { $payable = 1; } else if ($recharge_times > 0 && $_REQUEST['battle_times'] >= 1) { $payable = 1; } } else if ($nowtime - $register_time > 3600 * 24 * 1) { //第二天 if ($this->isForbidCity()) { } else { if ($_REQUEST['battle_times'] >= 2) { $payable = 1; } else if ($recharge_times > 0 && $_REQUEST['battle_times'] >= 2) { $payable = 1; } } } else { //第一天 if ($this->isForbidCity()) { } else if ($_REQUEST['battle_times'] >= 3) { $payable = 1; } } } echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'payable' => $payable )); } }