本文共 1763 字,大约阅读时间需要 5 分钟。
public object GetMyRelation() { var list = new List(); int directCount = 0, totalCount = 0, otherCount = 0, reward = 0; DbConnectionManipulator.RunMainDatabase(conn => { //直接好友 var directList = conn.Query ("select Id,Mobile,CreateTime from Member where PromoCode = @ID", new { ID = UserContext.GetMemberId() }).ToList(); //间接好友 int sumcount = 0; foreach(var model in directList) { if (model == null) continue; var count = conn.QueryFirstOrDefault ("select count(1) from Member where PromoCode = @ID", new { ID = model.Id }); sumcount += count; list.Add(new { Id = model.Id, Mobile = model.Mobile, CreateTime = model.CreateTime, Count = count }); } reward = conn.QueryFirstOrDefault ("select RewardIntegral from IntegralList where MemberId = @MemberId", new { MemberId = UserContext.GetMemberId() }); directCount = directList.Count; totalCount = sumcount + directCount; otherCount = sumcount; }); return new { list, directCount, totalCount, otherCount, reward }; }
转载于:https://www.cnblogs.com/storebook/p/8962880.html