Beispiel #1
0
        public ActionResult Register(string mobile, string code)
        {
            try
            {
                //判断验证码是否正确
                UserCheckMobile existCheckMobileUserInfo = CheckMobileService.GetLastCheckMobileInfo(mobile);
                if (code != existCheckMobileUserInfo.CheckCode)
                {
                    return(Json(JsonHandler.CreateMessage(0, "验证码错误,请重新输入!")));
                }

                //根据手机号码取出会员信息
                var usermodel = WebUtils.Get <CustomerNew>(WebConfig.ApiBaseUrl + "WlxApi/GetCustomerBySql", mobile);
                //把openid等信息更新到万里信erp
                if (usermodel == null)
                {
                    Tools.MessBox("test1");
                    InsertCustomerNew customer = new InsertCustomerNew();

                    customer.num    = mobile;
                    customer.openid = CurrentCustomer.OpenId;
                    customer.wxname = CurrentCustomer.Name;

                    var inserResult = WebUtils.Save <InsertCustomerNew>(WebConfig.ApiBaseUrl + "WlxApi/InsertVip", customer);
                    Tools.MessBox("test2");
                    var url = DataUtils.GetRedirectToActionUrl();
                    return(Json(JsonHandler.CreateMessage(1, "注册成功", url), JsonRequestBehavior.AllowGet));
                    //return Json(JsonHandler.CreateMessage(0, "您不是线下会员,请到附近门店办理会员后再来关联"), JsonRequestBehavior.AllowGet);
                }
                updateCustomer updatcustomer = new updateCustomer();
                updatcustomer.openid  = CurrentCustomer.OpenId;
                updatcustomer.wx_name = CurrentCustomer.Name;
                updatcustomer.vpid    = usermodel.c_identity.ToString();

                var result = WebUtils.Save <updateCustomer>(WebConfig.ApiBaseUrl + "WlxApi/UpdateVip", updatcustomer);

                if (result)
                {
                    Customer customer = new Customer();
                    customer.Phone      = mobile;
                    Session["Customer"] = customer;
                    Tools.MessBox(string.Format("时间:{0},描述:{1}", DateTime.Now, customer.Phone), "//Log//Register//Session//");
                    var url = DataUtils.GetRedirectToActionUrl();
                    return(Json(JsonHandler.CreateMessage(1, "注册成功", url), JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(JsonHandler.CreateMessage(0, "注册失败"), JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                Tools.MessBox(ex.ToString(), "//Log//Register//Exception");
                return(Json(JsonHandler.CreateMessage(0, "注册失败", Url.Action("Index")), JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #2
0
        public int InsertVip([FromBody] InsertCustomerNew model)
        {
            SqlHelper helper = new SqlHelper();

            SqlParameter[] prams = new SqlParameter[3];
            prams[0] = new SqlParameter("@c_num", model.num);
            prams[1] = new SqlParameter("@c_openid", model.openid);
            prams[2] = new SqlParameter("@c_wxname", model.wxname);

            var count = helper.ExecuteNonQuery(@"insert into   dbo.h_CustomerNew(c_num,c_discount,c_bookindate,c_openid,c_wxname,c_memo2)values(@c_num,'1.00',convert(varchar(20),getdate(),120),@c_openid,@c_wxname,'微信线上注册')", prams);

            return(count); //返回影响的行数
        }
Beispiel #3
0
        public void Test5()
        {
            string            mobile   = "13062449866";
            InsertCustomerNew customer = new InsertCustomerNew();

            //根据mobile获取openid和wxname信息;
            var model = new Customer();

            //using (EntityContext db = new EntityContext())
            //{
            //    model = db.Customers.Where(s => s.Phone == mobile).FirstOrDefault();
            //}
            customer.num    = mobile;
            customer.openid = "o1MJTwmO0wm9apY1tWmQMb4CgIzc";
            customer.wxname = "兴辉";

            //var inserResult = WebUtils.Save<InsertCustomerNew>(WebConfig.ApiBaseUrl + "WlxApi/InsertVip", customer);
            var result = WebUtils.Save <InsertCustomerNew>("http://114.55.66.247:7777/api/WlxApi/InsertVip", customer);
        }