/// <summary> /// 取一天的统计模型 /// </summary> /// <param name="date"></param> /// <returns></returns> public Model.VM_1DayTongJi Get1DayTongJiModel(DateTime date, int userid = 0) { DAL.LiushuiDAL lsdal = new DAL.LiushuiDAL(); DAL.QihaoinfoDAL qhdal = new DAL.QihaoinfoDAL(); DAL.XiazhuinfoDAL xzdal = new DAL.XiazhuinfoDAL(); Model.VM_1DayTongJi vm = new Model.VM_1DayTongJi() { date = date.ToString("yyyy-MM-dd"), zhong_count = xzdal.CalcCount(date, 0, userid), zhong_je = xzdal.GetGengDanJE(date, 0, userid), zhong_zjje = xzdal.GetZhongJiangJE(date, 0, userid), teshu_count = qhdal.GetTeShuCount(date), teshu_je = xzdal.GetTeShuJE(date, 0, userid), zhuangjia_count = xzdal.CalcCount(date, 1, userid), zhuangjia_je = xzdal.GetGengDanJE(date, 1, userid), zhuangjia_zjje = xzdal.GetZhongJiangJE(date, 1, userid), zhuangjia_teshu_count = xzdal.GetTeShuCount(date, 1, userid), zhuangjia_teshu_je = xzdal.GetTeShuJE(date, 1, userid), daban_count = xzdal.CalcCount(date, 2, userid), daban_je = xzdal.GetGengDanJE(date, 2, userid), daban_shouxufee = xzdal.GetShouXuFee(date, 2, userid), daban_zjje = xzdal.GetZhongJiangJE(date, 2, userid), daban_teshu_count = xzdal.GetTeShuCount(date, 2, userid), daban_teshu_je = xzdal.GetTeShuJE(date, 2, userid), xiaoban_count = xzdal.CalcCount(date, 3, userid), xiaoban_je = xzdal.GetGengDanJE(date, 3, userid), xiaoban_shouxufee = xzdal.GetShouXuFee(date, 3, userid), xiaoban_zjje = xzdal.GetZhongJiangJE(date, 3, userid), xiaoban_teshu_count = xzdal.GetTeShuCount(date, 3, userid), xiaoban_teshu_je = xzdal.GetTeShuJE(date, 3, userid), danban_count = xzdal.CalcCount(date, 4, userid), danban_je = xzdal.GetGengDanJE(date, 4, userid), danban_shouxufee = xzdal.GetShouXuFee(date, 4, userid), danban_zjje = xzdal.GetZhongJiangJE(date, 4, userid), danban_teshu_count = xzdal.GetTeShuCount(date, 4, userid), danban_teshu_je = xzdal.GetTeShuJE(date, 4, userid), shuangban_count = xzdal.CalcCount(date, 5, userid), shuangban_je = xzdal.GetGengDanJE(date, 5, userid), shuangban_shouxufee = xzdal.GetShouXuFee(date, 5, userid), shuangban_zjje = xzdal.GetZhongJiangJE(date, 5, userid), shuangban_teshu_count = xzdal.GetTeShuCount(date, 5, userid), shuangban_teshu_je = xzdal.GetTeShuJE(date, 5, userid), buchang_je = lsdal.GetBuChangJE(date, userid), lindianfanhuan_je = lsdal.GetFanHuan(date, userid), shangfen_je = lsdal.GetShangfenJE(date, userid), xiafen_je = lsdal.GetXiaFenJE(date, userid), }; return(vm); }
/// <summary> /// 取用户多天的统计模型 /// </summary> /// <param name="date"></param> /// <param name="userid"></param> /// <returns></returns> public Model.VM_User_1DayTongJi GetVMUserMoreDayTongJi(DateTime startdate, DateTime enddate, int userid) { string date1 = startdate.ToString("yyyy-MM-dd HH:mm:ss"); string date2 = enddate.ToString("yyyy-MM-dd HH:mm:ss"); DAL.XiazhuinfoDAL xzdal = new DAL.XiazhuinfoDAL(); DAL.LiushuiDAL lsdal = new DAL.LiushuiDAL(); Model.VM_User_1DayTongJi vm = new Model.VM_User_1DayTongJi() { date = $"{date1} ~ {date2}", zong_count = xzdal.CalcCount($"userid={userid} and iszj in (0,1,2) and kjtime>='{date1}' and kjtime<='{date2}' "), zong_je = xzdal.GetOneFiled_double("sum(buymoney+shouxufee)", $"userid={userid} and iszj in (0,1,2) and kjtime>='{date1}' and kjtime<='{date2}' "), zc_je = xzdal.GetOneFiled_double("sum(buymoney+shouxufee)", $"userid={userid} and iszj in (0,1) and kjtime>='{date1}' and kjtime<='{date2}' "), zc_count = xzdal.CalcCount($"userid={userid} and iszj=1 and kjtime>='{date1}' and kjtime<='{date2}' and kjcode<>'' "), zc_nocount = xzdal.CalcCount($"userid={userid} and iszj=0 and kjtime>='{date1}' and kjtime<='{date2}' and kjcode<>''"), zc_zjje = xzdal.GetOneFiled_double("sum(zjmoney)", $"userid={userid} and iszj=1 and kjtime>='{date1}' and kjtime<='{date2}' "), teshu_count = xzdal.CalcCount($"userid={userid} and iszj=2 and kjtime>='{date1}' and kjtime<='{date2}' and kjcode<>''"), teshu_je = xzdal.GetOneFiled_double("sum(zjmoney)", $"userid={userid} and iszj=2 and kjtime>='{date1}' and kjtime<='{date2}' "), teshu_gdje = xzdal.GetOneFiled_double("sum(buymoney)", $"userid={userid} and iszj=2 and kjtime>='{date1}' and kjtime<='{date2}' "), xiafen_je = lsdal.GetXiaFenJE(startdate, enddate, userid), yinkui = xzdal.GetOneFiled_double("sum(-(buymoney+shouxufee)+zjmoney)", $"userid={userid} and iszj in (0,1,2) and kjtime>='{date1}' and kjtime<='{date2}' and kjcode<>'' "), }; return(vm); }