Ejemplo n.º 1
0
 private void SetZan1(HttpContext context)
 {
     #region 新的方法
     try
     {
         int tmphid = 0;
         int.TryParse(_ct.Request.Form["tmpid"], out tmphid);
         //string topid = _ct.Request.Form["tmpres"];
         string topid = Dos.Common.CookieHelper.Get("curYSAes");
         if (string.IsNullOrEmpty(topid))
         {
             context.Response.Write("{\"ismsgs\":\"不存在topid\",\"ist\":\"" + 4 + "\"}");
         }
         else
         {
             var tmpopenid = Common.CryptHelper.DESEncrypt.Decrypt(topid, WebConfigurationManager.AppSettings["PassWordKey"]);
             var tmpopid2  = Common.CryptHelper.DESEncrypt.Encrypt(Dos.Common.CookieHelper.Get("curYSTid"), WebConfigurationManager.AppSettings["PassWordKey"]);
             if (tmpopid2.Equals(topid))
             {
                 int      nums1    = 0;
                 int      ist      = 0;
                 DateTime t1       = DateTime.Now.Date;
                 DateTime tm2      = DateTime.Now.AddDays(1).Date;
                 DateTime t2       = Convert.ToDateTime(WebConfigurationManager.AppSettings["endtime11"]);
                 DateTime t3       = t2.AddDays(1);
                 var      userInfo = UserApi.Info(AccessTokenContainer.TryGetToken(WebConfigurationManager.AppSettings["wxappid1"], WebConfigurationManager.AppSettings["wxsecret1"]), tmpopenid);
                 if (_ct.Request.UrlReferrer.Host.Equals("wsjhb.tencenthouse.com"))
                 {
                     if (string.IsNullOrEmpty(_ct.Request.UserAgent) || (!_ct.Request.UserAgent.Contains("MicroMessenger") && !_ct.Request.UserAgent.Contains("Windows Phone")))
                     {
                         _ct.Response.Write("{\"ismsgs\":\"请从微信端访问\",\"ist\":\"" + 6 + "\"}");
                     }
                     else
                     {
                         if (DateTime.Compare(t1, t2) < 0)
                         {
                             var ctcount = DbSession.Default.From <Dos.Model.HdPicHit>().Where(s => s.wxopenid.Equals(tmpopenid) && s.addtime > t1 && s.addtime < tm2 && s.extend1.Equals("107")).Count();
                             if (ctcount >= 3)
                             {
                                 _ct.Response.Write("{\"ismsgs\":\"0\",\"ist\":\"" + 2 + "\"}");
                             }
                             else
                             {
                                 var tmpdel = DbSession.Default.From <Dos.Model.HdPicHit>().Where(s => s.wxopenid.Equals(tmpopenid) && s.hdpicid.Equals(tmphid) && s.addtime > t1 && s.addtime < tm2).ToFirstDefault();
                                 if (tmpdel.Id > 0)
                                 {
                                     _ct.Response.Write("{\"ismsgs\":\"0\",\"ist\":\"" + 5 + "\"}");
                                 }
                                 else
                                 {
                                     string             tsd   = _ct.Request.UrlReferrer.Host;
                                     var                std1  = _ct.Request.UserHostAddress;
                                     Dos.Model.HdPicHit model = new Dos.Model.HdPicHit();
                                     model.Attach();
                                     model.addtime    = DateTime.Now;
                                     model.updatetime = DateTime.Now;
                                     model.extend1    = "107";
                                     model.extend2    = tsd;
                                     model.orders     = 0;
                                     model.status     = 0;
                                     model.wxopenid   = tmpopenid;
                                     model.name       = std1;
                                     model.hdpicid    = tmphid;
                                     int             returnValue = DbSession.Default.Insert <Dos.Model.HdPicHit>(model);
                                     Dos.Model.HdPic tmodel      = DbSession.Default.From <Dos.Model.HdPic>().Where(s => s.Id.Equals(tmphid)).ToFirstDefault();
                                     if (tmodel.Id > 0)
                                     {
                                         tmodel.Attach();
                                         nums1             = tmodel.Orders + 1;
                                         tmodel.Orders     = tmodel.Orders + 1;
                                         tmodel.UpdateTime = DateTime.Now;
                                         int returnvalue = DbSession.Default.Update <Dos.Model.HdPic>(tmodel);
                                     }
                                     ist = 1;
                                     _ct.Response.Write("{\"ismsgs\":\"" + nums1 + "\",\"ist\":\"" + 1 + "\"}");
                                 }
                             }
                         }
                         else
                         {
                             _ct.Response.Write("{\"ismsgs\":\"0\",\"ist\":\"" + 3 + "\"}");
                         }
                     }
                 }
                 else
                 {
                     _ct.Response.Write("{\"ismsgs\":\"请从正规域名访问\",\"ist\":\"" + 6 + "\"}");
                 }
             }
             else
             {
                 context.Response.Write("{\"ismsgs\":\"数据不正确\",\"ist\":\"" + 4 + "\"}");
             }
         }
     }
     catch (Exception ex)
     {
         _ct.Response.Write("{\"ismsgs\":\"出错了\",\"ist\":\"" + 4 + "\"}");
     }
     #endregion
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增数据信息
        /// </summary>
        private void AddXYInfo()
        {
            try
            {
                var topid1     = Common.CryptHelper.DESEncrypt.Decrypt(Dos.Common.CookieHelper.Get("curXYAes1"), WebConfigurationManager.AppSettings["PassWordKey"]);
                var tname      = _ct.Request.Form["tname"];
                var tphone     = _ct.Request.Form["tphone"];
                var tpicurl    = Dos.Common.CookieHelper.Get("curXYImgUrl");
                var tpnickname = Dos.Common.CookieHelper.Get("curXYName");
                var tmodel     = DbSession.Default.From <Dos.Model.HdPic>().Where(s => s.Extend2.Equals("109") && s.Extend1.Equals(topid1)).ToFirstDefault();
                if (tmodel.Id > 0)
                {
                    string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                        code = "不能重复提交数据", result = null, count = 1
                    });
                    _ct.Response.Write(jsonstrlist);
                }
                else
                {
                    var tmo = DbSession.Default.From <Dos.Model.HdPic>().Where(t => t.Extend4.Equals(tphone) && t.Extend2.Equals("109")).ToFirstDefault();
                    if (tmo.Id > 0)
                    {
                        string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                            code = "该手机号码已存在,请重新输入", result = null, count = 3
                        });
                        _ct.Response.Write(jsonstrlist);
                    }
                    else
                    {
                        var tid = DbSession.Default.From <Dos.Model.HdPic>().Where(s => s.Extend2.Equals("109")).Count();
                        //tmodel.AttachAll()
                        tmodel = new Dos.Model.HdPic()
                        {
                            Name       = tpnickname,
                            PicUrl     = tpicurl,
                            Status     = 0,
                            Orders     = 0,
                            AddTime    = DateTime.Now,
                            UpdateTime = DateTime.Now,
                            Extend1    = topid1,
                            Extend2    = "109",
                            Extend3    = tname,
                            Extend4    = tphone
                        };
                        int ti = DbSession.Default.Insert <Dos.Model.HdPic>(tmodel);

                        var    stopnum     = DbSession.Default.FromSql("select row from (select row_number() over (order by orders desc,updatetime asc) row,extend1 from hdpic where Extend2='109') newtable where extend1=@extend1").AddInParameter("@extend1", DbType.String, topid1).ToScalar() + "";
                        string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                            code = ti + "", result = stopnum, count = 2
                        });
                        _ct.Response.Write(jsonstrlist);
                    }
                }
            }
            catch (Exception ex)
            {
                string jsonstrlist = JsonHelper.GetJsonString(new jsonResult {
                    code = ex.Message, result = null, count = 0
                });
                _ct.Response.Write(jsonstrlist);
            }
        }
Ejemplo n.º 3
0
        private void LnOtherDZ()
        {
            try
            {
                int tmphid = 0;
                int.TryParse(_ct.Request.Form["tmpid"], out tmphid);
                //string topid = _ct.Request.Form["tmpres"];
                string topid = _ct.Request.Form["curXYDZAre"];
                if (string.IsNullOrEmpty(topid))
                {
                    _ct.Response.Write("{\"ismsgs\":\"不存在数据\",\"ist\":\"" + 2 + "\"}");
                }
                else
                {
                    var tmpopenid = Common.CryptHelper.DESEncrypt.Decrypt(topid, WebConfigurationManager.AppSettings["PassWordKey"]);
                    var topid2    = Common.CryptHelper.DESEncrypt.Decrypt(_ct.Request.Form["curXYDZAreTid"], WebConfigurationManager.AppSettings["PassWordKey1"]);
                    if (topid2.Equals(tmpopenid))
                    {
                        int      nums1 = 0;
                        int      ist   = 0;
                        DateTime t1    = DateTime.Now.Date;
                        DateTime tm2   = DateTime.Now.AddDays(1).Date;
                        DateTime t2    = Convert.ToDateTime(WebConfigurationManager.AppSettings["endtime15"]);
                        DateTime t3    = t2.AddDays(1);

                        //var userInfo = UserApi.Info(AccessTokenContainer.TryGetToken(WebConfigurationManager.AppSettings["wxappid1"], WebConfigurationManager.AppSettings["wxsecret1"]), tmpopenid);
                        if (_ct.Request.UrlReferrer.Host.Equals("wsjhb.tencenthouse.com"))
                        {
                            if (string.IsNullOrEmpty(_ct.Request.UserAgent) || (!_ct.Request.UserAgent.Contains("MicroMessenger") && !_ct.Request.UserAgent.Contains("Windows Phone")))
                            {
                                _ct.Response.Write("{\"ismsgs\":\"请通过微信端访问\",\"ist\":\"" + 2 + "\"}");
                            }
                            else
                            {
                                if (DateTime.Compare(t1, t2) < 0)
                                {
                                    if (tmphid > 0)
                                    {
                                        var tmpdel = DbSession.Default.From <Dos.Model.HdPicHit>().Where(s => s.wxopenid.Equals(tmpopenid) && s.extend1.Equals("110") && s.hdpicid.Equals(tmphid) && s.addtime > t1 && s.addtime < tm2).ToFirstDefault();
                                        if (tmpdel.Id > 0)
                                        {
                                            _ct.Response.Write("{\"ismsgs\":\"已存在数据\",\"ist\":\"" + 5 + "\"}");
                                        }
                                        else
                                        {
                                            string             tsd   = _ct.Request.UrlReferrer.Host;
                                            var                std1  = _ct.Request.UserHostAddress;
                                            Dos.Model.HdPicHit model = new Dos.Model.HdPicHit();
                                            model.Attach();
                                            model.addtime    = DateTime.Now;
                                            model.updatetime = DateTime.Now;
                                            model.extend1    = "110";
                                            model.extend2    = tsd;
                                            model.orders     = 0;
                                            model.status     = 0;
                                            model.wxopenid   = tmpopenid;
                                            model.name       = std1;
                                            model.hdpicid    = tmphid;
                                            int             returnValue = DbSession.Default.Insert <Dos.Model.HdPicHit>(model);
                                            Dos.Model.HdPic tmodel      = DbSession.Default.From <Dos.Model.HdPic>().Where(s => s.Id.Equals(tmphid)).ToFirstDefault();
                                            if (tmodel.Id > 0)
                                            {
                                                tmodel.Attach();
                                                nums1             = tmodel.Orders + 1;
                                                tmodel.Orders     = tmodel.Orders + 1;
                                                tmodel.UpdateTime = DateTime.Now;
                                                int returnvalue = DbSession.Default.Update <Dos.Model.HdPic>(tmodel);
                                            }
                                            ist = 1;
                                            //string nts = "编号:" + tmodel.Extend4 + " 票数:" + nums1;
                                            _ct.Response.Write("{\"ismsgs\":\"" + nums1 + "\",\"ist\":\"" + 1 + "\"}");
                                        }
                                    }
                                    else
                                    {
                                        _ct.Response.Write("{\"ismsgs\":\"操作的数据不存在\",\"ist\":\"" + 0 + "\"}");
                                    }
                                }
                                else
                                {
                                    _ct.Response.Write("{\"ismsgs\":\"活动时间已过\",\"ist\":\"" + 3 + "\"}");
                                }
                            }
                        }
                        else
                        {
                            _ct.Response.Write("{\"ismsgs\":\"请通过正规域名访问\",\"ist\":\"" + 2 + "\"}");
                        }
                    }
                    else
                    {
                        _ct.Response.Write("{\"ismsgs\":\"数据不一致\",\"ist\":\"" + 2 + "\"}");
                    }
                }
            }
            catch (Exception)
            {
                _ct.Response.Write("{\"ismsgs\":\"数据出错\",\"ist\":\"" + 4 + "\"}");
            }
        }
Ejemplo n.º 4
0
 //自己填充信息
 private void LnZjdz()
 {
     try
     {
         var topid1 = Common.CryptHelper.DESEncrypt.Decrypt(Dos.Common.CookieHelper.Get("curlnQPAes1"), WebConfigurationManager.AppSettings["PassWordKey"]);
         int tmphid = 0;
         int.TryParse(_ct.Request.Form["tmpid"], out tmphid);
         var tcurinfo = _ct.Request.Form["tcurinfo"];
         if (string.IsNullOrEmpty(topid1))
         {
             _ct.Response.Write("{\"ismsgs\":\"不存在数据\",\"ist\":\"" + 2 + "\"}");
         }
         else
         {
             var tmodel = DbSession.Default.From <Dos.Model.HdPicHit>().Where(s => s.wxopenid.Equals(topid1) && s.extend1.Equals("111")).ToFirstDefault();
             if (tmodel.Id > 0)
             {
                 var stlist = tmodel.extend2.Split(',');
                 if (stlist.Length >= 7)
                 {
                     _ct.Response.Write("{\"ismsgs\":\" 基础勇气已集满\",\"ist\":\"" + 3 + "\"}");
                 }
                 else
                 {
                     tmodel.Attach();
                     tmodel.extend2 = tmodel.extend2 + "," + tcurinfo;
                     int             returnvalue = DbSession.Default.Update <Dos.Model.HdPicHit>(tmodel);
                     Dos.Model.HdPic tmodel1     = DbSession.Default.From <Dos.Model.HdPic>().Where(s => s.Id.Equals(tmphid)).ToFirstDefault();
                     if (tmodel1.Id > 0)
                     {
                         tmodel1.Attach();
                         tmodel1.Orders = tmodel1.Orders + 1;
                         int ret     = DbSession.Default.Update <Dos.Model.HdPic>(tmodel1);
                         var stopnum = DbSession.Default.FromSql("select row from (select row_number() over (order by orders desc,updatetime asc) row,extend1 from hdpic where Extend2='110') newtable where extend1=@extend1").AddInParameter("@extend1", DbType.String, topid1).ToScalar() + "";
                         _ct.Response.Write("{\"ismsgs\":\"" + stopnum + "\",\"ist\":\"" + 4 + "\",\"nums\":\"" + tmodel1.Orders + "\"}");
                     }
                     else
                     {
                         _ct.Response.Write("{\"ismsgs\":\" 不存在数据\",\"ist\":\"" + 1 + "\"}");
                     }
                 }
             }
             else
             {
                 tmodel = new Dos.Model.HdPicHit();
                 tmodel.Attach();
                 tmodel.addtime    = DateTime.Now;
                 tmodel.updatetime = DateTime.Now;
                 tmodel.extend1    = "111";
                 tmodel.extend2    = tcurinfo;
                 tmodel.orders     = 0;
                 tmodel.status     = 0;
                 tmodel.wxopenid   = topid1;
                 tmodel.name       = "自己点赞";
                 tmodel.hdpicid    = tmphid;
                 int             returnValue = DbSession.Default.Insert <Dos.Model.HdPicHit>(tmodel);
                 Dos.Model.HdPic tmodel1     = DbSession.Default.From <Dos.Model.HdPic>().Where(s => s.Id.Equals(tmphid)).ToFirstDefault();
                 if (tmodel1.Id > 0)
                 {
                     tmodel1.Attach();
                     tmodel1.Orders = tmodel1.Orders + 1;
                     int ret     = DbSession.Default.Update <Dos.Model.HdPic>(tmodel1);
                     var stopnum = DbSession.Default.FromSql("select row from (select row_number() over (order by orders desc,updatetime asc) row,extend1 from hdpic where Extend2='110') newtable where extend1=@extend1").AddInParameter("@extend1", DbType.String, topid1).ToScalar() + "";
                     _ct.Response.Write("{\"ismsgs\":\"" + stopnum + "\",\"ist\":\"" + 4 + "\",\"nums\":\"" + tmodel1.Orders + "\"}");
                 }
                 else
                 {
                     _ct.Response.Write("{\"ismsgs\":\" 不存在数据\",\"ist\":\"" + 1 + "\"}");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         _ct.Response.Write("{\"ismsgs\":\"" + ex.Message + "\",\"ist\":\"" + 0 + "\"}");
     }
 }