초기커밋
This commit is contained in:
86
GameServer/Contents/UserReport/Action/UserReportAction.cs
Normal file
86
GameServer/Contents/UserReport/Action/UserReportAction.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
using ServerCommon.BusinessLogDomain;
|
||||
|
||||
|
||||
using USER_GUID = System.String;
|
||||
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public class UserReportAction : EntityActionBase
|
||||
{
|
||||
public UserReportAction(Player owner)
|
||||
: base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
public override async Task<Result> onInit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
|
||||
var result = new Result();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void onClear()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public async Task<Result> UserReport(USER_GUID target_user_guid, string target_user_nickname, string req_reason, string req_title, string req_detail)
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var player = getOwner() as Player;
|
||||
NullReferenceCheckHelper.throwIfNull(player, () => $"player is null !!!");
|
||||
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var dynamo_db_client = server_logic.getDynamoDbClient();
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
var user_report_doc = new UserReportDoc(player.getUserGuid(), $"{now.ToString()}");
|
||||
var user_report_attrib = user_report_doc.getAttrib<UserReportAttrib>();
|
||||
NullReferenceCheckHelper.throwIfNull(user_report_attrib, () => $"user_report_attrib is null !!! - {player.toBasicString()}");
|
||||
|
||||
user_report_attrib.ReporterGuid = player.getUserGuid();
|
||||
user_report_attrib.ReporterNickName = player.getUserNickname();
|
||||
user_report_attrib.TargetGuid = target_user_guid;
|
||||
user_report_attrib.TargetNickName = target_user_nickname;
|
||||
user_report_attrib.Reason = req_reason;
|
||||
user_report_attrib.Title = req_title;
|
||||
user_report_attrib.Detail = req_detail;
|
||||
user_report_attrib.State = 1;
|
||||
user_report_attrib.CreateTime = now;
|
||||
|
||||
result = await dynamo_db_client.simpleUpsertDocumentWithDocType<UserReportDoc>(user_report_doc);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to simpleUpsertDocumentWithDocType<UserReportDoc> !!! : {user_report_doc.toBasicString()} - {player.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
var invokers = new List<ILogInvoker>();
|
||||
var log_action = new LogActionEx(LogActionType.UserReport);
|
||||
var userReportLogData = UserReportBusinessLogHelper.toLogInfo(user_report_attrib);
|
||||
invokers.Add(new UserReportBusinessLog(userReportLogData));
|
||||
BusinessLogger.collectLogs(log_action, player, invokers);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user