Files
hjha-server/ObjectModel/Backend/RewardModel.cs
xiaoou e9616125ce feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) +
game logic (GameFix/GameDAL/ServerData) +
network layer (NetWorkMessage) +
data layer (ObjectModel) +
utilities (MrWu/Core/Config/CloudAPI/dll) +
adapters (zyxAdapter/base)

.NET 8.0 C# solution, 16 projects, 958 source files
2026-07-07 12:02:15 +08:00

195 lines
5.3 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ObjectModel.Backend
{
/// <summary>
/// 推广奖励对象
/// </summary>
public class RewardModel
{
/// <summary>
/// id编号 主键 自增
/// </summary>
public int id;
/// <summary>
/// 玩家id或者后台Id
/// </summary>
public int userid;
/// <summary>
/// 变化的数值,按理说只有加,没有减
/// </summary>
public int num;
/// <summary>
/// 奖励类型 1首次游戏 2参赛 3充值
/// </summary>
public Byte type;
/// <summary>
/// 场景ID 1娱乐官 2休闲馆 3竞赛馆 4充值
/// </summary>
public Byte senceId;
/// <summary>
/// 是否领取0未领取 1领取过。
/// 因为红包券是存在redis里面。充值逻辑在数据库里面。所以才会有这种设计
/// 在查询玩家奖励列表的时候可以把为状态为0的奖励加到redis里面。并且修改状态。
/// </summary>
public byte lqstate;
/// <summary>
/// 产生时间
/// </summary>
public DateTime createDate;
/// <summary>
/// 产生数据的人
/// </summary>
public int fromUser;
/// <summary>
/// 0红包 1参赛卷
/// </summary>
public int numlx;
public RewardModel() { }
public RewardModel(DataRow row)
{
this.id = (int)row["id"];
this.userid = (int)row["userid"];
this.fromUser = (int)row["fromUser"];
this.num = (int)row["num"];
this.numlx = (int)row["numlx"];
this.type = (byte)row["type"];
this.senceId = (byte)row["senceId"];
this.lqstate = (byte)row["lqstate"];
this.createDate = (DateTime)row["createDate"];
}
public RewardModel(int userid, int num, byte type, byte senceId, int _fromUser,int numlx)
{
this.userid = userid;
this.num = num;
this.type = type;
this.senceId = senceId;
this.fromUser = _fromUser;
this.numlx = numlx;
}
/// <summary>
/// 获取插入语句SQL
/// </summary>
/// <returns></returns>
public string GetInsertSql()
{
if (!CheckData()) throw new ArgumentOutOfRangeException($"参数异常,userid:{userid} type:{type} senceId:{senceId}");
return $"INSERT INTO [Rewards]([userid], [num], [type], [senceId],fromUser,numlx) VALUES ({userid}, {num}, {type},{senceId} ,{fromUser},{numlx})";
}
/// <summary>
/// 校验数据
/// </summary>
/// <returns></returns>
public bool CheckData()
{
return userid > 0 && type > 0 && senceId > 0 && num > 0;
}
}
public class GetMyRewardsResponse : RewardModel
{
/// <summary>
/// 玩家昵称
/// </summary>
public string NickName;
/// <summary>
/// 注册时间
/// </summary>
public DateTime RegTime;
/// <summary>
/// 最后登录时间
/// </summary>
public DateTime LastLoginTime;
public GetMyRewardsResponse() { }
public GetMyRewardsResponse(DataRow row) : base(row)
{
this.LastLoginTime = (DateTime)row["LastLoginTime"];
this.RegTime = (DateTime)row["RegTime"];
this.NickName = row["NickName"].ToString();
}
}
/// <summary>
/// 推广玩家信息
/// </summary>
public class Promoter
{
/// <summary>
/// 玩家Id编号
/// </summary>
public int UserId;
/// <summary>
/// 昵称
/// </summary>
public string NickName;
/// <summary>
/// 推广人数
/// </summary>
public int RenCount;
/// <summary>
/// 推广奖励
/// </summary>
public int MoneyCount;
public Promoter() { }
public Promoter(DataRow row)
{
this.UserId = (int)row["userid"];
this.RenCount = DBNull.Value != row["rencount"] ? (int)row["rencount"] : 0;
this.MoneyCount = DBNull.Value != row["moneycount"] ? (int)row["moneycount"] : 0;
this.NickName = row["NickName"].ToString();
}
}
public class GroupByReward {
/// <summary>
/// 玩家userid编号
/// </summary>
public int UserId;
/// <summary>
/// 玩家昵称
/// </summary>
public string NickName;
/// <summary>
/// 产生的奖励值总和
/// </summary>
public int Money;
public GroupByReward() { }
public GroupByReward(DataRow row) {
this.UserId = (int)row["UserID"];
this.Money = (int)row["moneySum"];
this.NickName = row["NickName"].ToString();
}
}
}