mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
资源只统计本人的。
This commit is contained in:
parent
6bb2e9eddb
commit
d7a13dda12
@ -28,18 +28,52 @@ namespace ShadowEditor.Server.Controllers
|
||||
{
|
||||
var mongo = new MongoHelper();
|
||||
|
||||
long sceneCount = 0, meshCount = 0, mapCount = 0, materialCount = 0, audioCount = 0, animationCount = 0, particleCount = 0,
|
||||
prefabCount = 0, characterCount = 0, screenshotCount = 0, videoCount = 0;
|
||||
|
||||
// 获取所有类别
|
||||
var sceneCount = mongo.Count(Constant.SceneCollectionName);
|
||||
var meshCount = mongo.Count(Constant.MeshCollectionName);
|
||||
var mapCount = mongo.Count(Constant.MapCollectionName);
|
||||
var materialCount = mongo.Count(Constant.MaterialCollectionName);
|
||||
var audioCount = mongo.Count(Constant.AudioCollectionName);
|
||||
var animationCount = mongo.Count(Constant.AnimationCollectionName);
|
||||
var particleCount = mongo.Count(Constant.ParticleCollectionName);
|
||||
var prefabCount = mongo.Count(Constant.PrefabCollectionName);
|
||||
var characterCount = mongo.Count(Constant.CharacterCollectionName);
|
||||
var screenshotCount = mongo.Count(Constant.ScreenshotCollectionName);
|
||||
var videoCount = mongo.Count(Constant.VideoCollectionName);
|
||||
if (ConfigHelper.EnableAuthority)
|
||||
{
|
||||
var user = UserHelper.GetCurrentUser();
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
var filter = Builders<BsonDocument>.Filter.Eq("UserID", user.ID);
|
||||
|
||||
if (user.Name == "Administrator")
|
||||
{
|
||||
var filter2 = Builders<BsonDocument>.Filter.Exists("UserID");
|
||||
var filter3 = Builders<BsonDocument>.Filter.Not(filter2);
|
||||
filter = Builders<BsonDocument>.Filter.Or(filter, filter2);
|
||||
|
||||
}
|
||||
sceneCount = mongo.Count(Constant.SceneCollectionName, filter);
|
||||
meshCount = mongo.Count(Constant.MeshCollectionName, filter);
|
||||
mapCount = mongo.Count(Constant.MapCollectionName, filter);
|
||||
materialCount = mongo.Count(Constant.MaterialCollectionName, filter);
|
||||
audioCount = mongo.Count(Constant.AudioCollectionName, filter);
|
||||
animationCount = mongo.Count(Constant.AnimationCollectionName, filter);
|
||||
particleCount = mongo.Count(Constant.ParticleCollectionName, filter);
|
||||
prefabCount = mongo.Count(Constant.PrefabCollectionName, filter);
|
||||
characterCount = mongo.Count(Constant.CharacterCollectionName, filter);
|
||||
screenshotCount = mongo.Count(Constant.ScreenshotCollectionName, filter);
|
||||
videoCount = mongo.Count(Constant.VideoCollectionName, filter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sceneCount = mongo.Count(Constant.SceneCollectionName);
|
||||
meshCount = mongo.Count(Constant.MeshCollectionName);
|
||||
mapCount = mongo.Count(Constant.MapCollectionName);
|
||||
materialCount = mongo.Count(Constant.MaterialCollectionName);
|
||||
audioCount = mongo.Count(Constant.AudioCollectionName);
|
||||
animationCount = mongo.Count(Constant.AnimationCollectionName);
|
||||
particleCount = mongo.Count(Constant.ParticleCollectionName);
|
||||
prefabCount = mongo.Count(Constant.PrefabCollectionName);
|
||||
characterCount = mongo.Count(Constant.CharacterCollectionName);
|
||||
screenshotCount = mongo.Count(Constant.ScreenshotCollectionName);
|
||||
videoCount = mongo.Count(Constant.VideoCollectionName);
|
||||
}
|
||||
|
||||
return Json(new
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user