js2ts: betting
This commit is contained in:
+3
-4
@@ -65,7 +65,6 @@ if($str3){
|
|||||||
<title><?=UniqueConst::$serverName?>: 베팅장</title>
|
<title><?=UniqueConst::$serverName?>: 베팅장</title>
|
||||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||||
<?=WebUtil::printJS('js/vendors.js')?>
|
<?=WebUtil::printJS('js/vendors.js')?>
|
||||||
<?=WebUtil::printJS('js/common.js')?>
|
|
||||||
<?=WebUtil::printJS('js/betting.js')?>
|
<?=WebUtil::printJS('js/betting.js')?>
|
||||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||||
@@ -311,7 +310,7 @@ for ($i=0; $i < 16; $i++) {
|
|||||||
else{
|
else{
|
||||||
$gold[$i] = Util::round($myBet[$i] * $bet[$i]);
|
$gold[$i] = Util::round($myBet[$i] * $bet[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -446,8 +445,8 @@ foreach($tournamentType as $tournamentTypeText=>[$statTypeText,$statFunc,$rankCo
|
|||||||
$result = -($lhs->getRankVar($gameColumn) <=> $rhs->getRankVar($gameColumn));
|
$result = -($lhs->getRankVar($gameColumn) <=> $rhs->getRankVar($gameColumn));
|
||||||
if($result !== 0) return $result;
|
if($result !== 0) return $result;
|
||||||
$result = -(
|
$result = -(
|
||||||
($lhs->getRankVar($winColumn)+$lhs->getRankVar($drawColumn)+$lhs->getRankVar($loseColumn))
|
($lhs->getRankVar($winColumn)+$lhs->getRankVar($drawColumn)+$lhs->getRankVar($loseColumn))
|
||||||
<=>
|
<=>
|
||||||
($rhs->getRankVar($winColumn)+$rhs->getRankVar($drawColumn)+$rhs->getRankVar($loseColumn))
|
($rhs->getRankVar($winColumn)+$rhs->getRankVar($drawColumn)+$rhs->getRankVar($loseColumn))
|
||||||
);
|
);
|
||||||
if($result !== 0) return $result;
|
if($result !== 0) return $result;
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import $ from 'jquery';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { setAxiosXMLHttpRequest } from './util/setAxiosXMLHttpRequest';
|
||||||
|
import { InvalidResponse } from './defs';
|
||||||
|
import { convertFormData } from './util/convertFormData';
|
||||||
|
import { unwrap_any } from './util/unwrap_any';
|
||||||
|
|
||||||
|
$(function($){
|
||||||
|
setAxiosXMLHttpRequest();
|
||||||
|
|
||||||
|
$('.submitBtn').on('click', async function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const $this = $(this);
|
||||||
|
const target = parseInt($this.data('target'));
|
||||||
|
const amount = parseInt(unwrap_any<string>($(`#target_${target}`).val()));
|
||||||
|
|
||||||
|
let result: InvalidResponse;
|
||||||
|
|
||||||
|
try{
|
||||||
|
const response = await axios({
|
||||||
|
url: 'j_betting.php',
|
||||||
|
responseType: 'json',
|
||||||
|
method: 'post',
|
||||||
|
data: convertFormData({
|
||||||
|
target: target,
|
||||||
|
amount: amount
|
||||||
|
})
|
||||||
|
});
|
||||||
|
result = response.data;
|
||||||
|
}catch(e){
|
||||||
|
console.error(e);
|
||||||
|
alert(`에러: ${e}`);
|
||||||
|
location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!result.result){
|
||||||
|
alert(`베팅을 실패했습니다: ${result.reason}`);
|
||||||
|
location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
location.reload();
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -20,6 +20,7 @@ module.exports = [
|
|||||||
recent_map: './hwe/ts/recent_map.ts',
|
recent_map: './hwe/ts/recent_map.ts',
|
||||||
processing: './hwe/ts/processing.ts',
|
processing: './hwe/ts/processing.ts',
|
||||||
select_npc: './hwe/ts/select_npc.ts',
|
select_npc: './hwe/ts/select_npc.ts',
|
||||||
|
betting: './hwe/ts/betting.ts',
|
||||||
|
|
||||||
|
|
||||||
//FORM 입력용, frontend 변경후 제거
|
//FORM 입력용, frontend 변경후 제거
|
||||||
|
|||||||
Reference in New Issue
Block a user