mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
add function of deleting players
This commit is contained in:
parent
0e155a0f5c
commit
04c475746b
@ -204,6 +204,9 @@ class AdminController extends BaseController
|
|||||||
if ($player->setOwner($_POST['uid']))
|
if ($player->setOwner($_POST['uid']))
|
||||||
View::json('角色 '.$player->player_name.' 已成功让渡至 '.$user->getNickName(), 0);
|
View::json('角色 '.$player->player_name.' 已成功让渡至 '.$user->getNickName(), 0);
|
||||||
|
|
||||||
|
} elseif ($action == "delete") {
|
||||||
|
if (PlayerModel::where('pid', $_POST['pid'])->delete())
|
||||||
|
View::json('角色已被成功删除', 0);
|
||||||
} else {
|
} else {
|
||||||
throw new E('Illegal parameters', 1);
|
throw new E('Illegal parameters', 1);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: printempw
|
* @Author: printempw
|
||||||
* @Date: 2016-07-22 14:02:44
|
* @Date: 2016-07-22 14:02:44
|
||||||
* @Last Modified by: printempw
|
* @Last Modified by: printempw
|
||||||
* @Last Modified time: 2016-07-23 15:22:01
|
* @Last Modified time: 2016-07-23 21:12:23
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -265,3 +265,23 @@ function changeOwner(pid) {
|
|||||||
error: showAjaxError
|
error: showAjaxError
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deletePlayer(pid) {
|
||||||
|
if (!window.confirm('真的要删除此角色吗?此操作不可恢复')) return;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "../admin/players?action=delete",
|
||||||
|
dataType: "json",
|
||||||
|
data: { 'pid': pid },
|
||||||
|
success: function(json) {
|
||||||
|
if (json.errno == 0) {
|
||||||
|
$('tr#'+pid).remove();
|
||||||
|
toastr.success(json.msg);
|
||||||
|
} else {
|
||||||
|
toastr.warning(json.msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: showAjaxError
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -51,8 +51,8 @@
|
|||||||
<td id="player-name">{{ $player->player_name }}</td>
|
<td id="player-name">{{ $player->player_name }}</td>
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" id="preference">
|
<select class="form-control" id="preference">
|
||||||
<option {{ ($player->preference == "default") ? 'selected="selected"' : '' }} value="default">Default</option>
|
<option {{ ($player->preference == "default") ? 'selected=selected' : '' }} value="default">Default</option>
|
||||||
<option {{ ($player->preference == "slim") ? 'selected="selected"' : '' }} value="slim">Slim</option>
|
<option {{ ($player->preference == "slim") ? 'selected=selected' : '' }} value="slim">Slim</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
Loading…
Reference in New Issue
Block a user