game2001api/webapp/controller/ServerSwitchController.class.php
aozhiwei 52b14c0152 1
2019-08-26 23:10:28 +08:00

69 lines
2.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
class ServerSwitchController {
private function isForbidCity()
{
if (in_array(strtolower($_REQUEST['province']),
array(
strtolower('Shanghai'),
strtolower('Beijing'),
'上海',
'北京'
)) ||
in_array(strtolower($_REQUEST['city']),
array(
strtolower('Guangzhou'),
strtolower('Shenzhen'),
strtolower('Chengdu'),
'广州',
'深圳',
'成都'
))
) {
return true;
}
return false;
}
public function getSwitch()
{
/*if (SERVER_ENV != _ONLINE) {
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'payable' => 1
));
die();
}*/
$payable = 0;
/*
玩家第一天不开放
玩家进来第二天玩了7-8次战斗后开放非北上广并且每天重置战斗次数
北上广第三天开放
*/
if (phpcommon\isValidSessionId($_REQUEST['account_id'],
$_REQUEST['session_id'])) {
$register_time = phpcommon\extractRegisterTimeFromSessionId($_REQUEST['session_id']);
$nowtime = time();
if ($nowtime - $register_time > 3600 * 24) {
if ($this->isForbidCity() && $nowtime - $register_time > 3600 * 24 * 2) {
if ($_REQUEST['battle_times'] >= 8) {
$payable = 1;
}
} else {
if ($_REQUEST['battle_times'] >= 8) {
$payable = 1;
}
}
}
}
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'payable' => $payable
));
}
}