add management page of players
This commit is contained in:
parent
e550add61a
commit
c978ce5594
|
|
@ -4,8 +4,10 @@ namespace App\Controllers;
|
|||
|
||||
use App\Models\User;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\Player;
|
||||
use App\Models\PlayerModel;
|
||||
use App\Models\Texture;
|
||||
use App\Exceptions\E;
|
||||
use Option;
|
||||
use Utils;
|
||||
use View;
|
||||
|
||||
|
|
@ -14,10 +16,83 @@ class AdminController extends BaseController
|
|||
|
||||
public function index()
|
||||
{
|
||||
echo View::make('admin.index')->render();
|
||||
View::show('admin.index');
|
||||
}
|
||||
|
||||
public function ajaxHandler()
|
||||
public function customize()
|
||||
{
|
||||
View::show('admin.customize');
|
||||
}
|
||||
|
||||
public function options()
|
||||
{
|
||||
View::show('admin.options');
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
|
||||
$filter = isset($_GET['filter']) ? $_GET['filter'] : "";
|
||||
|
||||
$q = isset($_GET['q']) ? $_GET['q'] : "";
|
||||
|
||||
if ($filter == "") {
|
||||
$users = UserModel::orderBy('uid');
|
||||
$total_pages = ceil($users->count() / 30);
|
||||
$users = $users->skip(($page - 1) * 30)->take(30)->get();
|
||||
} else if ($filter == "email") {
|
||||
$users = UserModel::like('email', $q)->orderBy('uid');
|
||||
$total_pages = ceil($users->count() / 30);
|
||||
$users = $users->skip(($page - 1) * 30)->take(30)->get();
|
||||
} else if ($filter == "nickname") {
|
||||
$users = UserModel::like('nickname', $q)->orderBy('uid');
|
||||
$total_pages = ceil($users->count() / 30);
|
||||
$users = $users->skip(($page - 1) * 30)->take(30)->get();
|
||||
}
|
||||
|
||||
echo View::make('admin.users')->with('users', $users)
|
||||
->with('filter', $filter)
|
||||
->with('q', $q)
|
||||
->with('page', $page)
|
||||
->with('total_pages', $total_pages)
|
||||
->render();
|
||||
}
|
||||
|
||||
public function players()
|
||||
{
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
|
||||
$filter = isset($_GET['filter']) ? $_GET['filter'] : "";
|
||||
|
||||
$q = isset($_GET['q']) ? $_GET['q'] : "";
|
||||
|
||||
if ($filter == "") {
|
||||
$players = PlayerModel::orderBy('uid');
|
||||
$total_pages = ceil($players->count() / 30);
|
||||
$players = $players->skip(($page - 1) * 30)->take(30)->get();
|
||||
} else if ($filter == "player_name") {
|
||||
$players = PlayerModel::like('player_name', $q)->orderBy('uid');
|
||||
$total_pages = ceil($players->count() / 30);
|
||||
$players = $players->skip(($page - 1) * 30)->take(30)->get();
|
||||
} else if ($filter == "uid") {
|
||||
$players = PlayerModel::where('uid', $q)->orderBy('uid');
|
||||
$total_pages = ceil($players->count() / 30);
|
||||
$players = $players->skip(($page - 1) * 30)->take(30)->get();
|
||||
}
|
||||
|
||||
echo View::make('admin.players')->with('players', $players)
|
||||
->with('filter', $filter)
|
||||
->with('q', $q)
|
||||
->with('page', $page)
|
||||
->with('total_pages', $total_pages)
|
||||
->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle ajax request from /admin/users
|
||||
*/
|
||||
public function userAjaxHandler()
|
||||
{
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : "";
|
||||
|
||||
|
|
@ -25,7 +100,7 @@ class AdminController extends BaseController
|
|||
Utils::checkPost(['color_scheme']);
|
||||
|
||||
$color_scheme = str_replace('_', '-', $_POST['color_scheme']);
|
||||
Option::set('color_scheme', $color_scheme);
|
||||
\Option::set('color_scheme', $color_scheme);
|
||||
|
||||
View::json('修改配色成功', 0);
|
||||
}
|
||||
|
|
@ -44,6 +119,7 @@ class AdminController extends BaseController
|
|||
|
||||
if ($user->setEmail($_POST['email']))
|
||||
View::json('邮箱修改成功', 0);
|
||||
|
||||
} if ($action == "nickname") {
|
||||
Utils::checkPost(['nickname']);
|
||||
|
||||
|
|
@ -52,6 +128,7 @@ class AdminController extends BaseController
|
|||
|
||||
if ($user->setNickName($_POST['nickname']))
|
||||
View::json('昵称已成功设置为 '.$_POST['nickname'], 0);
|
||||
|
||||
} else if ($action == "password") {
|
||||
Utils::checkPost(['password']);
|
||||
|
||||
|
|
@ -59,67 +136,77 @@ class AdminController extends BaseController
|
|||
if ($user->changePasswd($_POST['password']))
|
||||
View::json('密码修改成功', 0);
|
||||
}
|
||||
|
||||
} else if ($action == "score") {
|
||||
Utils::checkPost(['score']);
|
||||
|
||||
if ($user->setScore($_POST['score']))
|
||||
View::json('积分修改成功', 0);
|
||||
|
||||
} else if ($action == "permission") {
|
||||
$permission = $user->getPermission() == "0"
|
||||
? "-1" : "0";
|
||||
|
||||
if ($user->setPermission($permission))
|
||||
View::json('账号已被'.($permission == "-1"?"封禁":"解封"), 0);
|
||||
|
||||
} else if ($action == "delete") {
|
||||
if ($user->delete())
|
||||
View::json('账号已被成功删除', 0);
|
||||
|
||||
} else {
|
||||
throw new E('Illegal parameters', 1);
|
||||
}
|
||||
}
|
||||
|
||||
public function customize()
|
||||
/**
|
||||
* Handle ajax request from /admin/players
|
||||
*/
|
||||
public function playerAjaxHandler()
|
||||
{
|
||||
echo View::make('admin.customize')->render();
|
||||
}
|
||||
$action = isset($_GET['action']) ? $_GET['action'] : "";
|
||||
|
||||
public function options()
|
||||
{
|
||||
echo View::make('admin.options')->render();
|
||||
}
|
||||
// exception will be throw by model if player is not existent
|
||||
$player = new Player(Utils::getValue('pid', $_POST));
|
||||
|
||||
public function users()
|
||||
{/*
|
||||
for ($i=0; $i < 60; $i++) {
|
||||
$user = new UserModel();
|
||||
$user->email = Utils::generateRndString(6)."@".Utils::generateRndString(3).".com";
|
||||
$user->nickname = Utils::generateRndString(5);
|
||||
$user->score = 666;
|
||||
$user->ip = '111.111.111.111';
|
||||
$user->permission = "0";
|
||||
$user->register_at = Utils::getTimeFormatted();
|
||||
$user->save();
|
||||
if ($action == "preference") {
|
||||
Utils::checkPost(['preference']);
|
||||
|
||||
echo "Seed: ".$user->email." added. <br />";
|
||||
}
|
||||
exit;*/
|
||||
if ($_POST['preference'] != "default" && $_POST['preference'] != "slim")
|
||||
View::json('无效的参数', 0);
|
||||
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
$filter = isset($_GET['filter']) ? $_GET['filter'] : "";
|
||||
if ($player->setPreference($_POST['preference']))
|
||||
View::json('角色 '.$player->player_name.' 的优先模型已更改至 '.$_POST['preference'], 0);
|
||||
|
||||
} elseif ($action == "texture") {
|
||||
Utils::checkPost(['model', 'tid']);
|
||||
|
||||
if ($_POST['model'] != "steve" && $_POST['model'] != "alex" && $_POST['model'] != "cape")
|
||||
View::json('无效的参数', 0);
|
||||
|
||||
if (!(is_numeric($_POST['tid']) && Texture::find($_POST['tid'])))
|
||||
View::json('材质 tid.'.$_POST['tid'].' 不存在', 1);
|
||||
|
||||
if ($player->setTexture(['tid_'.$_POST['model'] => $_POST['tid']]))
|
||||
View::json('角色 '.$player->player_name.' 的材质修改成功', 0);
|
||||
|
||||
} elseif ($action == "owner") {
|
||||
Utils::checkPost(['uid']);
|
||||
|
||||
if (!is_numeric($_POST['uid']))
|
||||
View::json('无效的参数', 0);
|
||||
|
||||
$user = new User('', $_POST['uid']);
|
||||
|
||||
if (!$user->is_registered)
|
||||
View::json('不存在的用户', 1);
|
||||
|
||||
if ($player->setOwner($_POST['uid']))
|
||||
View::json('角色 '.$player->player_name.' 已成功让渡至 '.$user->getNickName(), 0);
|
||||
|
||||
if ($filter == "") {
|
||||
$users = UserModel::orderBy('uid');
|
||||
$total_pages = ceil($users->count() / 30);
|
||||
$users = $users->skip(($page - 1) * 30)->take(30)->get();
|
||||
} else {
|
||||
$users = UserModel::like('nickname', $filter)->orderBy('uid');
|
||||
$total_pages = ceil($users->count() / 30);
|
||||
$users = $users->skip(($page - 1) * 30)->take(30)->get();
|
||||
throw new E('Illegal parameters', 1);
|
||||
}
|
||||
|
||||
echo View::make('admin.users')->with('users', $users)
|
||||
->with('page', $page)
|
||||
->with('total_pages', $total_pages)
|
||||
->render();
|
||||
}
|
||||
|
||||
public function players()
|
||||
{
|
||||
echo View::make('admin.players')->render();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,11 @@ class PlayerController extends BaseController
|
|||
if ($user->getScore() < 100)
|
||||
View::json('积分不够添加角色啦', 7);
|
||||
|
||||
$player = new PlayerModel();
|
||||
$player->uid = $user->uid;
|
||||
$player->player_name = $player_name;
|
||||
$player->preference = "default";
|
||||
$player = new PlayerModel();
|
||||
$player->uid = $user->uid;
|
||||
$player->player_name = $player_name;
|
||||
$player->preference = "default";
|
||||
$player->last_modified = Utils::getTimeFormatted();
|
||||
$player->save();
|
||||
|
||||
$user->setScore(100, 'minus');
|
||||
|
|
@ -117,6 +118,7 @@ class PlayerController extends BaseController
|
|||
$field_name = "tid_".$texture->type;
|
||||
|
||||
$this->player->eloquent_model->$field_name = $tid;
|
||||
$this->player->eloquent_model->last_modified = Utils::getTimeFormatted();
|
||||
$this->player->eloquent_model->save();
|
||||
|
||||
View::json('材质已成功应用至角色 '.$this->player->eloquent_model->player_name.'', 0);
|
||||
|
|
@ -131,6 +133,8 @@ class PlayerController extends BaseController
|
|||
$this->player->eloquent_model->tid_alex = "";
|
||||
$this->player->eloquent_model->tid_cape = "";
|
||||
|
||||
$this->player->eloquent_model->last_modified = Utils::getTimeFormatted();
|
||||
|
||||
$this->player->eloquent_model->save();
|
||||
|
||||
View::json('角色 '.$this->player->eloquent_model->player_name.' 的材质已被成功重置', 0);
|
||||
|
|
|
|||
|
|
@ -100,6 +100,10 @@ class Player
|
|||
return $this->eloquent_model['preference'];
|
||||
}
|
||||
|
||||
public function setOwner($uid) {
|
||||
return $this->eloquent_model->update(['uid' => $uid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get JSON profile
|
||||
* @param int $api_type, which API to use, 0 for CustomSkinAPI, 1 for UniSkinAPI
|
||||
|
|
@ -146,9 +150,14 @@ class Player
|
|||
|
||||
class PlayerModel extends \Illuminate\Database\Eloquent\Model
|
||||
{
|
||||
public $primaryKey = 'pid';
|
||||
protected $table = 'players';
|
||||
public $timestamps = false;
|
||||
public $primaryKey = 'pid';
|
||||
protected $table = 'players';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['preference', 'last_modified'];
|
||||
|
||||
public function scopeLike($query, $field, $value)
|
||||
{
|
||||
return $query->where($field, 'LIKE', "%$value%");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,23 @@ class User
|
|||
return $this->eloquent_model->save();
|
||||
}
|
||||
|
||||
public function getPermission()
|
||||
{
|
||||
return $this->eloquent_model->permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set user permission
|
||||
* @param int $permission
|
||||
* -1 - banned
|
||||
* 0 - normal
|
||||
* 1 - admin
|
||||
*/
|
||||
public function setPermission($permission)
|
||||
{
|
||||
return $this->eloquent_model->update(['permission' => $permission]);
|
||||
}
|
||||
|
||||
public function setEmail($new_email)
|
||||
{
|
||||
$this->eloquent_model->email = $new_email;
|
||||
|
|
@ -233,6 +250,8 @@ class UserModel extends \Illuminate\Database\Eloquent\Model
|
|||
protected $table = 'users';
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['email', 'nickname', 'permission'];
|
||||
|
||||
public function scopeLike($query, $field, $value)
|
||||
{
|
||||
return $query->where($field, 'LIKE', "%$value%");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: printempw
|
||||
* @Date: 2016-07-22 14:02:44
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-07-22 19:27:20
|
||||
* @Last Modified time: 2016-07-23 15:17:22
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
|
@ -21,10 +21,9 @@ $('#layout-skins-list [data-skin]').click(function(e) {
|
|||
});
|
||||
|
||||
$('#color-submit').click(function() {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin?action=color",
|
||||
url: "../admin/users?action=color",
|
||||
dataType: "json",
|
||||
data: { "color_scheme": current_skin },
|
||||
success: function(json) {
|
||||
|
|
@ -40,7 +39,16 @@ $('#color-submit').click(function() {
|
|||
});
|
||||
|
||||
$('#page-select').on('change', function() {
|
||||
window.location = "?page=" + $(this).val();
|
||||
// if has query strings
|
||||
if (getQueryString('filter') != "" || getQueryString('q') != "") {
|
||||
if (getQueryString('page') == "")
|
||||
window.location = location.href + "&page=" + $(this).val();
|
||||
else
|
||||
window.location = "?filter="+getQueryString('filter')+"&q="+getQueryString('q')+"&page="+$(this).val();
|
||||
} else {
|
||||
window.location = "?page=" + $(this).val();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function changeUserEmail(uid) {
|
||||
|
|
@ -50,7 +58,7 @@ function changeUserEmail(uid) {
|
|||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin?action=email",
|
||||
url: "../admin/users?action=email",
|
||||
dataType: "json",
|
||||
data: { 'uid': uid, 'email': email },
|
||||
success: function(json) {
|
||||
|
|
@ -74,7 +82,7 @@ function changeUserNickName(uid) {
|
|||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin?action=nickname",
|
||||
url: "../admin/users?action=nickname",
|
||||
dataType: "json",
|
||||
data: { 'uid': uid, 'nickname': nickname },
|
||||
success: function(json) {
|
||||
|
|
@ -98,7 +106,7 @@ function changeUserPwd(uid) {
|
|||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin?action=password",
|
||||
url: "../admin/users?action=password",
|
||||
dataType: "json",
|
||||
data: { 'uid': uid, 'password': password },
|
||||
success: function(json) {
|
||||
|
|
@ -116,7 +124,7 @@ function changeUserPwd(uid) {
|
|||
function changeUserScore(uid, score) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin?action=score",
|
||||
url: "../admin/users?action=score",
|
||||
dataType: "json",
|
||||
data: { 'uid': uid, 'score': score },
|
||||
success: function(json) {
|
||||
|
|
@ -133,12 +141,36 @@ function changeUserScore(uid, score) {
|
|||
});
|
||||
}
|
||||
|
||||
function changePermission(uid) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin/users?action=permission",
|
||||
dataType: "json",
|
||||
data: { 'uid': uid },
|
||||
success: function(json) {
|
||||
if (json.errno == 0) {
|
||||
var object = $($('#'+uid).find('ul').children()[6]);
|
||||
var dom = '<a href="javascript:changePermission('+uid+');">' +
|
||||
(object.text() == '封禁' ? '解封' : '封禁') + '</a>';
|
||||
object.html(dom);
|
||||
$('#'+uid).find('#permission').text(object.text() == '封禁' ? '正常' : '封禁');
|
||||
toastr.success(json.msg);
|
||||
} else {
|
||||
toastr.warning(json.msg);
|
||||
}
|
||||
},
|
||||
error: function(json) {
|
||||
showModal(json.responseText.replace(/\n/g, '<br />'), 'Fatal Error(请联系作者)', 'danger');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deleteUserAccount(uid) {
|
||||
if (!window.confirm('真的要删除此用户吗?此操作不可恢复')) return;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin?action=delete",
|
||||
url: "../admin/users?action=delete",
|
||||
dataType: "json",
|
||||
data: { 'uid': uid },
|
||||
success: function(json) {
|
||||
|
|
@ -160,4 +192,96 @@ $('.score').on('keypress', function(event){
|
|||
changeUserScore($(this).parent().parent().attr('id'), $(this).val());
|
||||
}).click(function() {
|
||||
$(this).tooltip('show');
|
||||
})
|
||||
});
|
||||
|
||||
$('body').on('change', '#preference', function() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin/players?action=preference",
|
||||
dataType: "json",
|
||||
data: { 'pid': $(this).parent().parent().attr('id'), 'preference': $(this).val() },
|
||||
success: function(json) {
|
||||
if (json.errno == 0) {
|
||||
toastr.success(json.msg);
|
||||
} else {
|
||||
toastr.warning(json.msg);
|
||||
}
|
||||
},
|
||||
error: function(json) {
|
||||
showModal(json.responseText.replace(/\n/g, '<br />'), 'Fatal Error(请联系作者)', 'danger');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function changeTexture(pid) {
|
||||
var dom = '<div class="form-group">'+
|
||||
'<label for="model">材质类型</label>'+
|
||||
'<select class="form-control" id="model">'+
|
||||
'<option value="steve">皮肤(Steve 模型)</option>'+
|
||||
'<option value="alex">皮肤(Alex 模型)</option>'+
|
||||
'<option value="cape">披风</option>'+
|
||||
'</select>'+
|
||||
'</div>'+
|
||||
'<div class="form-group">'+
|
||||
'<label for="tid">材质 ID</label>'+
|
||||
'<input id="tid" class="form-control" type="text" placeholder="输入要更换的材质的 TID">'+
|
||||
'</div>';
|
||||
|
||||
var player_name = $('#'+pid).find('#player-name').text();
|
||||
showModal(dom, '更换角色 '+player_name+' 的材质', 'default', 'ajaxChangeTexture('+pid+')');
|
||||
return;
|
||||
}
|
||||
|
||||
function ajaxChangeTexture(pid) {
|
||||
// remove interference of modal which is hide
|
||||
$('.modal').each(function() {
|
||||
if ($(this).css('display') == "none")
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
var model = $('#model').val();
|
||||
var tid = $('#tid').val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin/players?action=texture",
|
||||
dataType: "json",
|
||||
data: { 'pid': pid, 'model': model, 'tid': tid },
|
||||
success: function(json) {
|
||||
if (json.errno == 0) {
|
||||
$('#'+pid+'-'+model).attr('src', '../preview/64/'+tid+'.png');
|
||||
$('.modal').modal('hide');
|
||||
toastr.success(json.msg);
|
||||
} else {
|
||||
toastr.warning(json.msg);
|
||||
}
|
||||
},
|
||||
error: function(json) {
|
||||
showModal(json.responseText.replace(/\n/g, '<br />'), 'Fatal Error(请联系作者)', 'danger');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function changeOwner(pid) {
|
||||
var uid = prompt("请输入此角色要让渡至的用户 UID:");
|
||||
|
||||
if (!uid) return;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../admin/players?action=owner",
|
||||
dataType: "json",
|
||||
data: { 'pid': pid, 'uid': uid },
|
||||
success: function(json) {
|
||||
if (json.errno == 0) {
|
||||
$($('#'+pid).children()[1]).text(uid);
|
||||
toastr.success(json.msg);
|
||||
} else {
|
||||
toastr.warning(json.msg);
|
||||
}
|
||||
},
|
||||
error: function(json) {
|
||||
showModal(json.responseText.replace(/\n/g, '<br />'), 'Fatal Error(请联系作者)', 'danger');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,16 @@ function isMobile() {
|
|||
return false;
|
||||
}
|
||||
|
||||
function getQueryString(key) {
|
||||
result = location.search.match(new RegExp('[\?\&]'+key+'=([^\&]+)','i'));
|
||||
|
||||
if (result == null || result.length < 1){
|
||||
return "";
|
||||
} else {
|
||||
return result[1];
|
||||
}
|
||||
}
|
||||
|
||||
function logout(with_out_confirm, callback) {
|
||||
if (!with_out_confirm) {
|
||||
if (!window.confirm('确定要登出吗?')) return;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,16 @@
|
|||
* @Author: printempw
|
||||
* @Date: 2016-07-22 14:08:41
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-07-22 19:33:23
|
||||
* @Last Modified time: 2016-07-23 12:35:32
|
||||
*/
|
||||
|
||||
@import "style.scss";
|
||||
|
||||
.info-box > a {
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
.info-box {
|
||||
a {
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.key {
|
||||
|
|
@ -29,23 +31,42 @@ td[class='key'], td[class='value'] {
|
|||
}
|
||||
}
|
||||
|
||||
#page-select {
|
||||
padding-left: 0;
|
||||
margin: 0 20px 0 0;
|
||||
border-radius: 4px;
|
||||
padding: 5.5px 14px;
|
||||
}
|
||||
|
||||
input.score {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.user-search-form {
|
||||
display: inline;
|
||||
|
||||
.user-search-input {
|
||||
display: inline;
|
||||
width: 30%;
|
||||
float: right;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
select.user-search-input {
|
||||
padding-left: 0;
|
||||
margin: 0 20px 0 0;
|
||||
padding: 5.5px 14px;
|
||||
width: 120px;
|
||||
}
|
||||
}
|
||||
.user-search-input {
|
||||
display: inline;
|
||||
width: 30%;
|
||||
float: right;
|
||||
margin: 0;
|
||||
|
||||
td {
|
||||
a {
|
||||
color: inherit;
|
||||
|
||||
img {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
a:first-child > img {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
a:last-child > img {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
/*
|
||||
* @Author: printempw
|
||||
* @Date: 2016-06-04 20:55:09
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-07-23 10:47:50
|
||||
*/
|
||||
|
||||
@font-face {
|
||||
|
|
@ -26,6 +29,13 @@ input:-webkit-autofill {
|
|||
-webkit-box-shadow: 0 0 0px 1000px #fff inset !important;
|
||||
}
|
||||
|
||||
#page-select {
|
||||
padding-left: 0;
|
||||
margin: 0 20px 0 0;
|
||||
border-radius: 4px;
|
||||
padding: 5.5px 14px;
|
||||
}
|
||||
|
||||
.item {
|
||||
display: block;
|
||||
background: #EFF1F0;
|
||||
|
|
@ -75,29 +85,54 @@ input:-webkit-autofill {
|
|||
padding: 3px 8px;
|
||||
}
|
||||
|
||||
.item-footer > .more {
|
||||
.item-footer {
|
||||
.more {
|
||||
float: right;
|
||||
margin-left: 6px;
|
||||
margin-right: 3px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.more:hover {
|
||||
color: #dadada;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.operations {
|
||||
display: inline; float: right;
|
||||
|
||||
i {
|
||||
padding: .5em .5em;
|
||||
display: inline !important;
|
||||
}
|
||||
|
||||
i:hover {
|
||||
color: #555;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.skin2d {
|
||||
float: right;
|
||||
margin-left: 6px;
|
||||
margin-right: 3px;
|
||||
color: #fff;
|
||||
max-height: 64px;
|
||||
width: 64px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.item-footer > .more:hover {
|
||||
color: #dadada;
|
||||
#canvas3d {
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.item-footer > small {
|
||||
font-size: 50%;
|
||||
#preview-2d > p {
|
||||
height: 64px;
|
||||
line-height: 64px;
|
||||
}
|
||||
|
||||
.operations { display: inline; float: right; }
|
||||
.operations > i { padding: .5em .5em; display: inline !important; }
|
||||
.operations > i:hover { color: #555; cursor: pointer; }
|
||||
.skin2d { float: right; max-height: 64px; width: 64px; font-size: 16px; }
|
||||
|
||||
#canvas3d { margin: 0 auto; display: block; }
|
||||
#preview-2d > p { height: 64px; line-height: 64px; }
|
||||
|
||||
#toast-container > div {
|
||||
opacity: 1;
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
||||
|
|
|
|||
|
|
@ -97,14 +97,15 @@ Route::group(['prefix' => 'skinlib'], function()
|
|||
Route::group(['middleware' => 'App\Middlewares\CheckAdminMiddleware', 'prefix' => 'admin'], function()
|
||||
{
|
||||
Route::get('/', 'AdminController@index');
|
||||
Route::post('/', 'AdminController@ajaxHandler');
|
||||
|
||||
Route::all('/customize', 'AdminController@customize');
|
||||
Route::all('/customize', 'AdminController@customize');
|
||||
Route::all('/options', 'AdminController@options');
|
||||
|
||||
Route::all('/options', 'AdminController@options');
|
||||
|
||||
Route::get('/users', 'AdminController@users');
|
||||
Route::get('/players', 'AdminController@players');
|
||||
Route::get('/users', 'AdminController@users');
|
||||
Route::get('/players', 'AdminController@players');
|
||||
// ajax handlers
|
||||
Route::post('/users', 'AdminController@userAjaxHandler');
|
||||
Route::post('/players', 'AdminController@playerAjaxHandler');
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -101,9 +101,6 @@
|
|||
</li>
|
||||
@endforeach
|
||||
|
||||
<li class="header">皮肤库</li>
|
||||
<li><a href="../admin/texture"><i class="fa fa-archive"></i> <span>材质管理</span></a></li>
|
||||
|
||||
@if ($user->is_admin)
|
||||
<li class="header">返回</li>
|
||||
<li><a href="../user"><i class="fa fa-user"></i> <span>用户中心</span></a></li>
|
||||
|
|
|
|||
166
resources/views/admin/players.tpl
Normal file
166
resources/views/admin/players.tpl
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
@extends('admin.master')
|
||||
|
||||
@section('title', '角色管理')
|
||||
|
||||
@section('content')
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
@if (isset($_GET['q']))
|
||||
搜索结果:{{ $_GET['q'] }}
|
||||
@else
|
||||
角色管理
|
||||
@endif
|
||||
<small>Player Management</small>
|
||||
<form method="get" action="" class="user-search-form">
|
||||
<input type="text" name="q" class="form-control user-search-input" placeholder="输入,回车搜索。" value="{{ $q }}">
|
||||
<select name="filter" class="form-control pull-right user-search-input">
|
||||
<option value='player_name' selected="{{ $filter == 'email' ? 'selected' : '' }}">搜索角色名</option>
|
||||
<option value='uid' selected="{{ $filter == 'nickname' ? 'selected' : '' }}">根据角色拥有者搜索</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
</h1>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="box">
|
||||
<div class="box-body table-responsive no-padding">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>PID</th>
|
||||
<th>拥有者 UID</th>
|
||||
<th>角色名</th>
|
||||
<th>优先模型</th>
|
||||
<th>预览材质</th>
|
||||
<th>修改时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@forelse($players as $player)
|
||||
<tr id="{{ $player->pid }}">
|
||||
<td>{{ $player->pid }}</td>
|
||||
<td><a href="?filter=uid&q={{ $player->uid }}">{{ $player->uid }}</a></td>
|
||||
<td id="player-name">{{ $player->player_name }}</td>
|
||||
<td>
|
||||
<select class="form-control" id="preference">
|
||||
<option {{ ($player->preference == "default") ? 'selected="selected"' : '' }} value="default">Default</option>
|
||||
<option {{ ($player->preference == "slim") ? 'selected="selected"' : '' }} value="slim">Slim</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
@if ($player->tid_steve == '0')
|
||||
<img id="{{ $player->pid }}-steve" width="64" />
|
||||
@else
|
||||
<a href="../skinlib/show?tid={{ $player->tid_steve }}">
|
||||
<img id="{{ $player->pid }}-steve" width="64" src="../preview/64/{{ $player->tid_steve }}.png" />
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if ($player->tid_alex == '0')
|
||||
<img id="{{ $player->pid }}-alex" width="64" />
|
||||
@else
|
||||
<a href="../skinlib/show?tid={{ $player->tid_alex }}">
|
||||
<img id="{{ $player->pid }}-alex" width="64" src="../preview/64/{{ $player->tid_alex }}.png" />
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if ($player->tid_cape == '0')
|
||||
<img id="{{ $player->pid }}-cape" width="64" />
|
||||
@else
|
||||
<a href="../skinlib/show?tid={{ $player->tid_cape }}">
|
||||
<img id="{{ $player->pid }}-cape" width="64" src="../preview/64/{{ $player->tid_cape }}.png" />
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $player->last_modified }}</td>
|
||||
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
更多操作 <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:changeTexture('{{ $player->pid }}');">更换材质</a></li>
|
||||
<li><a href="javascript:changeOwner('{{ $player->pid }}');">更换角色拥有者</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a class="btn btn-danger btn-sm" href="javascript:deletePlayer('{{ $player->pid }}');">删除角色</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td>0</td>
|
||||
<td>无结果</td>
|
||||
<td>(´・ω・`)</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<!-- Pagination -->
|
||||
<ul class="pagination pagination-sm no-margin pull-right">
|
||||
<?php $base_url = ($filter != "" && $q != "") ? "?filter=$filter&q=$q&" : "?"; ?>
|
||||
<li><a href="?page=1">«</a></li>
|
||||
|
||||
@if ($page != 1)
|
||||
<li><a href="{{ $base_url }}page={{ $page-1 }}">{{ $page - 1 }}</a></li>
|
||||
@endif
|
||||
|
||||
<li><a href="{{ $base_url }}page={{ $page }}" class="active">{{ $page }}</a></li>
|
||||
|
||||
@if ($total_pages > $page)
|
||||
<li><a href="{{ $base_url }}page={{ $page+1 }}">{{ $page+1 }}</a></li>
|
||||
@endif
|
||||
|
||||
<li><a href="{{ $base_url }}page={{ $total_pages }}">»</a></li>
|
||||
</ul>
|
||||
|
||||
<select id="page-select" class="pull-right">
|
||||
@for ($i = 1; $i <= $total_pages; $i++)
|
||||
|
||||
@if ($i == $page)
|
||||
<option value='{{ $i }}' selected="selected">{{ $i }}</option>
|
||||
@else
|
||||
<option value='{{ $i }}'>{{ $i }}</option>
|
||||
@endif
|
||||
|
||||
@endfor
|
||||
</select>
|
||||
|
||||
<p class="pull-right">第 {{ $page }} 页,共 {{ $total_pages }} 页</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section><!-- /.content -->
|
||||
</div><!-- /.content-wrapper -->
|
||||
|
||||
<div id="modal-change-texture" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">更改 Player 的材质</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="./player" class="btn btn-default pull-left">添加角色</a>
|
||||
<a href="javascript:setTexture();" class="btn btn-primary">提交</a>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
@endsection
|
||||
|
|
@ -9,15 +9,20 @@
|
|||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
@if (isset($_GET['filter']))
|
||||
搜索结果:{{ $_GET['filter'] }}
|
||||
@if (isset($_GET['q']))
|
||||
搜索结果:{{ $_GET['q'] }}
|
||||
@else
|
||||
用户管理
|
||||
@endif
|
||||
<small>User Management</small>
|
||||
<form method="get" action="" class="user-search-form">
|
||||
<input type="text" name="filter" class="form-control user-search-input" placeholder="输入昵称,回车搜索。" value="<?php echo Utils::getValue('search-username', $_POST); ?>">
|
||||
<input type="text" name="q" class="form-control user-search-input" placeholder="输入,回车搜索。" value="{{ $q }}">
|
||||
<select name="filter" class="form-control pull-right user-search-input">
|
||||
<option value='email' {{ $filter == 'email' ? 'selected="selected"' : '' }}>搜索邮箱</option>
|
||||
<option value='nickname' {{ $filter == 'nickname' ? 'selected="selected"' : '' }}>搜索昵称</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
</h1>
|
||||
</section>
|
||||
|
||||
|
|
@ -32,6 +37,7 @@
|
|||
<th>邮箱</th>
|
||||
<th>昵称</th>
|
||||
<th>积分</th>
|
||||
<th>状态</th>
|
||||
<th>注册时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
|
|
@ -44,6 +50,7 @@
|
|||
<td id="email">{{ $user->email }}</td>
|
||||
<td id="nickname">{{ $user->nickname }}</td>
|
||||
<td><input type="text" class="form-control score" value="{{ $user->score }}" title="输入修改后的积分,回车提交" data-placement="top"></td>
|
||||
<td id="permission">{{ $user->permission == "-1" ? "封禁" : "正常" }}</td>
|
||||
<td>{{ $user->register_at }}</td>
|
||||
|
||||
<td>
|
||||
|
|
@ -55,46 +62,59 @@
|
|||
<li><a href="javascript:changeUserEmail('{{ $user->uid }}');">修改邮箱</a></li>
|
||||
<li><a href="javascript:changeUserNickName('{{ $user->uid }}');">修改昵称</a></li>
|
||||
<li><a href="javascript:changeUserPwd('{{ $user->uid }}');">更改密码</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="../admin/players?filter=uid&q={{ $user->uid }}">查看该用户拥有的角色</a></li>
|
||||
<li class="divider"></li>
|
||||
|
||||
@if ($user->permission == "1")
|
||||
<li><a href="javascript:;">无法封禁管理员</a></li>
|
||||
@elseif ($user->permission == "0")
|
||||
<li><a href="javascript:changePermission('{{ $user->uid }}');">封禁</a></li>
|
||||
@else
|
||||
<li><a href="javascript:changePermission('{{ $user->uid }}');">解封</a></li>
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a class="btn btn-danger btn-sm"
|
||||
@if ($user->permission == "1")
|
||||
disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="少年,不要作死哦"
|
||||
@else
|
||||
href="javascript:deleteUserAccount('{{ $user->uid }}');"
|
||||
@endif>
|
||||
删除用户
|
||||
</a>
|
||||
|
||||
@if ($user->permission == "1")
|
||||
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="管理员账号不能被这样删除的啦">删除用户</a>
|
||||
@else
|
||||
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount('{{ $user->uid }}');">删除用户</a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td>0</td>
|
||||
<td>无结果</td>
|
||||
<td>(´・ω・`)</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<!-- Pagination -->
|
||||
<ul class="pagination pagination-sm no-margin pull-right">
|
||||
<?php $base_url = ($filter != "" && $q != "") ? "?filter=$filter&q=$q&" : "?"; ?>
|
||||
<li><a href="?page=1">«</a></li>
|
||||
|
||||
@if ($page != 1)
|
||||
<li><a href="?page={{ $page-1 }}">{{ $page - 1 }}</a></li>
|
||||
<li><a href="{{ $base_url }}page={{ $page-1 }}">{{ $page - 1 }}</a></li>
|
||||
@endif
|
||||
|
||||
<li><a href="?page={{ $page }}" class="active">{{ $page }}</a></li>
|
||||
<li><a href="{{ $base_url }}page={{ $page }}" class="active">{{ $page }}</a></li>
|
||||
|
||||
@if ($total_pages > $page)
|
||||
<li><a href="?page={{ $page+1 }}">{{ $page+1 }}</a></li>
|
||||
<li><a href="{{ $base_url }}page={{ $page+1 }}">{{ $page+1 }}</a></li>
|
||||
@endif
|
||||
|
||||
<li><a href="?page={{ $total_pages }}">»</a></li>
|
||||
<li><a href="{{ $base_url }}page={{ $total_pages }}">»</a></li>
|
||||
</ul>
|
||||
|
||||
<select id="page-select" class="pull-right">
|
||||
@for ($i = 1; $i <= $total_pages; $i++)
|
||||
@for ($i = 1; $i <= $total_pages; $i++)
|
||||
|
||||
@if ($i == $page)
|
||||
<option value='{{ $i }}' selected="selected">{{ $i }}</option>
|
||||
|
|
@ -102,7 +122,7 @@
|
|||
<option value='{{ $i }}'>{{ $i }}</option>
|
||||
@endif
|
||||
|
||||
@endfor
|
||||
@endfor
|
||||
</select>
|
||||
|
||||
<p class="pull-right">第 {{ $page }} 页,共 {{ $total_pages }} 页</p>
|
||||
|
|
|
|||
|
|
@ -16,22 +16,22 @@
|
|||
<li><i class="fa fa-tags"></i> 当前正显示</li>
|
||||
<li>
|
||||
@if ($filter == "skin")
|
||||
皮肤<small>(任意模型)</small>
|
||||
皮肤<small>(任意模型)</small>
|
||||
@elseif ($filter == "steve")
|
||||
皮肤<small>(Steve 模型)</small>
|
||||
皮肤<small>(Steve 模型)</small>
|
||||
@elseif ($filter == "alex")
|
||||
皮肤<small>(Alex 模型)</small>
|
||||
皮肤<small>(Alex 模型)</small>
|
||||
@elseif ($filter == "cape")
|
||||
披风
|
||||
披风
|
||||
@elseif ($filter == "user")
|
||||
用户(uid.{{ $_GET['uid'] or 0 }})上传
|
||||
用户(uid.{{ $_GET['uid'] or 0 }})上传
|
||||
@endif
|
||||
</li>
|
||||
<li class="active">
|
||||
@if ($sort == "time")
|
||||
最新上传
|
||||
最新上传
|
||||
@elseif ($sort == "likes")
|
||||
最多收藏
|
||||
最多收藏
|
||||
@endif
|
||||
</li>
|
||||
</ol>
|
||||
|
|
@ -51,17 +51,15 @@
|
|||
<span>{{ $texture['name'] }} <small>({{ $texture['type'] }})</small></span>
|
||||
@if (isset($_SESSION['email']))
|
||||
|
||||
@if ($user->closet->has($texture['tid']))
|
||||
<a href="javascript:removeFromCloset({{ $texture['tid'] }});" class="more like liked" tid="{{ $texture['tid'] }}" title="从衣柜中移除" data-placement="top" data-toggle="tooltip">
|
||||
@else
|
||||
<a href="javascript:addToCloset({{ $texture['tid'] }});" class="more like" tid="{{ $texture['tid'] }}" title="添加至衣柜" data-placement="top" data-toggle="tooltip">
|
||||
@endif
|
||||
@if ($user->closet->has($texture['tid']))
|
||||
<a title="从衣柜中移除" class="more like liked" tid="{{ $texture['tid'] }}" href="javascript:removeFromCloset({{ $texture['tid'] }});" data-placement="top" data-toggle="tooltip"><i class="fa fa-heart"></i></a>
|
||||
@else
|
||||
<a title="添加至衣柜" class="more like" tid="{{ $texture['tid'] }}" href="javascript:addToCloset({{ $texture['tid'] }});" data-placement="top" data-toggle="tooltip"><i class="fa fa-heart"></i></a>
|
||||
@endif
|
||||
|
||||
@else
|
||||
<a href="javascript:;" class="more like" title="请先登录" data-placement="top" data-toggle="tooltip">
|
||||
<a title="请先登录" class="more like" href="javascript:;" data-placement="top" data-toggle="tooltip"><i class="fa fa-heart"></i></a>
|
||||
@endif
|
||||
<i class="fa fa-heart"></i>
|
||||
</a>
|
||||
|
||||
@if ($texture['public'] == "0")
|
||||
<small class="more" tid="{{ $texture['tid'] }}">私密</small>
|
||||
|
|
@ -75,6 +73,7 @@
|
|||
@endforelse
|
||||
</div><!-- /.box-body -->
|
||||
<div class="box-footer">
|
||||
<!-- Pagination -->
|
||||
<ul class="pagination pagination-sm no-margin pull-right">
|
||||
<li><a href="?page=1">«</a></li>
|
||||
@if ($page != 1)
|
||||
|
|
|
|||
|
|
@ -134,6 +134,12 @@
|
|||
|
||||
@yield('script')
|
||||
|
||||
@if (isset($_SESSION['msg']))
|
||||
<script>
|
||||
toastr.info('{{ $_SESSION['msg'] }}'); <?php unset($_SESSION['msg']) ?>
|
||||
</script>
|
||||
@endif
|
||||
|
||||
<script>{{ Option::get('custom_js') }}</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user