/// <summary> /// 实例化一个新的额外的直属高点号配额 /// </summary> /// <param name="model">额外的直属高点号配额的数据模型</param> public ExtraQuotaExport(ExtraQuota model) { this.Rebate = model.Rebate; this.Sum = model.Sum; }
/// <summary> /// 实例化一个新的用户信息 /// </summary> /// <param name="model">用户的数据模型</param> /// <param name="group">所属的用户组</param> /// <param name="systemQuotas">系统设置的高点号配额方案</param> public AuthorExport(Author model, UserGroup group, List<SystemQuotaDetail> systemQuotas) { this.Id = model.Id; this.Username = model.Username; this.Group = new UserGroupExport(group); this.Status = model.Status; this.CreatedTime = model.CreatedTime; this.LastLoginTime = model.LastLoginTime; this.LastLoginIp = model.LastLoginIp; this.LastLoginAddress = model.LastLoginAddress; this.Binding = new UserBindingExport(model.Binding); this.PlayInfo = new UserPlayInfoExport(model.PlayInfo); this.Money = model.Money; this.Money_Frozen = model.Money_Frozen; this.Consumption = model.Consumption; this.Integral = model.Integral; this.Subordinate = model.Subordinate; this.UserQuotas = systemQuotas.OrderByDescending(x => x.Rebate).ToList() .ConvertAll(sq => { ExtraQuota eq = model.ExtraQuotas.FirstOrDefault(x => x.Rebate == sq.Rebate); if (eq == null) { eq = new ExtraQuota(sq.Rebate, 0); } SubordinateData sd = model.SubordinateOfHighRebate.FirstOrDefault(x => x.Rebate == sq.Rebate); if (sd == null) { sd = new SubordinateData(sq.Rebate, 0); } int sum = sq.Sum + eq.Sum - sd.Sum; if (sum < 0) { sum = 0; } return new UserQuotaExport(sq.Rebate, sum); }); }