Exemple #1
0
        public JsonResult RegisterUser(WeUser.Dto.WeUserInputDto inputDto)
        {
            Common.JsonResultStatus jsonResult = new Common.JsonResultStatus();
            jsonResult.Code = 400;
            jsonResult.Msg  = "注册失败";
            if (inputDto != null)
            {
                inputDto.RegDate = DateTime.Now;
                //WeUser.Dto.WeUserOutputDto outputDto = this.weUserAppService.GetWeUserByUserId(Common.UserHelper.Instance.getUserId());
                inputDto.Id     = Common.UserHelper.Instance.getUserId();
                inputDto.IsInit = 0;

                if (this.weUserAppService.IsHasRecommendCode(inputDto.Recommend_Code))
                {
                    inputDto.Invit_Code = RandomNum(0);
                    this.weUserAppService.UpdateUser(inputDto);
                    if (inputDto != null)
                    {
                        jsonResult.Code   = 200;
                        jsonResult.Msg    = "注册成功";
                        jsonResult.Result = inputDto;
                        return(Json(jsonResult));
                    }
                }
                else
                {
                    jsonResult.Code   = 201;
                    jsonResult.Msg    = "推荐码不存在!!!";
                    jsonResult.Result = inputDto;
                    return(Json(jsonResult));
                }
            }
            return(Json(jsonResult));
        }
        public JsonResult getDetailById(int addrId)
        {
            var data = _userAddressAppService.GetAddress(addrId);

            Common.JsonResultStatus rst = new Common.JsonResultStatus()
            {
                Code = 200, Msg = "获取成功", Result = data
            };
            return(Json(rst, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public JsonResult LoginValidate(Models.WeiXinInfo userInfo)
        {
            var user = this.weUserAppService.GetWeUser(userInfo.OpenId);

            Common.JsonResultStatus rstJson = new Common.JsonResultStatus();
            rstJson.Code = 200;
            // var user = this.weUserAppService.GetWeUser("oCbECv1pwMNyAodYQtRJVvJf_Zsg");
            if (user == null)
            {
                WeUser.Dto.WeUserInputDto input = new WeUser.Dto.WeUserInputDto();
                input.HeadImgUrl = userInfo.HeadImgUrl;
                input.NickName   = userInfo.NickName;
                input.OpenId     = userInfo.OpenId;
                input.IsInit     = 1;
                weUserAppService.CreateWeUser(input);
                rstJson.Msg = "用户第一次初始化成功,即将跳转";
                // string regUrl = string.Format("/RegisterWeChat/Index?openId={0}&HeadImgUrl={1}&NickName={2}&retUrl=", userInfo.OpenId, userInfo.HeadImgUrl, userInfo.NickName, userInfo.RetUrl);
                // rstJson.RedirectUrl = regUrl;
                rstJson.RedirectUrl = userInfo.RetUrl;
                return(Json(rstJson));
            }
            else
            {
                UserPoints.Dto.UserPointsInputDto points = new UserPoints.Dto.UserPointsInputDto();
                points.Ip     = HttpContext.Request.UserHostAddress;
                points.Score  = int.Parse(Common.CommonConst.PointsScore);
                points.UserId = user.Id;
                this.userPointAppService.AddPointsScore(points);

                string encrtpt = Common.DESEncryptEx.Encrypt(string.Format("{0}|{1}|{2}|{3}|{4}", user.Id, user.PhoneNo, user.NickName, userInfo.AccessToken, userInfo.OpenId));
                Logger.Debug("当前用户Cookie" + encrtpt);
                //        FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
                //1,
                //user.NickName,
                //DateTime.Now,
                //DateTime.Now.Add(FormsAuthentication.Timeout), true, string.Format("{0}|{1}|{2}|{3}|{4}", user.Id, user.PhoneNo, user.NickName, accessToken, opentid)

                //);

                //DateTime.Now.Add(FormsAuthentication.Timeout), true, string.Format("{0}|{1}|{2}|{3}|{4}", user.Id, user.PhoneNo, user.NickName, accessToken, openId)
                //HttpCookie cookie = new HttpCookie(
                //    Common.CommonConst.AuthSaveKey,
                //    FormsAuthentication.Encrypt(ticket));
                HttpCookie cookie = new HttpCookie(
                    Common.CommonConst.AuthSaveKey,
                    encrtpt);
                Response.Cookies.Add(cookie);
                rstJson.Msg         = "用户验证成功,即将跳转";
                rstJson.RedirectUrl = userInfo.RetUrl;
                return(Json(rstJson));
            }


            //return Json(retUrl);
        }
        public JsonResult getAll()
        {
            var data = _userAddressAppService.GetAllAddress(Common.UserHelper.Instance.getUserId());

            //var data = _userAddressAppService.GetAllAddress(5);
            Common.JsonResultStatus rst = new Common.JsonResultStatus()
            {
                Code = 200, Msg = "获取成功", Result = data
            };
            return(Json(rst, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        public JsonResult CanOrder(string id)
        {
            var outResult = this._orderRepository.CanOrder(id);
            //return Json(outResult, JsonRequestBehavior.AllowGet);

            var rst = new Common.JsonResultStatus()
            {
                Code = 200, Msg = "获取成功", Result = outResult
            };

            return(Json(rst, JsonRequestBehavior.AllowGet));
        }
 public JsonResult SearchStatus()
 {
     Common.JsonResultStatus json = new Common.JsonResultStatus();
     json.Code = 0;
     json.Msg  = "未签到";
     if (userPointsAppService.IsSign(Common.UserHelper.Instance.getUserId()) > 0)
     {
         json.Code = 1;
         json.Msg  = "已签到";
     }
     return(Json(json));
 }
Exemple #7
0
        public JsonResult GetOrderDetail(string id)
        {
            var outResult = this._orderRepository.QueryOrderItems(id);
            //return Json(outResult, JsonRequestBehavior.AllowGet);
            var order     = this._orderRepository.QueryByOrderId(id);
            var orderInfo = new { Order = order, OrderItems = outResult };
            var rst       = new Common.JsonResultStatus()
            {
                Code = 200, Msg = "获取成功", Result = orderInfo
            };

            return(Json(rst, JsonRequestBehavior.AllowGet));
        }
 public JsonResult RemoveAddress(int id)
 {
     Common.JsonResultStatus rst = new Common.JsonResultStatus();
     try
     {
         _userAddressAppService.RemoveAddress(id);
         rst.Code = 200;
         rst.Msg  = "修改成功";
         return(Json(rst));
     }
     catch (Exception ex)
     {
         rst.Code = 500;
         rst.Msg  = ex.Message;
         return(Json(rst));
     }
 }
 public JsonResult SetDefault(UserAddress.Dto.UserAddressInputDto input)
 {
     input.UserId = Common.UserHelper.Instance.getUserId();
     Common.JsonResultStatus rst = new Common.JsonResultStatus();
     try
     {
         _userAddressAppService.SetDefault(input);
         rst.Code = 200;
         rst.Msg  = "修改成功";
         return(Json(rst));
     }
     catch (Exception ex)
     {
         rst.Code = 500;
         rst.Msg  = ex.Message;
         return(Json(rst));
     }
 }
Exemple #10
0
 public JsonResult SignValidate()
 {
     UserPoints.Dto.UserPointsInputDto input = new UserPoints.Dto.UserPointsInputDto();
     input.Score  = int.Parse(Common.CommonConst.PointsScore);
     input.UserId = Common.UserHelper.Instance.getUserId();
     Common.JsonResultStatus json = new Common.JsonResultStatus();
     json.Code = 0;
     if (userPointsAppService.SignPoints(input) > 0)
     {
         json.Code   = 1;
         json.Result = Common.CommonConst.PointsScore;
         json.Msg    = "已签到";
     }
     else
     {
         json.Msg = "签到失败";
     }
     return(Json(json));
 }
Exemple #11
0
        public JsonResult Login(Users.Dto.UserLoginInputDto input)
        {
            Common.JsonResultStatus resJson = new Common.JsonResultStatus();

            var user = userAppService.LoginIn(input);

            if (user != null)
            {
                //string pwd = new PasswordHasher().HashPassword(input.PassWord);
                //if (user.PassWord != pwd)
                //{
                //    resJson.Code = 201;
                //    resJson.Msg = "密码错误";
                //}
                //else
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
                        1,
                        "admin",
                        DateTime.Now,
                        DateTime.Now.Add(FormsAuthentication.Timeout), true, string.Format("{0}", user.UserName)

                        );

                    //DateTime.Now.Add(FormsAuthentication.Timeout), true, string.Format("{0}|{1}|{2}|{3}|{4}", user.Id, user.PhoneNo, user.NickName, accessToken, openId)
                    HttpCookie cookie = new HttpCookie(
                        Common.CommonConst.AuthSaveKey,
                        FormsAuthentication.Encrypt(ticket));
                    Response.Cookies.Add(cookie);
                    resJson.Code = 200;
                    resJson.Msg  = "登录成功";
                }
            }
            else
            {
                resJson.Code = 202;
                resJson.Msg  = "用户不存在";
            }
            return(Json(resJson));
        }
Exemple #12
0
 public JsonResult Register(SS_User.Dto.SS_UserInputDto input)
 {
     Common.JsonResultStatus jsonStatus = new Common.JsonResultStatus();
     jsonStatus.Code = 200;
     if (string.IsNullOrWhiteSpace(input.OpenId))
     {
         jsonStatus.Msg = "未获取到OpenId";
     }
     else
     {
         int state = this._userAppService.CreateUser(input);
         if (state == 1)
         {
             jsonStatus.Msg = "已成功加入";
         }
         else
         {
             jsonStatus.Msg = "已经加入过了";
         }
     }
     return(Json(jsonStatus));
 }
Exemple #13
0
        public JsonResult AlterUser(WeUser.Dto.WeUserInputDto inputDto)
        {
            Common.JsonResultStatus jsonResult = new Common.JsonResultStatus();
            jsonResult.Code = 400;
            jsonResult.Msg  = "编辑失败";
            if (inputDto != null)
            {
                inputDto.RegDate = DateTime.Now;
                //WeUser.Dto.WeUserOutputDto outputDto = this.weUserAppService.GetWeUserByUserId(Common.UserHelper.Instance.getUserId());
                inputDto.Id     = Common.UserHelper.Instance.getUserId();
                inputDto.IsInit = 0;

                this.weUserAppService.UpdateUser(inputDto);
                if (inputDto != null)
                {
                    jsonResult.Code   = 200;
                    jsonResult.Msg    = "编辑成功";
                    jsonResult.Result = inputDto;
                    return(Json(jsonResult));
                }
            }
            return(Json(jsonResult));
        }
Exemple #14
0
        public JsonResult EditStatus(int userId, int status)
        {
            Common.JsonResultStatus json = new Common.JsonResultStatus();
            json.Code = 200;
            if (userAppService.UpdateStatus(userId, status) > 0)
            {
                var item = userAppService.GetUserDetail(userId);
                if (item != null)
                {
                    OrderTemplateData orderData1 = new OrderTemplateData();
                    orderData1.first    = new TemplateDataItem("尊敬的回收用户,你好!你提交的申请已受理");
                    orderData1.keyword1 = new TemplateDataItem(item.JoinTime.ToString("yyyy-MM-dd HH:mm:ss"));
                    orderData1.keyword2 = new TemplateDataItem("加入收收");


                    if (status == 1)
                    {
                        orderData1.keyword3 = new TemplateDataItem("审核已通过");
                    }

                    else
                    {
                        orderData1.keyword3 = new TemplateDataItem("审核未通过");
                        //Common.WeiXinHelper.SendSimpleMsg(Common.CommonConst.AppID, item.OpenId, "您登记加入收收的信息未通过审核,请到重新登记加盟信息");
                    }
                    orderData1.remark = new TemplateDataItem("感谢你对收收的支持!");
                    Common.WeiXinHelper.SendTemplateToSSWeUser(Common.CommonConst.AppID, item.OpenId, orderData1);
                }
                json.Msg = "操作成功";
            }
            else
            {
                json.Msg = "操作失败";
            }
            return(Json(json, JsonRequestBehavior.AllowGet));
        }