feat: 베팅시 유산포인트 로그에 추가
This commit is contained in:
@@ -10,10 +10,9 @@ use sammo\DTO\BettingItem;
|
||||
use sammo\Validator;
|
||||
use sammo\GameConst;
|
||||
use sammo\KVStorage;
|
||||
use sammo\UserLogger;
|
||||
use sammo\Util;
|
||||
|
||||
use function sammo\getAllNationStaticInfo;
|
||||
|
||||
class Bet extends \sammo\BaseAPI
|
||||
{
|
||||
public function validateArgs(): ?string
|
||||
@@ -91,8 +90,7 @@ class Bet extends \sammo\BaseAPI
|
||||
if ($remainPoint < $amount) {
|
||||
return '유산포인트가 충분하지 않습니다.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$remainPoint = $db->queryFirstField('SELECT gold FROM general WHERE no = %i', $session->generalID) ?? 0;
|
||||
if ($remainPoint < GameConst::$generalMinimumGold + $amount) {
|
||||
return '금이 부족합니다.';
|
||||
@@ -113,10 +111,13 @@ class Bet extends \sammo\BaseAPI
|
||||
'ng_betting',
|
||||
$bettingItem->toArray(),
|
||||
['amount' => $db->sqleval('amount + %i', $amount)]
|
||||
); if($bettingInfo->reqInheritancePoint){
|
||||
);
|
||||
if ($bettingInfo->reqInheritancePoint) {
|
||||
$inheritStor->setValue('previous', [$remainPoint - $amount, null]);
|
||||
}
|
||||
else{
|
||||
$userLogger = new UserLogger($userID);
|
||||
$userLogger->push("{$amount} 포인트를 베팅에 사용", "inheritPoint");
|
||||
$userLogger->flush();
|
||||
} else {
|
||||
$db->update('general', [
|
||||
'gold' => $db->sqleval('gold - %i', $amount)
|
||||
], 'no = %i', $session->generalID);
|
||||
|
||||
@@ -78,8 +78,10 @@
|
||||
<div class="col-2 text-end">{{ amount.toLocaleString() }}</div>
|
||||
<div
|
||||
class="col-3 text-center"
|
||||
>{{ myBettings.has(betType) ? `(${myBettings.get(betType)?.toLocaleString()} -> ${((myBettings.get(betType)??0) * bettingAmount / amount).toLocaleString()})` : '' }}</div>
|
||||
<div class="col-2 text-end">{{ (bettingAmount / amount).toFixed(1) }}배</div>
|
||||
>{{ myBettings.has(betType) ? `(${myBettings.get(betType)?.toLocaleString()} -> ${((myBettings.get(betType) ?? 0) * bettingAmount / amount / ((info.isExclusive && info.selectCnt > 1) ? 1 : 2)).toLocaleString()})` : '' }}</div>
|
||||
<div
|
||||
class="col-2 text-end"
|
||||
>{{ (bettingAmount / amount / ((info.isExclusive && info.selectCnt > 1) ? 1 : 2)).toFixed(1) }}배</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -130,10 +132,12 @@ type BettingInfo = {
|
||||
name: string;
|
||||
finished: boolean;
|
||||
selectCnt: number;
|
||||
isExclusive?: boolean;
|
||||
reqInheritancePoint: boolean;
|
||||
openYearMonth: number;
|
||||
closeYearMonth: number;
|
||||
candidates: SelectItem[];
|
||||
winner?: number[];
|
||||
}
|
||||
|
||||
type BettingListResponse = ValidResponse & {
|
||||
|
||||
Reference in New Issue
Block a user