Game impl update
This commit is contained in:
parent
340660d1d0
commit
9f6a68d526
|
|
@ -238,6 +238,34 @@ namespace Alphaland\Games {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function RemovePersonalBuildServerRank(int $placeid, int $userid)
|
||||||
|
{
|
||||||
|
$remove = $GLOBALS['pdo']->prepare("DELETE FROM personal_build_ranks WHERE placeid = :pid AND userid = :uid");
|
||||||
|
$remove->bindParam(":pid", $placeid, PDO::PARAM_INT);
|
||||||
|
$remove->bindParam(":uid", $userid, PDO::PARAM_INT);
|
||||||
|
$remove->execute();
|
||||||
|
if ($remove->rowCount() > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetPersonalBuildServerRank(int $placeid, int $userid)
|
||||||
|
{
|
||||||
|
if ($userid == Asset::GetAssetInfo($placeid)->CreatorId) {
|
||||||
|
return 255;
|
||||||
|
} else {
|
||||||
|
$rank = $GLOBALS['pdo']->prepare("SELECT * FROM personal_build_ranks WHERE placeid = :pid AND userid = :uid");
|
||||||
|
$rank->bindParam(":pid", $placeid, PDO::PARAM_INT);
|
||||||
|
$rank->bindParam(":uid", $userid, PDO::PARAM_INT);
|
||||||
|
$rank->execute();
|
||||||
|
if ($rank->rowCount() > 0) {
|
||||||
|
return $rank->fetch(PDO::FETCH_OBJ)->rank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 10; //no rank. consider them Visitor rank
|
||||||
|
}
|
||||||
|
|
||||||
public static function PersonalBuildRankToName($rank)
|
public static function PersonalBuildRankToName($rank)
|
||||||
{
|
{
|
||||||
switch ($rank)
|
switch ($rank)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ Alphaland 2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//headers
|
//headers
|
||||||
|
|
||||||
|
use Alphaland\Games\Game;
|
||||||
|
|
||||||
header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||||
|
|
||||||
header("access-control-allow-credentials: true");
|
header("access-control-allow-credentials: true");
|
||||||
|
|
@ -21,7 +24,7 @@ $userid = $_GET['userId'];
|
||||||
|
|
||||||
$userInfo = array(
|
$userInfo = array(
|
||||||
"data" => array(
|
"data" => array(
|
||||||
"Rank" => getBuildServerRank($placeid, $userid),
|
"Rank" => Game::GetPersonalBuildServerRank($placeid, $userid),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,10 @@ else
|
||||||
else if ($removeuser)
|
else if ($removeuser)
|
||||||
{
|
{
|
||||||
$userid = $data->userid;
|
$userid = $data->userid;
|
||||||
$message = removePBSUser($assetid, $userid);
|
$message = null;
|
||||||
|
if (Game::RemovePersonalBuildServerRank($assetid, $userid)) {
|
||||||
|
$message = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ($whitelistuser)
|
else if ($whitelistuser)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue