添加导入数据
This commit is contained in:
parent
6aa9298974
commit
8caaffdb11
|
|
@ -44,6 +44,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudGaming.ExtApi", "Api\C
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudGaming.Web", "Api\CloudGaming.Web\CloudGaming.Web.csproj", "{9AA4903E-60CB-47FA-8FA2-85A0763B613A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudGaming.Web", "Api\CloudGaming.Web\CloudGaming.Web.csproj", "{9AA4903E-60CB-47FA-8FA2-85A0763B613A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudGaming.ImportGame", "Console\CloudGaming.ImportGame\CloudGaming.ImportGame.csproj", "{C7C8DE34-49D5-438F-85A0-1C028E9176FD}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -98,6 +100,10 @@ Global
|
||||||
{9AA4903E-60CB-47FA-8FA2-85A0763B613A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{9AA4903E-60CB-47FA-8FA2-85A0763B613A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9AA4903E-60CB-47FA-8FA2-85A0763B613A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{9AA4903E-60CB-47FA-8FA2-85A0763B613A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{9AA4903E-60CB-47FA-8FA2-85A0763B613A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{9AA4903E-60CB-47FA-8FA2-85A0763B613A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C7C8DE34-49D5-438F-85A0-1C028E9176FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C7C8DE34-49D5-438F-85A0-1C028E9176FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C7C8DE34-49D5-438F-85A0-1C028E9176FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C7C8DE34-49D5-438F-85A0-1C028E9176FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -115,6 +121,7 @@ Global
|
||||||
{58FD9A2F-E1FC-494C-9484-D5BCA8511EBE} = {A3F00FB0-49D6-48B1-99D9-4619634DF8D9}
|
{58FD9A2F-E1FC-494C-9484-D5BCA8511EBE} = {A3F00FB0-49D6-48B1-99D9-4619634DF8D9}
|
||||||
{64997DCB-487F-4617-A43C-10AD78B91B29} = {51CB40D2-99F5-43E8-95B4-3A75C91736A6}
|
{64997DCB-487F-4617-A43C-10AD78B91B29} = {51CB40D2-99F5-43E8-95B4-3A75C91736A6}
|
||||||
{9AA4903E-60CB-47FA-8FA2-85A0763B613A} = {51CB40D2-99F5-43E8-95B4-3A75C91736A6}
|
{9AA4903E-60CB-47FA-8FA2-85A0763B613A} = {51CB40D2-99F5-43E8-95B4-3A75C91736A6}
|
||||||
|
{C7C8DE34-49D5-438F-85A0-1C028E9176FD} = {9F7EF36C-17BB-4F93-927E-F462FE3C9337}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {1D299D92-FA27-47A0-8D78-43D1FAFE7628}
|
SolutionGuid = {1D299D92-FA27-47A0-8D78-43D1FAFE7628}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,7 @@
|
||||||
using CloudGaming.Code.Account;
|
using CloudGaming.Code.Account;
|
||||||
using CloudGaming.Code.AppExtend;
|
|
||||||
using CloudGaming.Code.DataAccess;
|
|
||||||
using CloudGaming.DtoModel.Account.User;
|
using CloudGaming.DtoModel.Account.User;
|
||||||
using CloudGaming.DtoModel.Other;
|
using CloudGaming.DtoModel.Other;
|
||||||
|
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Channels;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using static SKIT.FlurlHttpClient.Wechat.TenpayV3.Models.CreateNewTaxControlFapiaoApplicationRequest.Types.Fapiao.Types;
|
|
||||||
|
|
||||||
namespace CloudGaming.Code.Monitor;
|
namespace CloudGaming.Code.Monitor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -202,9 +188,6 @@ public class MonitorBLL : CloudGamingBase
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<object>> GetCurrentOnlineUsers()
|
public async Task<List<object>> GetCurrentOnlineUsers()
|
||||||
{
|
{
|
||||||
//今日登录人数
|
|
||||||
//RedisCache.StringGet<>
|
|
||||||
//var todayLoggedInUsers = await cloudGamingBase.Dao.DaoExt.Context.T_User_LoginDay_Log.Where(it => it.CreateTimeDay == day).CountAsync();
|
|
||||||
var currentOnlineUsers = await RedisServerCache.ScanKeysAsync($"{AccountExtend.UserInfoRedisKeyPrefix}:*");
|
var currentOnlineUsers = await RedisServerCache.ScanKeysAsync($"{AccountExtend.UserInfoRedisKeyPrefix}:*");
|
||||||
//currentOnlineUsers.
|
//currentOnlineUsers.
|
||||||
List<object> userInfoCaches = new List<object>();
|
List<object> userInfoCaches = new List<object>();
|
||||||
|
|
@ -213,7 +196,7 @@ public class MonitorBLL : CloudGamingBase
|
||||||
var userInfoCache = await RedisCache.StringGetAsync<UserInfoCache>(userKey);
|
var userInfoCache = await RedisCache.StringGetAsync<UserInfoCache>(userKey);
|
||||||
if (userInfoCache != null)
|
if (userInfoCache != null)
|
||||||
{
|
{
|
||||||
userInfoCaches.Add(new { userInfoCache.UserId, userInfoCache.IsPay, userInfoCache.Diamond, userInfoCache.NickName, userInfoCache.PhoneNum });
|
userInfoCaches.Add(new { userInfoCache.UserId, userInfoCache.IsPay, userInfoCache.Diamond, userInfoCache.NickName, userInfoCache.PhoneNum, userInfoCache.DeviceNumber });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return userInfoCaches;
|
return userInfoCaches;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ using CloudGaming.DtoModel.Account.Login;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
//var jsopn = JsonConvert.SerializeObject(new PhoneLoginParams());
|
//var jsopn = JsonConvert.SerializeObject(new PhoneLoginParams());
|
||||||
//Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;
|
//Server=192.168.1.17;Database=CloudGamingUser;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;
|
||||||
//var optionsBuilder = new DbContextOptionsBuilder<CloudGamingPhoneContext>();
|
//var optionsBuilder = new DbContextOptionsBuilder<CloudGamingPhoneContext>();
|
||||||
//var option = optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options;
|
//var option = optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AlibabaCloud.SDK.Cloudauth20190307" Version="3.3.0" />
|
||||||
|
<PackageReference Include="EPPlus" Version="7.5.2" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
|
||||||
|
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Code\CloudGaming.Code\CloudGaming.Code.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Model\CloudGaming.AppConfigModel\CloudGaming.AppConfigModel.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Model\CloudGaming.DtoModel\CloudGaming.DtoModel.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Model\CloudGaming.GameModel\CloudGaming.GameModel.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Model\CloudGaming.Model\CloudGaming.Model.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Utile\HuanMeng.DotNetCore\HuanMeng.DotNetCore.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
469
src/CloudGaming/Console/CloudGaming.ImportGame/Program.cs
Normal file
469
src/CloudGaming/Console/CloudGaming.ImportGame/Program.cs
Normal file
|
|
@ -0,0 +1,469 @@
|
||||||
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
using CloudGaming.GameModel.Db.Db_Ext;
|
||||||
|
using CloudGaming.GameModel.Db.Db_Game;
|
||||||
|
using CloudGaming.Model.DbSqlServer.Db_Phone;
|
||||||
|
using CloudGaming.Model.DbSqlServer.Db_User;
|
||||||
|
|
||||||
|
using HuanMeng.DotNetCore.MultiTenant;
|
||||||
|
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
using OfficeOpenXml;
|
||||||
|
|
||||||
|
using StackExchange.Redis;
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
Console.WriteLine("Hello, World!");
|
||||||
|
// 设置 ExcelPackage 的许可
|
||||||
|
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||||
|
string directoryPath = "C:\\Users\\Administrator\\Pictures\\游戏运营配图\\";
|
||||||
|
string filePath = $"{directoryPath}游戏列表.xlsx";
|
||||||
|
|
||||||
|
// 确保文件存在
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
|
Console.WriteLine("文件不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var optionsBuilder1 = new DbContextOptionsBuilder<CloudGamingGameContext>();
|
||||||
|
var option1 = optionsBuilder1.UseSqlServer("Server=192.168.195.8;Database=CloudGamingGame;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options;
|
||||||
|
CloudGamingGameContext gameDao = new CloudGamingGameContext(option1);
|
||||||
|
var optionsBuilder3 = new DbContextOptionsBuilder<CloudGamingCBTContext>();
|
||||||
|
var option3 = optionsBuilder3.UseSqlServer("Server=192.168.195.8;Database=CloudGamingCBT;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options;
|
||||||
|
CloudGamingCBTContext cbtDao = new CloudGamingCBTContext(option3);
|
||||||
|
var imageId = (cbtDao.T_App_Image.Where(it => it.ImageId < 90000).Max(it => (int?)it.ImageId) ?? 0) + 1;
|
||||||
|
var optionsBuilder11 = new DbContextOptionsBuilder<CloudGamingPhoneContext>();
|
||||||
|
var option11 = optionsBuilder11.UseSqlServer("Server=192.168.195.8;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;").Options;
|
||||||
|
CloudGamingPhoneContext appDao = new CloudGamingPhoneContext(new TenantInfo()
|
||||||
|
{
|
||||||
|
Identifier = "default",
|
||||||
|
TenantId = Guid.Parse("6fba9c21-0de5-4734-a91e-f4961684d3d1")
|
||||||
|
}, option11);
|
||||||
|
//gameDao.T_Game_Tags;
|
||||||
|
var dir = Directory.GetDirectories(directoryPath);
|
||||||
|
List<tempGame> tempGames = new List<tempGame>();
|
||||||
|
using (var package = new ExcelPackage(new FileInfo(filePath)))
|
||||||
|
{
|
||||||
|
// 获取第一个工作表
|
||||||
|
var worksheet = package.Workbook.Worksheets[0];
|
||||||
|
|
||||||
|
// 获取总行数和总列数
|
||||||
|
int rowCount = worksheet.Dimension.Rows;
|
||||||
|
int colCount = worksheet.Dimension.Columns;
|
||||||
|
|
||||||
|
// 遍历单元格
|
||||||
|
for (int row = 2; row <= rowCount; row++)
|
||||||
|
{
|
||||||
|
|
||||||
|
tempGame tempGame = new tempGame();
|
||||||
|
tempGame.GameId = GetExcelCell(worksheet.Cells, row, 2);
|
||||||
|
tempGame.GameName = GetExcelCell(worksheet.Cells, row, 3);
|
||||||
|
tempGame.GameCloudId = GetExcelCell(worksheet.Cells, row, 4);
|
||||||
|
tempGame.GameIntroduce = GetExcelCell(worksheet.Cells, row, 5);
|
||||||
|
var gameType = GetExcelCell(worksheet.Cells, row, 6);
|
||||||
|
if (!string.IsNullOrEmpty(gameType))
|
||||||
|
{
|
||||||
|
tempGame.GameType = gameType.Split(',', ',');
|
||||||
|
}
|
||||||
|
var gameTag = GetExcelCell(worksheet.Cells, row, 7);
|
||||||
|
if (!string.IsNullOrEmpty(gameTag))
|
||||||
|
{
|
||||||
|
tempGame.GameTag = gameTag.Split(',', ',');
|
||||||
|
}
|
||||||
|
tempGame.Title2 = GetExcelCell(worksheet.Cells, row, 8);
|
||||||
|
tempGame.ConsumeDiamondNumHour = GetExcelCellInt(worksheet.Cells, row, 9);
|
||||||
|
tempGame.Score = GetExcelCell(worksheet.Cells, row, 10);
|
||||||
|
tempGame.GameLoadTime = GetExcelCellInt(worksheet.Cells, row, 11);
|
||||||
|
tempGame.fengxiangren = GetExcelCell(worksheet.Cells, row, 12);
|
||||||
|
string gameDir = dir.Where(it => it.Contains(tempGame.GameId)).FirstOrDefault();
|
||||||
|
//string gameDir = $"{directoryPath}\\{tempGame.GameId}_{tempGame.GameName}";
|
||||||
|
//if (!Directory.Exists(gameDir))
|
||||||
|
//{
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(gameDir))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{tempGame.GameId}{tempGame.GameName}==>文件夹不存在===》{gameDir}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!Directory.Exists(gameDir))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{tempGame.GameId}{tempGame.GameName}==>文件夹不存在===》{gameDir}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
tempGame.GameDir = gameDir;
|
||||||
|
tempGames.Add(tempGame);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Console.WriteLine("验证成功,开始导入数据...");
|
||||||
|
//Console.ReadKey();
|
||||||
|
List<string> tags = new List<string>();
|
||||||
|
Console.WriteLine("开始验证标签...");
|
||||||
|
tempGames.ForEach(it => tags.AddRange(it.GameTag));
|
||||||
|
tags = tags.Distinct().ToList();
|
||||||
|
var gameTags = gameDao.T_Game_Tags.ToList();
|
||||||
|
var notTags = tags.Where(it => !gameTags.Any(item => item.TagName == it)).ToList();
|
||||||
|
if (notTags != null && notTags.Count > 0)
|
||||||
|
{
|
||||||
|
var orderId = (gameTags.Max(it => (int?)it.OrderId) ?? 0) + 1;
|
||||||
|
var tagId = (gameTags.Max(it => (int?)it.TagId) ?? 0) + 1;
|
||||||
|
notTags.ForEach(t =>
|
||||||
|
{
|
||||||
|
//不在数据库中
|
||||||
|
T_Game_Tags t_Game_Tags = new T_Game_Tags()
|
||||||
|
{
|
||||||
|
CreatTime = DateTime.Now,
|
||||||
|
Desc = "",
|
||||||
|
IsOnline = true,
|
||||||
|
OrderId = orderId,
|
||||||
|
TagId = tagId,
|
||||||
|
TagName = t,
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
};
|
||||||
|
gameDao.Add(t_Game_Tags);
|
||||||
|
tagId++;
|
||||||
|
orderId++;
|
||||||
|
Console.WriteLine($"添加标签{t}==>tagId:{tagId}==>orderId:{orderId}");
|
||||||
|
});
|
||||||
|
gameDao.SaveChanges();
|
||||||
|
gameTags = gameDao.T_Game_Tags.ToList();
|
||||||
|
}
|
||||||
|
Console.WriteLine("开始验证类型...");
|
||||||
|
var gameTypes = gameDao.T_Game_Types.ToList();
|
||||||
|
List<string> types = new List<string>();
|
||||||
|
tempGames.ForEach(it => types.AddRange(it.GameType));
|
||||||
|
types = types.Distinct().ToList();
|
||||||
|
|
||||||
|
var notTypes = types.Where(it => !gameTypes.Any(item => item.TypeName == it)).ToList();
|
||||||
|
if (notTypes != null && notTypes.Count > 0)
|
||||||
|
{
|
||||||
|
var orderId = (gameTypes.Max(it => (int?)it.OrderId) ?? 0) + 1;
|
||||||
|
var TypeId = (gameTypes.Max(it => (int?)it.TypeId) ?? 0) + 1;
|
||||||
|
notTypes.ForEach(t =>
|
||||||
|
{
|
||||||
|
//不在数据库中
|
||||||
|
T_Game_Types t_Game_Tags = new T_Game_Types()
|
||||||
|
{
|
||||||
|
CreatTime = DateTime.Now,
|
||||||
|
IsOnline = true,
|
||||||
|
OrderId = orderId,
|
||||||
|
TypeId = TypeId,
|
||||||
|
TypeName = t,
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
TypeDetails = ""
|
||||||
|
};
|
||||||
|
gameDao.Add(t_Game_Tags);
|
||||||
|
TypeId++;
|
||||||
|
orderId++;
|
||||||
|
Console.WriteLine($"添加类型{t}==>tagId:{TypeId}==>orderId:{orderId}");
|
||||||
|
});
|
||||||
|
gameDao.SaveChanges();
|
||||||
|
gameTypes = gameDao.T_Game_Types.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
var gameChildList = gameDao.T_Game_ChildList.ToList();
|
||||||
|
|
||||||
|
Console.WriteLine($"标签和类型验证通过。。。");
|
||||||
|
//查询游戏
|
||||||
|
var gameCbt = appDao.T_GameCBT.ToList();
|
||||||
|
var gameList = gameDao.T_Game_List.ToList();
|
||||||
|
var gameOrderId = (gameList.Max(it => (int?)it.OrderId) ?? 0) + 1;
|
||||||
|
tempGames.ForEach((Action<tempGame>)(game =>
|
||||||
|
{
|
||||||
|
var gamel = gameList.FirstOrDefault(it => it.GameId == game.GameId);
|
||||||
|
if (gamel == null)
|
||||||
|
{
|
||||||
|
gamel = new T_Game_List()
|
||||||
|
{
|
||||||
|
GameId = game.GameId,
|
||||||
|
GameName = game.GameName,
|
||||||
|
GamePeopleNum = 1,
|
||||||
|
GameIsSaveFile = true,
|
||||||
|
GameIsCrack = false,
|
||||||
|
GameIsAdapter = true,
|
||||||
|
GameIsVersion = false,
|
||||||
|
GameCloudId = game.GameCloudId,
|
||||||
|
OrderId = gameOrderId,
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
Desc = "",
|
||||||
|
GameIntroduce = game.GameIntroduce,
|
||||||
|
ScreenOrientation = 0,
|
||||||
|
GameIsEditionNumber = false,
|
||||||
|
GameIsEditionMouse = true,
|
||||||
|
SteamId = "",
|
||||||
|
GameDifficulty = "",
|
||||||
|
GameIssuer = "",
|
||||||
|
DCompany = "",
|
||||||
|
GameOperationModel = "手机虚拟手柄,手柄"
|
||||||
|
};
|
||||||
|
gameOrderId++;
|
||||||
|
gameDao.Add(gamel);
|
||||||
|
gameList.Add(gamel);
|
||||||
|
}
|
||||||
|
gamel.GameIntroduce = game.GameIntroduce;
|
||||||
|
gamel.GameCloudId = game.GameCloudId;
|
||||||
|
gamel.GameName = game.GameName;
|
||||||
|
//添加游戏标签
|
||||||
|
//if(gameTypes)
|
||||||
|
var tempTypes = gameChildList.Where(it => it.GameId == game.GameId && it.ChildType == 1).ToList();
|
||||||
|
//先删除当前游戏所有的类型
|
||||||
|
if (tempTypes != null && tempTypes.Count > 0)
|
||||||
|
{
|
||||||
|
gameDao.RemoveRange(tempTypes);
|
||||||
|
}
|
||||||
|
if (game.GameType != null && game.GameType.Length > 0)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
foreach (var gameTypeName in game.GameType)
|
||||||
|
{
|
||||||
|
var g = gameTypes.FirstOrDefault(it => it.TypeName == gameTypeName);
|
||||||
|
if (g != null)
|
||||||
|
{
|
||||||
|
T_Game_ChildList cg = new T_Game_ChildList()
|
||||||
|
{
|
||||||
|
ChildId = g.TypeId,
|
||||||
|
ChildType = 1,
|
||||||
|
GameId = game.GameId,
|
||||||
|
OrderId = index,
|
||||||
|
Desc = ""
|
||||||
|
};
|
||||||
|
gameDao.Add(cg);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//游戏标签管理
|
||||||
|
var tempTags = gameChildList.Where(it => it.GameId == game.GameId && it.ChildType == 2).ToList();
|
||||||
|
//先删除当前游戏所有的标签
|
||||||
|
if (tempTags != null && tempTags.Count > 0)
|
||||||
|
{
|
||||||
|
gameDao.RemoveRange(tempTags);
|
||||||
|
}
|
||||||
|
if (game.GameTag != null && game.GameTag.Length > 0)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
foreach (var gameTagName in game.GameTag)
|
||||||
|
{
|
||||||
|
var g = gameTags.FirstOrDefault(it => it.TagName == gameTagName);
|
||||||
|
if (g != null)
|
||||||
|
{
|
||||||
|
T_Game_ChildList cg = new T_Game_ChildList()
|
||||||
|
{
|
||||||
|
ChildId = g.TagId,
|
||||||
|
ChildType = 2,
|
||||||
|
GameId = game.GameId,
|
||||||
|
OrderId = index,
|
||||||
|
Desc = ""
|
||||||
|
};
|
||||||
|
gameDao.Add(cg);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//添加游戏类型
|
||||||
|
gameDao.SaveChanges();
|
||||||
|
//添加配置表
|
||||||
|
var gameCbtOrderId = (gameCbt.Max(it => (int?)it.OrderId) ?? 0) + 1;
|
||||||
|
var gameCbt1 = gameCbt.FirstOrDefault(it => it.GameId == game.GameId);
|
||||||
|
if (gameCbt1 == null)
|
||||||
|
{
|
||||||
|
gameCbt1 = new T_GameCBT()
|
||||||
|
{
|
||||||
|
GameId = game.GameId,
|
||||||
|
IsOnline = true,
|
||||||
|
Score = game.Score,
|
||||||
|
OrderId = gameCbtOrderId,
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
Desc = "",
|
||||||
|
IsTest = false,
|
||||||
|
IsLimitToVip = false,
|
||||||
|
GameLoadTime = game.GameLoadTime,
|
||||||
|
Title2 = game.Title2,
|
||||||
|
GameName = game.GameName,
|
||||||
|
ImageId_Banner = 0,
|
||||||
|
ConsumeDiamondNumHour = game.ConsumeDiamondNumHour,
|
||||||
|
ConsumeDiamondNumHourVip = 0,
|
||||||
|
GameGroup = 0,
|
||||||
|
VipTypeLimit = 0,
|
||||||
|
VipVisible = false,
|
||||||
|
IsDiscount = false,
|
||||||
|
OnlinePlatform = "",
|
||||||
|
FriendlyTips = "",
|
||||||
|
TenantId = Guid.Parse("6fba9c21-0de5-4734-a91e-f4961684d3d1"),
|
||||||
|
GameLoadBgImageId = 0,
|
||||||
|
ImageIconId = 0,
|
||||||
|
GameBgImgId = 0,
|
||||||
|
ImageId_YXK = 0,
|
||||||
|
ImageId_ShouSuo = 0,
|
||||||
|
ImageId_RM = 0,
|
||||||
|
ImageId_FK = 0,
|
||||||
|
ImageId_TJ = 0,
|
||||||
|
};
|
||||||
|
appDao.Add(gameCbt1);
|
||||||
|
gameCbt.Add(gameCbt1);
|
||||||
|
}
|
||||||
|
//game.
|
||||||
|
gameCbt1.GameName = game.GameName;
|
||||||
|
gameCbt1.Title2 = game.Title2;
|
||||||
|
gameCbt1.GameLoadTime = game.GameLoadTime;
|
||||||
|
gameCbt1.ConsumeDiamondNumHour = game.ConsumeDiamondNumHour;
|
||||||
|
//cbtDao.T_App_Image
|
||||||
|
T_App_Image banner = AddImage(game, "banner.png");
|
||||||
|
T_App_Image biwan = AddImage(game, "biwan.png");
|
||||||
|
T_App_Image logo_1 = AddImage(game, "logo_1.png");
|
||||||
|
T_App_Image logo_2 = AddImage(game, "logo_2.png");
|
||||||
|
T_App_Image logo_3 = AddImage(game, "logo_3.png");
|
||||||
|
T_App_Image xilie = AddImage(game, "xilie.png");
|
||||||
|
T_App_Image youxiku = AddImage(game, "youxiku.png");
|
||||||
|
cbtDao.SaveChanges();
|
||||||
|
gameCbt1.ImageId_Banner = banner.ImageId;
|
||||||
|
gameCbt1.GameBgImgId = banner.ImageId;
|
||||||
|
gameCbt1.ImageIconId = logo_1.ImageId;
|
||||||
|
gameCbt1.ImageId_RM = logo_3.ImageId;
|
||||||
|
gameCbt1.ImageId_ShouSuo = logo_2.ImageId;
|
||||||
|
gameCbt1.ImageId_YXK = youxiku.ImageId;
|
||||||
|
gameCbt1.ImageId_FK = xilie.ImageId;
|
||||||
|
gameCbt1.ImageId_TJ = biwan.ImageId;
|
||||||
|
gameCbtOrderId++;
|
||||||
|
appDao.SaveChanges();
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
T_App_Image AddImage(tempGame game, string image)
|
||||||
|
{
|
||||||
|
var t_App_Image = new T_App_Image()
|
||||||
|
{
|
||||||
|
Type = 1,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
Language = "zh",
|
||||||
|
Name = game.GameName,
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
Url = $"cloudgame/images/game/{game.GameId}/{image}",
|
||||||
|
ImageId = imageId
|
||||||
|
};
|
||||||
|
imageId++;
|
||||||
|
cbtDao.T_App_Image.Add(t_App_Image);
|
||||||
|
return t_App_Image;
|
||||||
|
}
|
||||||
|
|
||||||
|
string GetExcelCell(ExcelRange excelRange, int row, int col)
|
||||||
|
{
|
||||||
|
return excelRange[row, col]?.Text ?? "";
|
||||||
|
}
|
||||||
|
int GetExcelCellInt(ExcelRange excelRange, int row, int col)
|
||||||
|
{
|
||||||
|
if (!int.TryParse(excelRange[row, col]?.Text ?? "0", out var c))
|
||||||
|
{
|
||||||
|
c = 0;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
class tempGame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏id
|
||||||
|
/// </summary>
|
||||||
|
public string GameId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏名称
|
||||||
|
/// </summary>
|
||||||
|
public string GameName { get; set; }
|
||||||
|
|
||||||
|
public string[] GameType { get; set; }
|
||||||
|
|
||||||
|
public string[] GameTag { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 云游戏Id
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? GameCloudId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏介绍
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? GameIntroduce { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏详情背景
|
||||||
|
/// </summary>
|
||||||
|
public virtual int GameBgImgId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 评分
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Score { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Desc { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏加载图
|
||||||
|
/// </summary>
|
||||||
|
public virtual int GameLoadBgImageId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏详情logo
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ImageIconId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loading时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual int GameLoadTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 推荐大图(首页蘑菇必玩 = 首页热血格斗 = 游戏详情页游戏推荐)
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ImageId_TJ { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 副标题
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Title2 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 顶部图片
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ImageId_Banner { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 每小时钻石费用
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ConsumeDiamondNumHour { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启动提示
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? FriendlyTips { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 游戏库Icon图
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ImageId_YXK { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 搜索icon
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ImageId_ShouSuo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 首页爆款热门
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ImageId_RM { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// (首页GTA系列)大方块
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ImageId_FK { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分享人
|
||||||
|
/// </summary>
|
||||||
|
public string fengxiangren { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string GameDir { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user