统计功能
This commit is contained in:
parent
2e71774bf5
commit
208653f9a9
@ -2,8 +2,10 @@
|
|||||||
using AxibugEmuOnline.Server.Manager;
|
using AxibugEmuOnline.Server.Manager;
|
||||||
using AxibugEmuOnline.Server.NetWork;
|
using AxibugEmuOnline.Server.NetWork;
|
||||||
using AxibugProtobuf;
|
using AxibugProtobuf;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Policy;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Server
|
namespace AxibugEmuOnline.Server
|
||||||
{
|
{
|
||||||
@ -93,6 +95,48 @@ namespace AxibugEmuOnline.Server
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region
|
||||||
|
|
||||||
|
public enum RoomLogType
|
||||||
|
{
|
||||||
|
Create = 0,
|
||||||
|
Join = 1,
|
||||||
|
Leave = 2
|
||||||
|
}
|
||||||
|
public void RoomLog(long uid, int platform, int RoomID, int RomID, RoomLogType state)
|
||||||
|
{
|
||||||
|
MySqlConnection conn = Haoyue_SQLPoolManager.DequeueSQLConn("ModifyNikeName");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string query = "INSERT INTO `haoyue_emu`.`room_log` (`uid`, `platform`, `romid`,`roomid`, `state`) VALUES ( ?uid, ?platform, ?romid, ?roomid, ?state);";
|
||||||
|
using (var command = new MySqlCommand(query, conn))
|
||||||
|
{
|
||||||
|
// 设置参数值
|
||||||
|
command.Parameters.AddWithValue("?uid", uid);
|
||||||
|
command.Parameters.AddWithValue("?platform", platform);
|
||||||
|
command.Parameters.AddWithValue("?romid", RomID);
|
||||||
|
command.Parameters.AddWithValue("?roomid", RoomID);
|
||||||
|
command.Parameters.AddWithValue("?state", state);
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == RoomLogType.Join)
|
||||||
|
{
|
||||||
|
query = "update romlist_nes set playcount = playcount + 1 where id = ?romid";
|
||||||
|
using (var command = new MySqlCommand(query, conn))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("?romid", RomID);
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Haoyue_SQLPoolManager.EnqueueSQLConn(conn);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
private Protobuf_Room_MiniInfo GetProtoDataRoom(Data_RoomData room)
|
private Protobuf_Room_MiniInfo GetProtoDataRoom(Data_RoomData room)
|
||||||
{
|
{
|
||||||
Protobuf_Room_MiniInfo result = new Protobuf_Room_MiniInfo()
|
Protobuf_Room_MiniInfo result = new Protobuf_Room_MiniInfo()
|
||||||
@ -202,6 +246,8 @@ namespace AxibugEmuOnline.Server
|
|||||||
SendRoomStepChange(newRoom);
|
SendRoomStepChange(newRoom);
|
||||||
|
|
||||||
SendRoomUpdateToAll(newRoom.RoomID, 0);
|
SendRoomUpdateToAll(newRoom.RoomID, 0);
|
||||||
|
|
||||||
|
RoomLog(_c.UID, 1, newRoom.RoomID, newRoom.GameRomID, RoomLogType.Create);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnCmdRoomJoin(Socket sk, byte[] reqData)
|
public void OnCmdRoomJoin(Socket sk, byte[] reqData)
|
||||||
@ -240,6 +286,7 @@ namespace AxibugEmuOnline.Server
|
|||||||
SendRoomUpdateToAll(room.RoomID, 0);
|
SendRoomUpdateToAll(room.RoomID, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RoomLog(_c.UID, 1, room.RoomID, room.GameRomID, RoomLogType.Join);
|
||||||
}
|
}
|
||||||
public void OnCmdRoomLeave(Socket sk, byte[] reqData)
|
public void OnCmdRoomLeave(Socket sk, byte[] reqData)
|
||||||
{
|
{
|
||||||
@ -304,6 +351,8 @@ namespace AxibugEmuOnline.Server
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
SendRoomUpdateToAll(room.RoomID, 0);
|
SendRoomUpdateToAll(room.RoomID, 0);
|
||||||
|
|
||||||
|
RoomLog(_c.UID,1,room.RoomID,room.GameRomID,RoomLogType.Leave);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnHostPlayerUpdateStateRaw(Socket sk, byte[] reqData)
|
public void OnHostPlayerUpdateStateRaw(Socket sk, byte[] reqData)
|
||||||
@ -910,7 +959,7 @@ namespace AxibugEmuOnline.Server
|
|||||||
this.ScreenRaw = NextStateRaw;
|
this.ScreenRaw = NextStateRaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetNeedForwardTick(uint clientFrame,out long forwaFrame)
|
public bool GetNeedForwardTick(uint clientFrame, out long forwaFrame)
|
||||||
{
|
{
|
||||||
forwaFrame = 0;
|
forwaFrame = 0;
|
||||||
//目标帧,客户端+服务器提前量
|
//目标帧,客户端+服务器提前量
|
||||||
|
Loading…
Reference in New Issue
Block a user