mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-18 13:54:01 +08:00
Clean up
This commit is contained in:
parent
d8f08176a2
commit
fd541e7365
@ -538,21 +538,9 @@ class AdminController extends Controller
|
||||
$owner->save();
|
||||
}
|
||||
|
||||
return json(trans('admin.players.name.success', ['player' => $player->name]), 0, ['name' => $player->name]);
|
||||
return json(trans('admin.players.name.success', ['player' => $player->name]), 0);
|
||||
} else {
|
||||
return json(trans('admin.users.operations.invalid'), 1);
|
||||
}
|
||||
}
|
||||
|
||||
public function getOneUser($uid)
|
||||
{
|
||||
$user = User::find($uid);
|
||||
if ($user) {
|
||||
return json('success', 0, ['user' => $user->makeHidden([
|
||||
'password', 'ip', 'last_sign_at', 'register_at', 'remember_token',
|
||||
])->toArray()]);
|
||||
} else {
|
||||
return json('No such user.', 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,6 @@ Route::group(['middleware' => ['auth', 'admin'], 'prefix' => 'admin'], function
|
||||
Route::view('/players', 'admin.players');
|
||||
Route::post('/players', 'AdminController@playerAjaxHandler');
|
||||
Route::any('/player-data', 'AdminController@getPlayerData');
|
||||
Route::get('/user/{uid}', 'AdminController@getOneUser');
|
||||
|
||||
Route::view('/reports', 'admin.reports');
|
||||
Route::post('/reports', 'ReportController@review');
|
||||
|
@ -681,7 +681,6 @@ class AdminControllerTest extends BrowserKitTestCase
|
||||
])->seeJson([
|
||||
'code' => 0,
|
||||
'message' => trans('admin.players.name.success', ['player' => 'new_name']),
|
||||
'name' => 'new_name',
|
||||
]);
|
||||
|
||||
// Single player
|
||||
@ -689,7 +688,6 @@ class AdminControllerTest extends BrowserKitTestCase
|
||||
$this->postJson('/admin/players', [
|
||||
'pid' => $player->pid,
|
||||
'action' => 'name',
|
||||
'name' => 'abc',
|
||||
])->seeJson(['code' => 0]);
|
||||
$player->refresh();
|
||||
$this->assertEquals('abc', $player->user->nickname);
|
||||
@ -704,30 +702,4 @@ class AdminControllerTest extends BrowserKitTestCase
|
||||
]);
|
||||
$this->assertNull(Player::find($player->pid));
|
||||
}
|
||||
|
||||
public function testGetOneUser()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
$this->get('/admin/user/'.$user->uid)
|
||||
->seeJson([
|
||||
'code' => 0,
|
||||
'message' => 'success',
|
||||
'user' => [
|
||||
'uid' => $user->uid,
|
||||
'email' => $user->email,
|
||||
'nickname' => $user->nickname,
|
||||
'score' => $user->score,
|
||||
'avatar' => $user->avatar,
|
||||
'permission' => $user->permission,
|
||||
'verified' => (bool) $user->verified,
|
||||
'verification_token' => (string) $user->verification_token,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->get('/admin/user/-1')
|
||||
->seeJson([
|
||||
'code' => 1,
|
||||
'message' => 'No such user.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user