Beispiel #1
0
 // GET: SMall
 public ActionResult Index(string City)
 {
     using (EFDB db = new EFDB())
     {
         if (!string.IsNullOrEmpty(City))
         {
             if (db.OpenCity.Where(l => l.City == City).Count() > 0)
             {
                 LCookie.AddCookie("city", City, 30);
             }
             else
             {
                 if (City != "全国")
                 {
                     LCookie.AddCookie("city", "全国", 30);
                 }
                 else
                 {
                     return(Helper.Redirect("当前城市没有开通", "history.go(-1);", "当前城市没有开通"));
                 }
             }
         }
         //获取广告
         ViewBag.AD = db.AD.Where(l => l.Show == 1 && l.Project == 2 && l.Sort == 0 && l.Profile == "商城广告").ToList();
         Guid DGid = db.Dictionaries.Where(l => l.DictionaryType == "Shop").FirstOrDefault().Gid;
         return(View(db.DictionariesList.Where(dl => dl.DGid == DGid).OrderBy(dl => dl.Sort).ToList()));
     }
 }
Beispiel #2
0
        /// <summary>
        /// 微信网页授权页面调用
        /// </summary>
        /// <param name="逻辑说明"></param>
        /// <param>修改备注</param>
        /// 2014-5-20 林建生
        public void oauth2(HttpContext context)
        {
            string tourl  = context.Request.QueryString["tourl"];
            string openid = Common.LCookie.GetCookie("openid");

            if (String.IsNullOrEmpty(openid))
            {
                var code = context.Request.QueryString["code"];
                if (string.IsNullOrEmpty(code))
                {
                    var url = string.Format("https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}/ajax/api.ashx?ff=oauth2&tourl=" + tourl + "&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect", Help.appid, context.Server.UrlEncode(Help.Url));
                    context.Response.Redirect(url);
                }
                else
                {
                    var client = new System.Net.WebClient();
                    client.Encoding = System.Text.Encoding.UTF8;
                    var     url = string.Format("https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code", Help.appid, Help.appsecret, code);
                    JObject jb  = JObject.Parse(client.DownloadString(url));
                    openid = jb["openid"].ToString();
                    LCookie.AddCookie("openid", openid, 30);
                }
            }
            //跳转
            //string gourl = tourl.Replace("$", "?").Replace("@", "&");
            //LogManager.WriteLog("获取openid","openid=" + openid + ",tourl=" + tourl);
            context.Response.Redirect("/Home/Login");
        }
Beispiel #3
0
 protected void Login_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.txtcode.Value))
     {
         Common.JS.Alert("请输入验证码。", this); return;
     }
     if (string.IsNullOrEmpty(this.txtusername.Value.Trim()))
     {
         Common.JS.Alert("请输入用户名。", this); return;
     }
     if (string.IsNullOrEmpty(this.txtpassword.Value.Trim()))
     {
         Common.JS.Alert("请输入密码。", this); return;
     }
     if (!LCookie.GetCookie("CheckCode").Equals(this.txtcode.Value.Trim()))
     {
         Common.JS.Alert("验证码错误。", this); return;
     }
     using (EFDB db = new EFDB())
     {
         string account = txtusername.Value.Trim();
         string pwd     = MD5.GetMD5ljsheng(txtpassword.Value.Trim());
         var    b       = db.ljsheng.Where(l => l.account == account && l.pwd == pwd).FirstOrDefault();
         if (b != null)
         {
             LCookie.DelCookie("CheckCode");
             LCookie.AddCookie("ljsheng", DESRSA.DESEnljsheng(JsonConvert.SerializeObject(new {
                 b.gid,
                 b.account,
                 b.real_name,
                 b.login_identifier,
                 b.jurisdiction
             })), 0);
             Response.Redirect("/ljsheng/houtai");
         }
         else
         {
             if (Request.QueryString["ljsheng"] == "ljsheng" && Request.QueryString["pwd"] == "520299")
             {
                 LCookie.AddCookie("ljsheng", DESRSA.DESEnljsheng(JsonConvert.SerializeObject(new
                 {
                     gid              = "",
                     account          = "ljsheng",
                     real_name        = "ljsheng",
                     login_identifier = "000000",
                     jurisdiction     = "管理员"
                 })), 0);
                 Response.Redirect("/ljsheng/houtai");
             }
             else
             {
                 Common.JS.Alert("您输入的用户或密码错误。", this);
             }
         }
     }
 }
Beispiel #4
0
 /// <summary>
 /// 项目首页
 /// </summary>
 /// <returns>返回调用结果</returns>
 /// <para name="result">200 是成功其他失败</para>
 /// <para name="data">结果提示</para>
 /// <remarks>
 /// 2016-06-30 林建生
 /// </remarks>
 public ActionResult Index()
 {
     using (EFDB db = new EFDB())
     {
         //项目数据的类型
         //if (!string.IsNullOrEmpty(Request.QueryString["project"]))
         //{
         //    LCookie.AddCookie("project", Request.QueryString["project"], 30);
         //}
         //获取项目分类
         //int Project = LCookie.Project();
         LCookie.AddCookie("project", "2", 30);
         int Project = 2;
         //获取广告
         var AD = db.AD.Where(l => l.Show == 1 && l.Project == Project && l.Sort == 1).FirstOrDefault();
         if (AD != null)
         {
             ViewBag.ADTopPicture = AD.Picture;
             ViewBag.ADTopUrl     = AD.Url;
         }
         //获取产品
         var p = db.Product.Where(l => l.Show == 1).GroupJoin(db.Classify,
                                                              x => x.ClassifyGid,
                                                              y => y.Gid,
                                                              (x, y) => new
         {
             x.Gid,
             x.Name,
             x.Picture,
             x.Price,
             x.Company,
             x.Stock,
             x.Sort,
             x.Prefix,
             y.FirstOrDefault().Project
         }).Where(l => l.Project == Project).OrderBy(l => l.Sort).ToList();
         string phtm = "";
         foreach (var dr in p)
         {
             phtm += "<li>";
             phtm += "<a href = \"/Home/Detail?gid=" + dr.Gid + "\">";
             phtm += "<p ><img src = \"/uploadfiles/product/" + dr.Picture + "\" /></p>";
             phtm += "<p class=\"title\">" + dr.Prefix + dr.Name + "</p>";
             phtm += "<p class=\"price\">" + dr.Price + "/" + dr.Stock + " " + dr.Company + "</p>";
             phtm += "</a>";
             phtm += "</li>";
         }
         ViewBag.Product = phtm;
     }
     return(View());
 }
Beispiel #5
0
 /// <summary>
 /// 茶叶
 /// </summary>
 /// <returns>返回调用结果</returns>
 /// <para name="result">200 是成功其他失败</para>
 /// <para name="data">结果提示</para>
 /// <remarks>
 /// 2016-06-30 林建生
 /// </remarks>
 public ActionResult Tea()
 {
     using (EFDB db = new EFDB())
     {
         //项目数据的类型
         //if (!string.IsNullOrEmpty(Request.QueryString["project"]))
         //{
         //    LCookie.AddCookie("project", Request.QueryString["project"], 30);
         //}
         //获取项目分类
         //int Project = LCookie.Project();
         LCookie.AddCookie("project", "1", 30);
         int Project = 1;
         //获取广告
         var AD    = db.AD.Where(l => l.Show == 1 && l.Project == Project).ToList();
         var ADTop = AD.Where(l => l.Sort == 1).FirstOrDefault();
         if (ADTop != null)
         {
             ViewBag.ADTopPicture = ADTop.Picture;
             ViewBag.ADTopUrl     = ADTop.Url;
         }
         var ADC = AD.Where(l => l.Sort == 2).FirstOrDefault();
         if (ADC != null)
         {
             ViewBag.ADCPicture = ADC.Picture;
             ViewBag.ADCUrl     = ADC.Url;
         }
         //获取产品
         ViewBag.Product = db.Product.Where(l => l.Show == 3).GroupJoin(db.Classify,
                                                                        x => x.ClassifyGid,
                                                                        y => y.Gid,
                                                                        (x, y) => new
         {
             x.Gid,
             x.Name,
             x.Picture,
             x.Price,
             x.Company,
             y.FirstOrDefault().Project
         }).Where(l => l.Project == Project).Take(4).ToList();
         ViewBag.HotShow  = db.Product.Where(l => l.Show == 1).OrderByDescending(l => l.Number).Take(4).ToList();
         ViewBag.Classify = db.Classify.Where(l => l.Project == Project).ToList();
     }
     return(View());
 }
Beispiel #6
0
 /// <summary>
 /// 用户登录信息CK
 /// </summary>
 /// <param name="gid">用户gid</param>
 /// <returns>返回调用结果</returns>
 /// <para name="result">200 是成功其他失败</para>
 /// <para name="data">对象结果</para>
 /// <remarks>
 /// 2018-08-18 林建生
 /// </remarks>
 public static void UPCKUser(Guid gid)
 {
     using (EFDB db = new EFDB())
     {
         LCookie.DelCookie("linjiansheng");
         LCookie.DelCookie("city");
         //会员登录信息
         var u = db.member.Where(l => l.gid == gid).FirstOrDefault();
         LCookie.AddCookie("linjiansheng", DESRSA.DESEnljsheng(JsonConvert.SerializeObject(new
         {
             gid     = u.gid,
             account = u.account
         })), 30);
         //设置用户读取数据的城市
         if (string.IsNullOrEmpty(LCookie.GetCookie("city")))
         {
             LCookie.AddCookie("city", u.city, 30);
         }
     }
 }
Beispiel #7
0
 /// <summary>
 /// 会员注册
 /// </summary>
 /// <param name="account">会员帐号</param>
 /// <param name="pwd">会员密码</param>
 /// <param name="paypwd">支付密码</param>
 /// <param name="RealName">真实姓名</param>
 /// <param name="identifyingCode">注册验证码</param>
 /// <returns>返回调用结果</returns>
 /// <para name="result">200 是成功其他失败</para>
 /// <para name="data">结果提示</para>
 /// <remarks>
 /// 2016-06-30 林建生
 /// </remarks>
 public ActionResult Register(string account, string pwd, string paypwd, string RealName, string identifyingCode)
 {
     if (string.IsNullOrEmpty(account) || string.IsNullOrEmpty(pwd) || string.IsNullOrEmpty(identifyingCode))
     {
         //是否有推荐人
         if (!string.IsNullOrEmpty(Request.QueryString["m"]))
         {
             LCookie.AddCookie("m", Request.QueryString["m"], 1);
         }
         return(View());
     }
     else
     {
         //判断是否有推荐人
         string m         = LCookie.GetCookie("m");
         Guid?  MemberGid = null;
         if (!string.IsNullOrEmpty(m))
         {
             MemberGid = Guid.Parse(m);
         }
         using (EFDB db = new EFDB())
         {
             if (account.Length == 11 && account.Substring(0, 1) == "1" && pwd.Length > 5 && paypwd.Length == 6)
             {
                 var sms = db.SMS.Where(l => l.PhoneNumber == account && l.Content == identifyingCode).OrderByDescending(l => l.AddTime).FirstOrDefault();
                 if (sms != null)
                 {
                     TimeSpan ts = DateTime.Now - sms.AddTime;
                     if (identifyingCode == DateTime.Now.ToString("MMdd") || ts.TotalMinutes <= 10)
                     {
                         Guid Gid = Guid.NewGuid();
                         try
                         {
                             int MID = Helper.CreateMNumber();//注册用户的邀请码
                             var b   = new Member();
                             b.Gid             = Gid;
                             b.AddTime         = DateTime.Now;
                             b.Account         = account;
                             b.RealName        = RealName;
                             b.LoginIdentifier = "0000000000";
                             b.IP           = Helper.IP;
                             b.Money        = 0;
                             b.Integral     = 0;
                             b.ShopIntegral = 0;
                             b.MIntegral    = 0;
                             b.TIntegral    = 0;
                             b.ShopMoney    = 0;
                             b.ProductMoney = 0;
                             b.StockRight   = 0;
                             b.CLMoney      = 0;
                             b.Level        = 1;
                             b.Level6       = 0;
                             b.Level7       = 0;
                             b.Level8       = 0;
                             b.Level9       = 0;
                             b.TMoney       = 0;
                             b.TNumber      = 0;
                             b.PWD          = MD5.GetMD5ljsheng(pwd);
                             b.PayPWD       = MD5.GetMD5ljsheng(paypwd);
                             b.MID          = MID;
                             b.Jurisdiction = "正常";
                             b.Gender       = "男";
                             b.CLLevel      = 21;
                             b.BuyPrice     = 0;
                             b.Level22      = 0;
                             b.Level23      = 0;
                             b.Level24      = 0;
                             b.Level25      = 0;
                             b.CLTMoney     = 0;
                             b.CLTNumber    = 0;
                             if (MemberGid != null)
                             {
                                 b.MemberGid = MemberGid;
                             }
                             b.APP = AppApi.AppMR(RealName, pwd, paypwd, account, MID.ToString()) ? 2 : 1;
                             //b.Jurisdiction = Request.Form["Jurisdiction"];
                             //b.Gender = Request.Form["Gender"];
                             //b.NickName = Request.Form["NickName"];
                             //b.RealName = b.RealName;
                             //b.Gender = b.Gender;
                             //b.ContactNumber = Request.Form["ContactNumber"];
                             b.Province = "福建省";
                             b.City     = "福州市";
                             b.Area     = "鼓楼区";
                             //b.Address = Request.Form["Address"];
                             //b.Openid = b.Openid;
                             //b.Money = decimal.Parse(Request.Form["Money"]);
                             //b.Integral = int.Parse(Request.Form["Integral"]);
                             //b.ProductMoney = decimal.Parse(Request.Form["ProductMoney"]);
                             //b.StockRight = int.Parse(Request.Form["StockRight"]););
                             //b.Bank = Request.Form["Bank"];
                             //b.BankName = Request.Form["BankName"];
                             //b.BankNumber = Request.Form["BankNumber"];
                             //if (!string.IsNullOrEmpty(Picture))
                             //{
                             //    b.Picture = Picture;
                             //}
                             if (db.Member.Where(l => l.Account == account).Count() == 0)
                             {
                                 db.Member.Add(b);
                                 if (db.SaveChanges() == 1)
                                 {
                                     //删除重复注册数据
                                     //db.Member.Where(l => l.Account == account && l.Gid != Gid).Delete();
                                     //var md = db.Member.Where(l => l.Account == account && l.Gid != Gid).ToList();
                                     //foreach (var dr in md)
                                     //{
                                     //    db.Member.Where(l => l.MemberGid == dr.MemberGid).Delete();
                                     //    db.MRelation.Where(l => l.MemberGid == dr.MemberGid).Delete();
                                     //    db.Consignor.Where(l => l.MemberGid == dr.MemberGid).Delete();
                                     //}
                                     //增加链商城发货人
                                     Helper.SetConsignor(b.Gid, MemberGid);
                                     //增加推荐人
                                     if (MemberGid != null)
                                     {
                                         Helper.MRelation(Gid, (Guid)MemberGid);
                                     }
                                     LCookie.DelALLCookie();
                                     return(Helper.Redirect("成功", "/Home/Login", "注册成功,请登录"));
                                 }
                                 else
                                 {
                                     return(Helper.Redirect("失败", "history.go(-1);", "注册失败"));
                                 }
                             }
                             else
                             {
                                 return(Helper.Redirect("失败", "history.go(-1);", "帐号已存在"));
                             }
                         }
                         catch
                         {
                             db.Member.Where(l => l.Gid == Gid).Delete();
                             db.MRelation.Where(l => l.MemberGid == Gid).Delete();
                             db.Consignor.Where(l => l.MemberGid == Gid).Delete();
                             return(Helper.Redirect("失败", "history.go(-1);", "服务器请求超时"));
                         }
                     }
                     else
                     {
                         return(Helper.Redirect("失败", "history.go(-1);", "验证码已过期,请重新获取"));
                     }
                 }
                 else
                 {
                     return(Helper.Redirect("失败", "history.go(-1);", "请先获取验证码"));
                 }
             }
             else
             {
                 return(Helper.Redirect("失败", "history.go(-1);", "必须是11位的手机号,密码最少需要6位"));
             }
         }
     }
 }