refac: 전체 penalty는 expire와 value

- 게임 개시시 expire가 되지 않은 것을 기준 value만 전달
- 즉, 페널티는 깃수 단위 적용
This commit is contained in:
2024-02-29 10:27:04 +09:00
parent 6ed3e673df
commit b2b2934ce9
2 changed files with 16 additions and 2 deletions
+8 -1
View File
@@ -37,7 +37,14 @@ if(!$member){
$userNick = $member['name'];
$memberPenalty = Json::decode($member['penalty'] ?? '{}');
$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
$penaltyInfo = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
$penalty = [];
foreach($penaltyInfo as $penaltyKey => $penaltyValue){
if($penaltyValue['expire'] ?? 0 > TimeUtil::now()){
$penalty[$penaltyKey] = $penaltyValue['value'];
}
}
$pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now);
if(!$pickResult){
+8 -1
View File
@@ -153,7 +153,14 @@ class Join extends \sammo\BaseAPI
}
$memberPenalty = Json::decode($member['penalty'] ?? "{}");
$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
$penaltyInfo = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
$penalty = [];
foreach($penaltyInfo as $penaltyKey => $penaltyValue){
if($penaltyValue['expire'] ?? 0 > TimeUtil::now()){
$penalty[$penaltyKey] = $penaltyValue['value'];
}
}
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');