misc: 미사용 파일 제거
This commit is contained in:
@@ -91,7 +91,6 @@ return [
|
|||||||
'hwe/j_board_article_add.php',
|
'hwe/j_board_article_add.php',
|
||||||
'hwe/j_board_comment_add.php',
|
'hwe/j_board_comment_add.php',
|
||||||
'hwe/j_board_get_articles.php',
|
'hwe/j_board_get_articles.php',
|
||||||
'hwe/j_chief_turn.php',
|
|
||||||
'hwe/j_die_immediately.php',
|
'hwe/j_die_immediately.php',
|
||||||
'hwe/j_diplomacy_destroy_letter.php',
|
'hwe/j_diplomacy_destroy_letter.php',
|
||||||
'hwe/j_diplomacy_get_letter.php',
|
'hwe/j_diplomacy_get_letter.php',
|
||||||
@@ -102,7 +101,6 @@ return [
|
|||||||
'hwe/j_general_log_old.php',
|
'hwe/j_general_log_old.php',
|
||||||
'hwe/j_general_set_permission.php',
|
'hwe/j_general_set_permission.php',
|
||||||
'hwe/j_get_basic_general_list.php',
|
'hwe/j_get_basic_general_list.php',
|
||||||
'hwe/j_getChiefTurn.php',
|
|
||||||
'hwe/j_get_city_list.php',
|
'hwe/j_get_city_list.php',
|
||||||
'hwe/j_get_general_list.php',
|
'hwe/j_get_general_list.php',
|
||||||
'hwe/j_get_nation_general_list.php',
|
'hwe/j_get_nation_general_list.php',
|
||||||
@@ -126,8 +124,6 @@ return [
|
|||||||
'hwe/j_select_npc.php',
|
'hwe/j_select_npc.php',
|
||||||
'hwe/j_select_picked_general.php',
|
'hwe/j_select_picked_general.php',
|
||||||
'hwe/j_server_basic_info.php',
|
'hwe/j_server_basic_info.php',
|
||||||
'hwe/j_set_chief_command.php',
|
|
||||||
'hwe/j_set_general_command.php',
|
|
||||||
'hwe/j_set_my_setting.php',
|
'hwe/j_set_my_setting.php',
|
||||||
'hwe/j_set_npc_control.php',
|
'hwe/j_set_npc_control.php',
|
||||||
'hwe/j_simulate_battle.php',
|
'hwe/j_simulate_battle.php',
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
|
|
||||||
WebUtil::requireAJAX();
|
|
||||||
//로그인 검사
|
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
|
|
||||||
$turnAmount = Util::getPost('amount', 'int');
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level FROM general WHERE owner=%i', $userID);
|
|
||||||
|
|
||||||
if($me['nation'] == 0){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'국가에 소속되어 있지 않습니다.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($me['officer_level'] < 5){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'수뇌가 아닙니다.',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($turnAmount > 0){
|
|
||||||
pushNationCommand($me['nation'], $me['officer_level']);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
pullNationCommand($me['nation'], $me['officer_level']);
|
|
||||||
}
|
|
||||||
|
|
||||||
Json::die([
|
|
||||||
'result'=>true,
|
|
||||||
'reason'=>'success',
|
|
||||||
]);
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
//로그인 검사
|
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
|
|
||||||
increaseRefresh("사령부", 1);
|
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level,con,turntime,belong,penalty,permission FROM general WHERE owner=%i', $userID);
|
|
||||||
|
|
||||||
$nationLevel = $db->queryFirstField('SELECT level FROM nation WHERE nation = %i', $me['nation']);
|
|
||||||
$nationID = $me['nation'];
|
|
||||||
$con = checkLimit($me['con']);
|
|
||||||
if($con >= 2) {
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>"접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다. (다음 접속 가능 시각 : {$me['turntime']})"
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$permission = checkSecretPermission($me);
|
|
||||||
if($permission < 0){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'국가에 소속되어있지 않습니다.'
|
|
||||||
]);
|
|
||||||
echo '국가에 소속되어있지 않습니다.';
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
else if ($permission < 1) {
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'수뇌부가 아니거나 사관년도가 부족합니다.'
|
|
||||||
]);
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
$date = TimeUtil::now();
|
|
||||||
|
|
||||||
// 명령 목록
|
|
||||||
[$year, $month, $turnterm] = $gameStor->getValuesAsArray(['year', 'month', 'turnterm']);
|
|
||||||
$lv = getNationChiefLevel($nationLevel);
|
|
||||||
$turn = [];
|
|
||||||
|
|
||||||
$generals = [];
|
|
||||||
foreach($db->query('SELECT no,name,turntime,npc,city,nation,officer_level FROM general WHERE nation = %i AND officer_level >= 5',$nationID) as $rawGeneral){
|
|
||||||
$generals[$rawGeneral['officer_level']] = new General($rawGeneral, null, null, null, $year, $month, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$nationTurnList = [];
|
|
||||||
|
|
||||||
foreach(
|
|
||||||
$db->queryAllLists(
|
|
||||||
'SELECT officer_level, turn_idx, action, arg, brief FROM nation_turn WHERE nation_id = %i ORDER BY officer_level DESC, turn_idx ASC',
|
|
||||||
$me['nation']
|
|
||||||
) as [$officer_level, $turn_idx, $action, $arg, $brief]
|
|
||||||
){
|
|
||||||
if(!key_exists($officer_level, $nationTurnList)){
|
|
||||||
$nationTurnList[$officer_level] = [];
|
|
||||||
}
|
|
||||||
$nationTurnList[$officer_level][$turn_idx] = $brief;
|
|
||||||
}
|
|
||||||
|
|
||||||
$nationTurnBrief = [];
|
|
||||||
foreach($nationTurnList as $officer_level=>$turnBrief){
|
|
||||||
if(!key_exists($officer_level, $generals)){
|
|
||||||
$nationTurnBrief[$officer_level] = [
|
|
||||||
'name'=>null,
|
|
||||||
'turnTime'=>null,
|
|
||||||
'officerLevelText'=>getOfficerLevelText($officer_level, $nationLevel),
|
|
||||||
'npcType'=>null,
|
|
||||||
'turn'=>$turnBrief
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$general = $generals[$officer_level];
|
|
||||||
$nationTurnBrief[$officer_level] = [
|
|
||||||
'name'=>$general->getName(),
|
|
||||||
'turnTime'=>$general->getTurnTime($general::TURNTIME_FULL),
|
|
||||||
'officerLevel'=>$general->getVar('officer_level'),
|
|
||||||
'officerLevelText'=>getOfficerLevelText($general->getVar('officer_level'), $nationLevel),
|
|
||||||
'npcType'=>$general->getNPCType(),
|
|
||||||
'turn'=>$turnBrief,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$date = substr(TimeUtil::now(), 14);
|
|
||||||
|
|
||||||
Json::die([
|
|
||||||
'result'=>true,
|
|
||||||
'reason'=>'success',
|
|
||||||
'date'=>$date,
|
|
||||||
'nationTurnBrief'=>$nationTurnBrief,
|
|
||||||
'isChief'=>($me['officer_level'] > 4),
|
|
||||||
'officerLevel'=>$me['officer_level'],
|
|
||||||
'turnTerm'=>$turnterm
|
|
||||||
]);
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
|
|
||||||
WebUtil::requireAJAX();
|
|
||||||
|
|
||||||
$session = Session::requireGameLogin([])->setReadOnly();
|
|
||||||
|
|
||||||
increaseRefresh("사령턴 입력", 0);
|
|
||||||
|
|
||||||
$generalID = $session->generalID;
|
|
||||||
|
|
||||||
|
|
||||||
$action = Util::getPost('action', 'string');
|
|
||||||
$arg = Json::decode(Util::getPost('arg', 'string'));
|
|
||||||
$turnList = Util::getPost('turnList', 'array_int');
|
|
||||||
|
|
||||||
if(!is_array($turnList) || !$turnList){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'턴이 입력되지 않았습니다.',
|
|
||||||
'test'=>'post',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$action){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'action이 입력되지 않았습니다.',
|
|
||||||
'test'=>'post'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!in_array($action, Util::array_flatten(GameConst::$availableChiefCommand))){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'사용할 수 없는 커맨드입니다.',
|
|
||||||
'test'=>'post'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($arg === null){
|
|
||||||
$arg = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!is_array($arg)){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'올바른 arg 형태가 아닙니다.',
|
|
||||||
'test'=>'post'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = setNationCommand($generalID, $turnList, $action, $arg);
|
|
||||||
if(!key_exists('result', $result)){
|
|
||||||
$result['result'] = false;
|
|
||||||
}
|
|
||||||
if(!key_exists('arg_test', $result)){
|
|
||||||
$result['arg_test'] = false;
|
|
||||||
}
|
|
||||||
if(!key_exists('reason', $result)){
|
|
||||||
throw new MustNotBeReachedException('reason이 왜 없어?');
|
|
||||||
}
|
|
||||||
Json::die($result);
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
|
|
||||||
WebUtil::requireAJAX();
|
|
||||||
|
|
||||||
$session = Session::requireGameLogin([])->setReadOnly();
|
|
||||||
|
|
||||||
increaseRefresh("턴 입력", 0);
|
|
||||||
|
|
||||||
$generalID = $session->generalID;
|
|
||||||
|
|
||||||
$action = Util::getPost('action', 'string');
|
|
||||||
$arg = Json::decode(Util::getPost('arg', 'string'));
|
|
||||||
$turnList = Util::getPost('turnList', 'array_int');
|
|
||||||
|
|
||||||
if(!is_array($turnList) || !$turnList){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'턴이 입력되지 않았습니다.',
|
|
||||||
'test'=>'post',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$action){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'action이 입력되지 않았습니다.',
|
|
||||||
'test'=>'post'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!in_array($action, Util::array_flatten(GameConst::$availableGeneralCommand))){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'사용할 수 없는 커맨드입니다.',
|
|
||||||
'test'=>'post'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($arg === null){
|
|
||||||
$arg = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!is_array($arg)){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'올바른 arg 형태가 아닙니다.',
|
|
||||||
'test'=>'post'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Json::die(setGeneralCommand($generalID, $turnList, $action, $arg));
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ingame": {
|
"ingame": {
|
||||||
"chiefCenter": "chiefCenter.ts",
|
|
||||||
"troop": "troop.ts",
|
"troop": "troop.ts",
|
||||||
"map": "map.ts",
|
"map": "map.ts",
|
||||||
"install_db": "install_db.ts",
|
"install_db": "install_db.ts",
|
||||||
|
|||||||
@@ -1,264 +0,0 @@
|
|||||||
import axios from 'axios';
|
|
||||||
import $ from 'jquery';
|
|
||||||
import { range } from 'lodash';
|
|
||||||
import { addMinutes } from 'date-fns';
|
|
||||||
import { errUnknown, getNpcColor } from '@/common_legacy';
|
|
||||||
import { InvalidResponse } from '@/defs';
|
|
||||||
import { unwrap } from "@util/unwrap";
|
|
||||||
import { convertFormData } from '@util/convertFormData';
|
|
||||||
import { unwrap_any } from "@util/unwrap_any";
|
|
||||||
import { parseTime } from '@util/parseTime';
|
|
||||||
import { formatTime } from '@util/formatTime';
|
|
||||||
import { stringifyUrl } from 'query-string';
|
|
||||||
import { setAxiosXMLHttpRequest } from '@util/setAxiosXMLHttpRequest';
|
|
||||||
|
|
||||||
setAxiosXMLHttpRequest();
|
|
||||||
|
|
||||||
declare const maxChiefTurn: number;
|
|
||||||
|
|
||||||
type TurnDOMObj = {
|
|
||||||
turnTime: JQuery<HTMLElement>,
|
|
||||||
turnPad: JQuery<HTMLElement>,
|
|
||||||
turnText: JQuery<HTMLElement>
|
|
||||||
};
|
|
||||||
|
|
||||||
type TableObj = {
|
|
||||||
btns: JQuery<HTMLElement>;
|
|
||||||
[key: number]: {
|
|
||||||
officerLevelText: JQuery<HTMLElement>,
|
|
||||||
name: JQuery<HTMLElement>,
|
|
||||||
turn: TurnDOMObj[],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type ChiefResponse = InvalidResponse | {
|
|
||||||
result: true,
|
|
||||||
date: string,
|
|
||||||
nationTurnBrief: {
|
|
||||||
name: string | null,
|
|
||||||
turnTime: string | null,
|
|
||||||
officerLevelText: string,
|
|
||||||
npcType: number,
|
|
||||||
turn: string
|
|
||||||
}[],
|
|
||||||
isChief: boolean,
|
|
||||||
turnTerm: number
|
|
||||||
}
|
|
||||||
|
|
||||||
let filledChiefList: Record<number, boolean> = {};
|
|
||||||
let chiefTableObj: TableObj = undefined as unknown as TableObj;//TODO: 매우 지저분하다. class 기반으로 고치던가 할 것
|
|
||||||
|
|
||||||
/*
|
|
||||||
function clearTable() {
|
|
||||||
$('.chiefLevelText').html('-');
|
|
||||||
$('.chiefTurnTime, .chiefTurnText, .chiefName').html(' ');
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function genChiefTableObj(): TableObj {
|
|
||||||
const objTable: TableObj = {
|
|
||||||
btns: $('#turnPush,#turnPull,#setCommand')
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const chiefIdx of range(5, 13)) {
|
|
||||||
const $plate = $(`#chief_${chiefIdx}`);
|
|
||||||
const $officerLevelText = $plate.find('.chiefLevelText');
|
|
||||||
const $name = $plate.find('.chiefName');
|
|
||||||
const turn: TurnDOMObj[] = [];
|
|
||||||
for (const turnIdx of range(maxChiefTurn)) {
|
|
||||||
const $turn = $plate.find(`.turn${turnIdx}`);
|
|
||||||
const $turnTime = $turn.find('.chiefTurnTime');
|
|
||||||
const $turnPad = $turn.find('.chiefTurnPad');
|
|
||||||
const $turnText = $turn.find('.chiefTurnText');
|
|
||||||
turn.push({ turnTime: $turnTime, turnPad: $turnPad, turnText: $turnText });
|
|
||||||
}
|
|
||||||
objTable[chiefIdx] = {
|
|
||||||
officerLevelText: $officerLevelText,
|
|
||||||
name: $name,
|
|
||||||
turn: turn
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return objTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function clearChief(chiefIdx: number): void {
|
|
||||||
const $plate = $(`#chief_${chiefIdx}`);
|
|
||||||
$plate.find('.chiefLevelText').html('-');
|
|
||||||
$plate.find('.chiefTurnTime, .chiefTurnText, .chiefName').html(' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function reloadTable() {
|
|
||||||
|
|
||||||
const data: ChiefResponse = await (async () => {
|
|
||||||
try {
|
|
||||||
const response = await axios({
|
|
||||||
url: 'j_getChiefTurn.php',
|
|
||||||
responseType: 'json'
|
|
||||||
});
|
|
||||||
return response.data;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
errUnknown();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
if (!data.result) {
|
|
||||||
alert(data.reason);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const turnTerm = data.turnTerm;
|
|
||||||
const tmpFilledChiefList: Record<number, boolean> = {};
|
|
||||||
|
|
||||||
if (data.isChief) {
|
|
||||||
chiefTableObj.btns.css('visibility', 'visible');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
chiefTableObj.btns.css('visibility', 'hidden');
|
|
||||||
}
|
|
||||||
$.each(data.nationTurnBrief, function (chiefIdx, chiefInfo) {
|
|
||||||
tmpFilledChiefList[chiefIdx] = true;
|
|
||||||
filledChiefList[chiefIdx] = true;
|
|
||||||
|
|
||||||
const plateObj = chiefTableObj[chiefIdx];
|
|
||||||
if (chiefInfo.name) {
|
|
||||||
const $name = $(`<span>${chiefInfo.name}</span>`);
|
|
||||||
const nameColor = getNpcColor(chiefInfo.npcType);
|
|
||||||
if (nameColor) {
|
|
||||||
$name.css('color', nameColor);
|
|
||||||
}
|
|
||||||
plateObj.name.empty().append($name);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
plateObj.name.html('');
|
|
||||||
}
|
|
||||||
|
|
||||||
plateObj.officerLevelText.text(chiefInfo.officerLevelText);
|
|
||||||
|
|
||||||
let turnTimeObj: Date | undefined;
|
|
||||||
|
|
||||||
if (chiefInfo.turnTime) {
|
|
||||||
turnTimeObj = parseTime(chiefInfo.turnTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
const turnList = plateObj.turn;
|
|
||||||
$.each(chiefInfo.turn, function (turnIdx, turnText) {
|
|
||||||
if (turnTimeObj) {
|
|
||||||
turnList[turnIdx].turnTime.text(formatTime(turnTimeObj, 'HH:mm'));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
turnList[turnIdx].turnTime.text('');
|
|
||||||
}
|
|
||||||
|
|
||||||
turnList[turnIdx].turnText.html(turnText).css('font-size', '14px');
|
|
||||||
const oWidth = unwrap(turnList[turnIdx].turnPad.innerWidth());
|
|
||||||
const iWidth = unwrap(turnList[turnIdx].turnText.outerWidth());
|
|
||||||
if (iWidth > oWidth * 0.95) {
|
|
||||||
const newFontSize = 14 * oWidth / iWidth * 0.9;
|
|
||||||
turnList[turnIdx].turnText.css('font-size', `${newFontSize}px`);
|
|
||||||
}
|
|
||||||
if (turnTimeObj) {
|
|
||||||
turnTimeObj = addMinutes(turnTimeObj, turnTerm);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const idx of range(5, 13)) {
|
|
||||||
if (idx in tmpFilledChiefList) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (idx in filledChiefList) {
|
|
||||||
clearChief(idx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filledChiefList = tmpFilledChiefList;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function reserveTurn(turnList: number[], command: string) {
|
|
||||||
console.log(turnList, command);
|
|
||||||
try {
|
|
||||||
|
|
||||||
const response = await axios({
|
|
||||||
url: 'j_set_chief_command.php',
|
|
||||||
responseType: 'json',
|
|
||||||
method: 'post',
|
|
||||||
data: convertFormData({
|
|
||||||
turnList,
|
|
||||||
action: command
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
const data: InvalidResponse = response.data;
|
|
||||||
|
|
||||||
if (!data.result) {
|
|
||||||
alert(data.reason);
|
|
||||||
}
|
|
||||||
await reloadTable();
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
errUnknown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function pushTurn(turnCnt: number) {
|
|
||||||
try {
|
|
||||||
const response = await axios({
|
|
||||||
url: 'j_chief_turn.php',
|
|
||||||
responseType: 'json',
|
|
||||||
method: 'post',
|
|
||||||
data: convertFormData({
|
|
||||||
amount: turnCnt
|
|
||||||
})
|
|
||||||
});
|
|
||||||
const data = response.data;
|
|
||||||
if (!data.result) {
|
|
||||||
alert(data.reason);
|
|
||||||
}
|
|
||||||
await reloadTable();
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
errUnknown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$(function ($) {
|
|
||||||
|
|
||||||
chiefTableObj = genChiefTableObj();
|
|
||||||
void reloadTable();
|
|
||||||
$('#reloadTable').on('click', reloadTable);
|
|
||||||
$('#setCommand').on('click', function () {
|
|
||||||
const turnList = unwrap_any<string[]>($('#chiefTurnSelector').val()).map(function (v) { return parseInt(v); });
|
|
||||||
const $command = $('#chiefCommandList option:selected');
|
|
||||||
if ($command.data('reqarg')) {
|
|
||||||
document.location.href = stringifyUrl({
|
|
||||||
url: 'v_processing.php',
|
|
||||||
query: {
|
|
||||||
command: unwrap_any<string>($command.val()),
|
|
||||||
turnList: turnList.join('_'),
|
|
||||||
is_chief: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
void reserveTurn(turnList, unwrap_any<string>($command.val()));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#turnPush').on('click', function () {
|
|
||||||
void pushTurn(1);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#turnPull').on('click', function () {
|
|
||||||
void pushTurn(-1);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
})
|
|
||||||
Reference in New Issue
Block a user