示例#1
0
        public async Task <ApiResult <object> > UsersLoginCount()
        {
            var      res      = new ApiResult <object>();
            WelCount welCount = new WelCount();
            Lastweek lastweek = APIHelper.GetLastweek();//获取上星期八个时间戳

            if (LoginLogdb.GetCount(o => o.AddDate > lastweek.Mon && o.AddDate < lastweek.NextMon) > 0)
            {
                welCount.Count1 = LoginLogdb.GetCount(o => o.AddDate > lastweek.Mon && o.AddDate < lastweek.Tue);
                welCount.Count2 = LoginLogdb.GetCount(o => o.AddDate > lastweek.Tue && o.AddDate < lastweek.Wed);
                welCount.Count3 = LoginLogdb.GetCount(o => o.AddDate > lastweek.Wed && o.AddDate < lastweek.Thu);
                welCount.Count4 = LoginLogdb.GetCount(o => o.AddDate > lastweek.Thu && o.AddDate < lastweek.Fir);
                welCount.Count5 = LoginLogdb.GetCount(o => o.AddDate > lastweek.Fir && o.AddDate < lastweek.Sat);
                welCount.Count6 = LoginLogdb.GetCount(o => o.AddDate > lastweek.Sat && o.AddDate < lastweek.Sun);
                welCount.Count7 = LoginLogdb.GetCount(o => o.AddDate > lastweek.Sun && o.AddDate < lastweek.NextMon);
                res.data        = welCount;
                res.success     = true;
            }
            else
            {
                res.msg = "无用户登录数据";
            }
            return(await Task.Run(() => res));
        }