#297 change character account
This commit is contained in:
parent
ebdb73ab8b
commit
c6d1467cf3
@ -109,6 +109,29 @@ function init_saimod_mojotrollz_server_tbc_character_show(){
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
$('#btn_chg_account').click(function(){
|
||||
var guid = $(this).attr('guid');
|
||||
var accountname = $('#input_account').val();
|
||||
$.ajax({ type :'GET',
|
||||
url : './sai.php',
|
||||
data : { sai_mod: '.SAI.saimod_mojotrollz_server_tbc',
|
||||
action: 'change_account',
|
||||
guid: guid,
|
||||
accountname: accountname},
|
||||
success : function(data) {
|
||||
if(data.status){
|
||||
alert('ok');
|
||||
system.reload();
|
||||
} else {
|
||||
alert('Fail: '+data.result.message);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function init_saimod_mojotrollz_server_tbc_control(){
|
||||
|
||||
@ -106,6 +106,16 @@ class saimod_mojotrollz_server_tbc extends \SYSTEM\SAI\SaiModule {
|
||||
return \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/tpl/character_show.tpl',$vars);
|
||||
}
|
||||
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_server_tbc_action_change_account($guid, $accountname){
|
||||
$account = \SQL\TBC_ACCOUNT_NAME::Q1(array($accountname));
|
||||
if(!$account){
|
||||
throw new \SYSTEM\LOG\ERROR('Account not found.');}
|
||||
if($account['char_count'] >= 10){
|
||||
throw new \SYSTEM\LOG\ERROR('Account has to many Characters.');}
|
||||
\SQL\TBC_CHARACTER_CHANGE_ACCOUNT::QI(array($account['id'],$guid));
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_server_tbc_action_bot_toggle($account, $guid, $server, $status){
|
||||
if($status == 0){
|
||||
\SQL\TBC_CHARACTER_BOT::QI(array($account,$guid,$server));
|
||||
|
||||
@ -15,4 +15,6 @@ REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `na
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5660, 42, 3, 5600, 'character', 'search', 'STRING');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5661, 42, 3, 5600, 'character', 'page', 'UINT0');
|
||||
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5670, 42, 2, 5600, 'character_show', 'guid', 'UINT0');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5670, 42, 2, 5600, 'character_show', 'guid', 'UINT0');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5671, 42, 2, 5600, 'change_account', 'guid', 'UINT0');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5672, 42, 2, 5600, 'change_account', 'accountname', 'STRING');
|
||||
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class TBC_ACCOUNT_NAME extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT accounts.id, COUNT(chars.guid) as char_count'.
|
||||
' FROM mangos_one_realm.account as accounts'.
|
||||
' LEFT JOIN mangos_one_chars.characters as chars ON accounts.id = chars.account'.
|
||||
' WHERE accounts.username = ?'.
|
||||
' LIMIT 1;';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class TBC_CHARACTER_CHANGE_ACCOUNT extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'UPDATE mangos_one_chars.characters SET account = ? WHERE guid = ?';
|
||||
}
|
||||
}
|
||||
@ -37,7 +37,18 @@
|
||||
<tr>
|
||||
<th>System Account</th>
|
||||
<td><a href="#!security(user);username.${system_account}">${system_account}</a></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Move Character</th>
|
||||
<td>
|
||||
<input class="input-medium action-control" id="input_account" type="text" placeholder="Accountname" size="20"/>
|
||||
<button guid="${guid}" class="btn-sm btn btn-success" id="btn_chg_account" type="submit" style="margin-left: 10px;"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Change</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button class="btn-sm btn btn-success" id="btn_back" onclick="system.back()"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> Back</button>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user