1
This commit is contained in:
parent
6c61a74932
commit
f877f70e65
@ -30,18 +30,7 @@ class HangController{
|
|||||||
array(
|
array(
|
||||||
':accountid' => $account_id
|
':accountid' => $account_id
|
||||||
));
|
));
|
||||||
if (!$row) {
|
if ($row) {
|
||||||
$ret = $conn->execScript('INSERT INTO hang(accountid, hang_time) ' .
|
|
||||||
' VALUES(:accountid, :hang_time);',
|
|
||||||
array(
|
|
||||||
':accountid' => $account_id,
|
|
||||||
':hang_time' => time()
|
|
||||||
));
|
|
||||||
if (!$ret) {
|
|
||||||
die();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$ret = $conn->execScript('UPDATE hang SET hang_time=:hang_time ' .
|
$ret = $conn->execScript('UPDATE hang SET hang_time=:hang_time ' .
|
||||||
' WHERE accountid=:accountid;',
|
' WHERE accountid=:accountid;',
|
||||||
array(
|
array(
|
||||||
@ -52,7 +41,7 @@ class HangController{
|
|||||||
die();
|
die();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$item_id = 1;
|
$item_id = 10001;
|
||||||
$num = time() - $row['hang_time'];
|
$num = time() - $row['hang_time'];
|
||||||
if ($num >= 4 * 3600) {
|
if ($num >= 4 * 3600) {
|
||||||
$num = 4 * 3600;
|
$num = 4 * 3600;
|
||||||
@ -84,10 +73,31 @@ class HangController{
|
|||||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$num = 0;
|
||||||
|
$row = $conn->execQueryOne('SELECT * FROM hang WHERE accountid=:accountid;',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id
|
||||||
|
));
|
||||||
|
if (!$row) {
|
||||||
|
$ret = $conn->execScript('INSERT INTO hang(accountid, hang_time) ' .
|
||||||
|
' VALUES(:accountid, :hang_time);',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id,
|
||||||
|
':hang_time' => time()
|
||||||
|
));
|
||||||
|
if (!$ret) {
|
||||||
|
die();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$num = time() - $row['hang_time'];
|
||||||
|
}
|
||||||
|
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'errcode' => 0,
|
'errcode' => 0,
|
||||||
'errmsg' => '',
|
'errmsg' => '',
|
||||||
'time' => time()
|
'time' => time(),
|
||||||
|
'num' => $num
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user