예제 #1
0
        public void MyDefault()
        {
            if (!base.IsLogin)
            {
                Redirect("/index.html");
            }

            SystemService sysService = Context.GetService <SystemService>();
            DocService    ds         = Context.GetService <DocService>();
            OrderService  os         = Context.GetService <OrderService>();

            PropertyBag["firstCatalog"] = sysService.SCatalogBll.GetTopNode();
            //大家在阅读什么
            IList <DDocInfo> hotList = ds.DDocInfoBll.GetHotList(0, 12);

            PropertyBag["hotList"] = hotList;

            //最新文档
            PropertyBag["newList"] = ds.DDocInfoBll.GetNewList(0, 10);

            //阅读top 10
            //同hotList


            //新闻公告(3条系统公告)
            Service.Bll.User.M_MessageBLL msgBll = new TMM.Service.Bll.User.M_MessageBLL();
            IList <M_Message>             mlist  = msgBll.GetSysMessageList(0, 3);

            mlist.ToList().ForEach(m => m.Content = m.Content.ReplaceEnterStr());
            PropertyBag["messages"] = mlist;

            UserService us = Context.GetService <UserService>();
            U_UserInfo  u  = base.GetUser();

            //账户余额
            PropertyBag["accountBalance"] = us.MAccountBll.GetByUserId(u.UserId).Amount;
            //最近账单
            PropertyBag["billList"] = os.MAccountLogBll.GetList(u.UserId, 0, 3);
            //可能喜欢的文档
            //获取最近一条购买记录
            IList <MPurchase> purchaseList = us.MPurchaseBll.GetList(u.UserId, 0, 1);

            if (purchaseList == null || purchaseList.Count == 0)
            {
                PropertyBag["maybeLikeList"] = ds.DDocInfoBll.GetRecommendList(0, 12);
            }
            else
            {
                MPurchase         mp = purchaseList[0];
                Core.Search.Index si = new TMM.Core.Search.Index();
                si.TableName = "vwDocInfo";
                ArrayList maybeLike = si.SearchMaybeLike(mp.Title, 0, 12, mp.DocId);
                if (maybeLike.Count < 12)
                {
                    maybeLike.AddRange(ds.DDocInfoBll.GetRecommendList(0, 12 - maybeLike.Count).ToArray());
                }
                PropertyBag["maybeLikeList"] = maybeLike;
            }
            RenderView("LogonDefault");
        }
예제 #2
0
        public void Default()
        {
            SystemService sysService = Context.GetService <SystemService>();
            DocService    ds         = Context.GetService <DocService>();
            OrderService  os         = Context.GetService <OrderService>();

            PropertyBag["firstCatalog"] = sysService.SCatalogBll.GetTopNode();
            //大家在阅读什么
            IList <DDocInfo> hotList = ds.DDocInfoBll.GetHotList(0, 12);

            PropertyBag["hotList"] = hotList;
            //精选文档
            PropertyBag["recommendList"] = ds.DDocInfoBll.GetRecommendList(0, 10);
            //最新文档
            PropertyBag["newList"] = ds.DDocInfoBll.GetNewList(0, 10);
            //最新悬赏top 10
            PropertyBag["rewardList"] = ds.TReqDocBll.GetList(0, 10, "CreateTime DESC");
            //阅读top 10
            //同hotList

            //tags
            IList <D_Tag> tags = ds.DTagBll.GetList(null, "UseCount Desc", 0, 15);
            var           t    = from tag in tags.ToList() orderby tag.TagId descending
                                 select tag;

            if (t != null && t.Count() > 0)
            {
                int maxUseCount = t.Max(tt => tt.UseCount);
                int minUseCount = t.Min(tt => tt.UseCount);
                t.ToList().ForEach(g =>
                {
                    if (g.UseCount == maxUseCount)
                    {
                        g.TagWeight = 1;
                    }
                    else if (g.UseCount == minUseCount)
                    {
                        g.TagWeight = 0;
                    }
                    else
                    {
                        g.TagWeight = Math.Round((decimal)g.UseCount / maxUseCount, 2);
                    }
                });
                PropertyBag["tags"] = t;
            }
            //新闻公告(3条系统公告)
            Service.Bll.User.M_MessageBLL msgBll = new TMM.Service.Bll.User.M_MessageBLL();
            IList <M_Message>             mlist  = msgBll.GetSysMessageList(0, 3);

            mlist.ToList().ForEach(m => m.Content = m.Content.ReplaceEnterStr());
            PropertyBag["messages"] = mlist;
            //最近兑换
            PropertyBag["exchangeList"] = os.TOrderBll.GetListForExchange(0, 6);
        }
예제 #3
0
 private void InsertMsg()
 {
     Service.Bll.User.M_MessageBLL bll = new TMM.Service.Bll.User.M_MessageBLL();
     if (messages != null)
     {
         foreach (M_Message msg in messages)
         {
             bll.Insert(msg);
             Thread.Sleep(100);
         }
     }
 }
예제 #4
0
 private void InsertMsg()
 {
     Service.Bll.User.M_MessageBLL bll = new TMM.Service.Bll.User.M_MessageBLL();
     if (messages != null)
     {
         foreach (M_Message msg in messages)
         {
             bll.Insert(msg);
             Thread.Sleep(100);
         }
     }
 }
예제 #5
0
        public void Default()
        {
            SystemService sysService = Context.GetService<SystemService>();
            DocService ds = Context.GetService<DocService>();
            OrderService os = Context.GetService<OrderService>();

            PropertyBag["firstCatalog"] = sysService.SCatalogBll.GetTopNode();
            //大家在阅读什么
            IList<DDocInfo> hotList = ds.DDocInfoBll.GetHotList(0, 12);
            PropertyBag["hotList"] = hotList;
            //精选文档
            PropertyBag["recommendList"] = ds.DDocInfoBll.GetRecommendList(0, 10);
            //最新文档
            PropertyBag["newList"] = ds.DDocInfoBll.GetNewList(0, 10);
            //最新悬赏top 10
            PropertyBag["rewardList"] = ds.TReqDocBll.GetList(0, 10, "CreateTime DESC");
            //阅读top 10
            //同hotList

            //tags
            IList<D_Tag> tags = ds.DTagBll.GetList(null, "UseCount Desc", 0, 15);
            var t = from tag in tags.ToList() orderby tag.TagId descending
                        select tag;
            if (t != null && t.Count()>0)
            {
                int maxUseCount = t.Max(tt => tt.UseCount);
                int minUseCount = t.Min(tt => tt.UseCount);
                t.ToList().ForEach(g =>
                {
                    if (g.UseCount == maxUseCount)
                    {
                        g.TagWeight = 1;
                    }
                    else if (g.UseCount == minUseCount)
                    {
                        g.TagWeight = 0;
                    }
                    else
                    {
                        g.TagWeight = Math.Round((decimal)g.UseCount / maxUseCount, 2);
                    }
                });
                PropertyBag["tags"] = t;
            }
            //新闻公告(3条系统公告)
            Service.Bll.User.M_MessageBLL msgBll = new TMM.Service.Bll.User.M_MessageBLL();
            IList<M_Message> mlist = msgBll.GetSysMessageList(0, 3);
            mlist.ToList().ForEach(m => m.Content=m.Content.ReplaceEnterStr());
            PropertyBag["messages"] = mlist;
            //最近兑换
            PropertyBag["exchangeList"] = os.TOrderBll.GetListForExchange(0, 6);
        }
예제 #6
0
파일: UserService.cs 프로젝트: uvbs/tumumi
 public void Initialize()
 {
     UserInfoBll   = new TMM.Service.Bll.User.U_UserInfoBLL();
     MessageBll    = new TMM.Service.Bll.User.M_MessageBLL();
     DocInfoBll    = new TMM.Service.Bll.Doc.DDocInfoBLL();
     MCatalogBll   = new TMM.Service.Bll.Doc.MCatalogBLL();
     MFavoriteBll  = new TMM.Service.Bll.Doc.MFavoriteBLL();
     DTagBll       = new TMM.Service.Bll.Doc.D_TagBLL();
     MPurchaseBll  = new TMM.Service.Bll.User.MPurchaseBLL();
     MAccountBll   = new TMM.Service.Bll.User.MAccountBLL();
     TReqDocBll    = new TMM.Service.Bll.Doc.TReqDocBLL();
     AccountLogBll = new TMM.Service.Bll.Order.AccountLogBLL();
 }
예제 #7
0
        public void DoExchange(decimal orderId)
        {
            OrderService os = Context.GetService <OrderService>();
            TOrder       o  = os.TOrderBll.Get(orderId);

            o.Status     = (int)OrderStatus.AdminDoExchange;
            o.UpdateTime = DateTime.Now;
            os.TOrderBll.Update(o);
            //写账户日志
            AccountLog accLog = new AccountLog()
            {
                AccountWay  = (int)AmountWay.EOut,
                Amount      = -o.Total,
                CreateTime  = DateTime.Now,
                Ip          = Utils.TmmUtils.IPAddress(),
                OrderId     = o.OrderId,
                UserId      = o.UserId,
                PayWay      = 0,
                AdminRemark = "兑换"
            };

            os.MAccountLogBll.Insert(accLog);
            //更新账户信息
            MAccount acc = os.MAccountBll.GetByUserId(o.UserId);

            acc.FrozenAmount  -= o.Total;
            acc.TotalExchange += o.Total;
            acc.UpdateTime     = DateTime.Now;
            os.MAccountBll.Update(acc);
            //发系统消息
            M_Message msg = new M_Message()
            {
                SenderId   = Helper.ConfigHelper.AdminUserId,
                RecieverId = o.UserId,
                CreateTime = DateTime.Now,
                IsRead     = false,
                Mtype      = (int)Model.Enums.MessageType.Inform,
                Title      = "您的兑换申请已经被受理",
                Content    = string.Format("您的兑换申请已被管理员受理,请注意查收您的{0}账号", o.Remark == "1" ? "支付宝" : "银行")
            };

            Service.Bll.User.M_MessageBLL msgBll = new TMM.Service.Bll.User.M_MessageBLL();
            msgBll.Insert(msg);
            base.SuccessInfo();
            RedirectToReferrer();
        }
예제 #8
0
        /// <summary>
        /// 支付成功后给上传人返利
        /// </summary>
        protected void AddAmountForUploader(
            decimal orderId, int uploaderId, decimal amount,
            OrderService os, int docId, string docTitle, int buyerId, int payway)
        {
            //先写入账户日志
            AccountLog al = new AccountLog()
            {
                OrderId    = orderId,
                UserId     = uploaderId,
                Amount     = amount,
                AccountWay = (int)AmountWay.INCOME,
                Ip         = Utils.TmmUtils.IPAddress(),
                PayWay     = payway
            };
            int a = os.MAccountLogBll.Insert(al);

            //账户增加收入
            if (a > 0)
            {
                os.MAccountBll.AddAmount(uploaderId, amount);
            }
            //发送系统通知
            string tmp = "您的文档<a href='/p-{0}.html' target='_blank'>{1}</a>"
                         + "被<a href='/home/{2}.html' target='_blank'>{3}</a>下载,获得收入¥{4}";
            M_Message msg = new M_Message()
            {
                SenderId   = Helper.ConfigHelper.AdminUserId,
                Title      = "恭喜您获得文档销售收入",
                CreateTime = DateTime.Now,
                Content    = string.Format(tmp, docId, docTitle, buyerId, Helper.UserHelper.GetUserById(buyerId).TmmDispName, amount),
                IsRead     = false,
                Mtype      = (int)Model.Enums.MessageType.Inform,
                RecieverId = uploaderId
            };

            Service.Bll.User.M_MessageBLL mbll = new TMM.Service.Bll.User.M_MessageBLL();
            mbll.Insert(msg);
        }
예제 #9
0
        public void MyDefault()
        {
            if (!base.IsLogin)
                Redirect("/index.html");

            SystemService sysService = Context.GetService<SystemService>();
            DocService ds = Context.GetService<DocService>();
            OrderService os = Context.GetService<OrderService>();

            PropertyBag["firstCatalog"] = sysService.SCatalogBll.GetTopNode();
            //大家在阅读什么
            IList<DDocInfo> hotList = ds.DDocInfoBll.GetHotList(0, 12);
            PropertyBag["hotList"] = hotList;

            //最新文档
            PropertyBag["newList"] = ds.DDocInfoBll.GetNewList(0, 10);

            //阅读top 10
            //同hotList

            //新闻公告(3条系统公告)
            Service.Bll.User.M_MessageBLL msgBll = new TMM.Service.Bll.User.M_MessageBLL();
            IList<M_Message> mlist = msgBll.GetSysMessageList(0, 3);
            mlist.ToList().ForEach(m => m.Content = m.Content.ReplaceEnterStr());
            PropertyBag["messages"] = mlist;

            UserService us = Context.GetService<UserService>();
            U_UserInfo u = base.GetUser();
            //账户余额
            PropertyBag["accountBalance"] = us.MAccountBll.GetByUserId(u.UserId).Amount;
            //最近账单
            PropertyBag["billList"] = os.MAccountLogBll.GetList(u.UserId, 0, 3);
            //可能喜欢的文档
            //获取最近一条购买记录
            IList<MPurchase> purchaseList = us.MPurchaseBll.GetList(u.UserId, 0, 1);
            if (purchaseList == null || purchaseList.Count == 0)
            {
                PropertyBag["maybeLikeList"] = ds.DDocInfoBll.GetRecommendList(0, 12);
            }
            else
            {
                MPurchase mp = purchaseList[0];
                Core.Search.Index si = new TMM.Core.Search.Index();
                si.TableName = "vwDocInfo";
                ArrayList maybeLike = si.SearchMaybeLike(mp.Title, 0, 12, mp.DocId);
                if (maybeLike.Count < 12)
                {
                    maybeLike.AddRange(ds.DDocInfoBll.GetRecommendList(0, 12 - maybeLike.Count).ToArray());
                }
                PropertyBag["maybeLikeList"] = maybeLike;
            }
            RenderView("LogonDefault");
        }
예제 #10
0
 public void Initialize()
 {
     ManageUserBll = new ManageUserBLL();
     MessageBll    = new TMM.Service.Bll.User.M_MessageBLL();
 }
예제 #11
0
 public void DoExchange(decimal orderId)
 {
     OrderService os = Context.GetService<OrderService>();
     TOrder o = os.TOrderBll.Get(orderId);
     o.Status = (int)OrderStatus.AdminDoExchange;
     o.UpdateTime = DateTime.Now;
     os.TOrderBll.Update(o);
     //写账户日志
     AccountLog accLog = new AccountLog() {
         AccountWay = (int)AmountWay.EOut,
         Amount = -o.Total,
         CreateTime = DateTime.Now,
         Ip = Utils.TmmUtils.IPAddress(),
         OrderId = o.OrderId,
         UserId = o.UserId,
         PayWay = 0,
         AdminRemark = "兑换"
     };
     os.MAccountLogBll.Insert(accLog);
     //更新账户信息
     MAccount acc = os.MAccountBll.GetByUserId(o.UserId);
     acc.FrozenAmount -= o.Total;
     acc.TotalExchange += o.Total;
     acc.UpdateTime = DateTime.Now;
     os.MAccountBll.Update(acc);
     //发系统消息
     M_Message msg = new M_Message() {
         SenderId = Helper.ConfigHelper.AdminUserId,
         RecieverId = o.UserId,
         CreateTime = DateTime.Now,
         IsRead = false,
         Mtype = (int)Model.Enums.MessageType.Inform,
         Title = "您的兑换申请已经被受理",
         Content = string.Format("您的兑换申请已被管理员受理,请注意查收您的{0}账号",o.Remark == "1" ? "支付宝" : "银行")
     };
     Service.Bll.User.M_MessageBLL msgBll = new TMM.Service.Bll.User.M_MessageBLL();
     msgBll.Insert(msg);
     base.SuccessInfo();
     RedirectToReferrer();
 }
예제 #12
0
 /// <summary>
 /// 支付成功后给上传人返利
 /// </summary>
 protected void AddAmountForUploader(
     decimal orderId,int uploaderId,decimal amount,
     OrderService os,int docId,string docTitle,int buyerId,int payway)
 {
     //先写入账户日志
     AccountLog al = new AccountLog() {
         OrderId = orderId,
         UserId = uploaderId,
         Amount = amount,
         AccountWay = (int)AmountWay.INCOME,
         Ip = Utils.TmmUtils.IPAddress(),
         PayWay = payway
     };
     int a = os.MAccountLogBll.Insert(al);
     //账户增加收入
     if (a > 0) {
         os.MAccountBll.AddAmount(uploaderId, amount);
     }
     //发送系统通知
     string tmp = "您的文档<a href='/p-{0}.html' target='_blank'>{1}</a>"
         + "被<a href='/home/{2}.html' target='_blank'>{3}</a>下载,获得收入¥{4}";
     M_Message msg = new M_Message() {
         SenderId = Helper.ConfigHelper.AdminUserId,
         Title = "恭喜您获得文档销售收入",
         CreateTime = DateTime.Now,
         Content = string.Format(tmp,docId,docTitle,buyerId,Helper.UserHelper.GetUserById(buyerId).TmmDispName,amount),
         IsRead = false,
         Mtype = (int)Model.Enums.MessageType.Inform,
         RecieverId = uploaderId
     };
     Service.Bll.User.M_MessageBLL mbll = new TMM.Service.Bll.User.M_MessageBLL();
     mbll.Insert(msg);
 }