Пример #1
0
        /// <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);
        }
Пример #2
0
        //推荐图谱-取数据
        public ActionResult TJTuPu_Ajax(int?id)
        {
            ArrayList arr = new ArrayList();

            if (id == null)
            {
                //取顶级
                List <Model.Userinfo> list_u = dal.GetListArray("parentid=0");
                foreach (var u in list_u)
                {
                    int    xjcount         = dal.CalcCount($"parentpath like '%,{u.id},%'");
                    string state           = xjcount == 0 ? "open" : "closed";
                    Model.VM_1DayTongJi vm = xzdal.Get1DayTongJiModel(DateTime.Now, u.id);
                    arr.Add(new
                    {
                        id       = u.id,
                        username = u.username,
                        regdate  = u.createtime.ToString("yyyy-MM-dd"),
                        balance  = u.balance,
                        today_tz = vm.zhong_je,
                        today_zj = vm.zhong_zjje,
                        xjcount  = xjcount,
                        state    = state,
                        op       = $"<a target='_blank' href='/Adnn1n/TongJi/ShowMX_User?userid={u.id}&startdate={DateTime.Now.ToString("yyyy-MM-dd")}&enddate={DateTime.Now.ToString("yyyy-MM-dd")}'>详情</a>",
                    });
                }
            }
            else
            {
                //根据ID取下一级
                List <Model.Userinfo> list_u = dal.GetListArray($"parentid={id.Value}");
                foreach (var u in list_u)
                {
                    int    xjcount         = dal.CalcCount($"parentpath like '%,{u.id},%'");
                    string state           = xjcount == 0 ? "open" : "closed";
                    Model.VM_1DayTongJi vm = xzdal.Get1DayTongJiModel(DateTime.Now, u.id);
                    arr.Add(new
                    {
                        id       = u.id,
                        username = u.username,
                        regdate  = u.createtime.ToString("yyyy-MM-dd"),
                        balance  = u.balance,
                        today_tz = vm.zhong_je,
                        today_zj = vm.zhong_zjje,
                        xjcount  = xjcount,
                        state    = state,
                        op       = $"<a  target='_blank' href='/Adnn1n/TongJi/ShowMX_User?userid={u.id}&startdate={DateTime.Now.ToString("yyyy-MM-dd")}&enddate={DateTime.Now.ToString("yyyy-MM-dd")}'>详情</a>",
                    });
                }
            }
            return(Json(arr));
        }
Пример #3
0
        /// <summary>
        /// 发统计邮件
        /// </summary>
        /// <returns></returns>
        public string FaTongJi(DateTime date, string front = "")
        {
            DAL.XiazhuinfoDAL xzdal = new XiazhuinfoDAL();

            //股东表里的才发邮件
            List <Model.Gudong> list = new DAL.GudongDAL().GetListArray("");

            //测试
            //   List<Model.Gudong> list = new DAL.GudongDAL().GetListArray("username='******'");

            Model.VM_1DayTongJi vm = xzdal.Get1DayTongJiModel(date);

            StringBuilder sb = new StringBuilder();



            sb.Append("<table border='1'>");
            sb.Append("<tr>");
            sb.Append($"<td>日期</td>");
            sb.Append($"<td>{vm.date}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>跟单次数</td>");
            sb.Append($"<td>{vm.zhong_count}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>跟单总金额</td>");
            sb.Append($"<td>{vm.zhong_je}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>中奖总金额</td>");
            sb.Append($"<td>{vm.zhong_zjje}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>本日特殊号期数</td>");
            sb.Append($"<td>{vm.teshu_count}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>特殊中返还总额</td>");
            sb.Append($"<td>{vm.teshu_je}</td>");

            sb.Append("</tr><tr>");
            sb.Append($"<td>专家版跟单数</td>");
            sb.Append($"<td>{vm.zhuangjia_count}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>专家版跟单总额</td>");
            sb.Append($"<td>{vm.zhuangjia_je}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>专家版中奖额</td>");
            sb.Append($"<td>{vm.zhuangjia_zjje}</td>");

            sb.Append("</tr><tr>");
            sb.Append($"<td>大版跟单数</td>");
            sb.Append($"<td>{vm.daban_count}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>大版跟单总额</td>");
            sb.Append($"<td>{vm.daban_je}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>大版手续费总额</td>");
            sb.Append($"<td>{vm.daban_shouxufee}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>大版中奖总额</td>");
            sb.Append($"<td>{vm.daban_zjje}</td>");

            sb.Append("</tr><tr>");
            sb.Append($"<td>小版跟单数</td>");
            sb.Append($"<td>{vm.xiaoban_count}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>小版跟单总额</td>");
            sb.Append($"<td>{vm.xiaoban_je}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>小版手续费总额</td>");
            sb.Append($"<td>{vm.xiaoban_shouxufee}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>小版中奖总额</td>");
            sb.Append($"<td>{vm.daban_zjje}</td>");

            sb.Append("</tr><tr>");
            sb.Append($"<td>单版跟单数</td>");
            sb.Append($"<td>{vm.danban_count}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>单版跟单总额</td>");
            sb.Append($"<td>{vm.danban_je}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>单版手续费总额</td>");
            sb.Append($"<td>{vm.danban_shouxufee}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>单版中奖总额</td>");
            sb.Append($"<td>{vm.daban_zjje}</td>");

            sb.Append("</tr><tr>");
            sb.Append($"<td>双版跟单数</td>");
            sb.Append($"<td>{vm.shuangban_count}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>双版跟单总额</td>");
            sb.Append($"<td>{vm.shuangban_je}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>双版手续费总额</td>");
            sb.Append($"<td>{vm.shuangban_shouxufee}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>双版中奖总额</td>");
            sb.Append($"<td>{vm.shuangban_zjje}</td>");

            sb.Append("</tr><tr>");
            sb.Append($"<td>上分总额</td>");
            sb.Append($"<td>{vm.shangfen_je}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>补偿总额</td>");
            sb.Append($"<td>{vm.buchang_je}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>下分总额</td>");
            sb.Append($"<td>{vm.xiafen_je}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>下分手续费<br />(下分总额*1%)</td>");
            sb.Append($"<td>{vm.xiafen_shouxufee.ToString("f2")}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>零点返还总额</td>");
            sb.Append($"<td>{vm.lindianfanhuan_je.ToString("f2")}</td>");
            sb.Append("</tr><tr>");
            sb.Append($"<td>合计<br />(跟单-中奖-补偿-返还+下分手续费+各版手续版)</td>");

            sb.Append($"<td>{vm.heji.ToString("f2")}</td>");
            sb.Append($"</tr>");



            sb.Append("</table>");
            StringBuilder res = new StringBuilder();

            foreach (var item in list)
            {
                string title = front + date.ToString("yyyy-MM-dd") + "统计";
                string body  = sb.ToString();
                try
                {
                    FaYouJian(title, body, item.email);

                    res.Append($"成功向股东【{item.username} {item.email}】发送统计邮件【{title}】<br />\r\n");
                }
                catch (Exception ex)
                {
                    res.Append($"向股东【{item.username} {item.email}】发统计邮件【{title}】失败【{ex.Message}】<br />\r\n");
                    try
                    {
                        //再发一次
                        FaYouJian(title, body, item.email);

                        res.Append($"重复成功向股东【{item.username} {item.email}】发送统计邮件【{title}】<br />\r\n");
                    }
                    catch (Exception ex2)
                    {
                        res.Append($"重复向股东【{item.username} {item.email}】发统计邮件【{title}】失败【{ex2.Message}】<br />\r\n");
                    }
                }
            }
            return(res.ToString());
        }