Ejemplo n.º 1
0
        object ReportRetails_Users_Plat(string report_uid)
        {
            SetCacheEnable(false);
            string user_uid = ComFunc.nvl(TokenPayLoad["no"]);

            var up   = DB.NewDBUnitParameter();
            var list = (from t in DB.LamdaTable(up, "RetailSummaryPerDay", "a")
                        where t.uid == report_uid
                        select t).GetQueryList(up);

            if (list.Count <= 0)
            {
                return(new
                {
                    code = "failed",
                    msg = "没有该报表的资料"
                });
            }
            dynamic info = list.First();
            var     dt   = DateTimeStd.IsDateTimeThen(info.log_time, "yyyy-MM-dd");
            var     s    = from t in DB.LamdaTable(up, "APPExchange", "a")
                           join t2 in DB.LamdaTable(up, "UserInfo", "b").LeftJoin() on t.mobile equals t2.mobile
                           where t2.recommend_uid == info.retail_uid && t.log_time >= $"{dt} 00:00:00" && t.log_time <= $"{dt} 23:59:59"
                           select new
            {
                t.log_time,
                t.mobile,
                t2.name,
                t.is_deal,
                t.is_register,
                t.is_perfection,
                t.deal_amount
            };
            var result = s.QueryByPage(up, "log_time desc");
            var tdata  = from t in result.QueryData <FrameDLRObject>()
                         select new
            {
                log_time      = DateTimeStd.IsDateTimeThen(t.log_time, "yyyy-MM-dd HH:mm:ss"),
                mobile        = ComFunc.nvl(t.mobile),
                name          = ComFunc.nvl(t.name).Length > 0 ? ComFunc.AESDecrypt(ComFunc.nvl(t.name)) : "",
                is_deal       = BoolStd.IsNotBoolThen(t.is_deal),
                is_register   = BoolStd.IsNotBoolThen(t.is_register),
                is_perfection = BoolStd.IsNotBoolThen(t.is_perfection),
                t.deal_amount
            };

            return(new
            {
                code = "success",
                msg = "",
                total_count = result.TotalRow,
                page = result.CurrentPage,
                total_page = result.TotalPage,
                limit = result.Count_Of_OnePage,
                data = from t in tdata
                       select new
                {
                    t.log_time,
                    mobile = ComFunc.nvl(t.mobile).Length > 3 ? $"{ ComFunc.nvl(t.mobile).Substring(0, 3)}***{ComFunc.nvl(t.mobile).Substring(ComFunc.nvl(t.mobile).Length - 2, 2)}" : "",
                    name = $"{(ComFunc.nvl(t.name).Length > 0 ? ComFunc.nvl(t.name).Substring(0, 1) : "")}***",
                    t.is_deal,
                    t.is_register,
                    t.is_perfection,
                    t.deal_amount
                }
            });
        }