Exemplo n.º 1
0
        /// <summary>
        /// 上传证件
        /// </summary>
        /// <returns></returns>
        public ActionResult Identify(string returnUrl = null)
        {
            if (!CurrentWeChatUser.IsUserLoggedIn)
            {
                return Redirect("/wechat/account/login");
            }

            WeChatUserViewModel model = new WeChatUserViewModel { UserEntity = UserInfo };
            try
            {
                UserService service = new UserService();
                model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);
            }
            catch (Exception e)
            {
                LogService.Log("Identify 出错了!", e.ToString());
            }
            model.ErrorMsg = GetErrorMessage(model.VipInfo);

            ViewData["returnUrl"] = returnUrl;
            return View(model);
        }
Exemplo n.º 2
0
        public ActionResult Identify(string identifyImgUrl, string returnUrl = null)
        {
            WeChatUserViewModel model = new WeChatUserViewModel { UserEntity = UserInfo };

            if (!string.IsNullOrWhiteSpace(identifyImgUrl))
            {
                UserService service = new UserService();
                try
                {
                    UserVip vipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);

                    CurrentUser.IdentiyImg = identifyImgUrl;
                    CurrentUser.Vip = (int)VipState.Normal;
                    if (service.UserUpdate(CurrentUser) && service.UpdateUserVipInfo(vipInfo.Id, vipInfo.OrderId, identifyImgUrl,
                        DateTime.Now, DateTime.Now, vipInfo.Duration, vipInfo.Amount, VipState.Normal))
                    {
                        model.ErrorMsg = "照片上传成功,等待管理员审核";
                    }

                    // get it again
                    model.VipInfo = service.GetUserVipInfoByUserId(UserInfo.UserId);
                    if (string.IsNullOrEmpty(model.ErrorMsg))
                    {
                        model.ErrorMsg = GetErrorMessage(model.VipInfo);
                    }
                }
                catch (Exception e)
                {
                    LogService.Log("Identify 出错了!", e.ToString());
                    model.ErrorMsg = "认证照片上传失败!";
                }
            }
            else
            {
                model.ErrorMsg = "请选择认证照片!";
            }

            if (!string.IsNullOrWhiteSpace(returnUrl))
            {
                return Redirect(returnUrl);
            }

            return View(model);
        }
Exemplo n.º 3
0
        public ActionResult ViewUser()
        {
            WeChatUserViewModel model = new WeChatUserViewModel { WeChatUserEntity = CurrentWeChatUser, UserEntity = CurrentUser };
            try
            {
                if (!CurrentWeChatUser.IsUserLoggedIn)
                {
                    return Redirect("/wechat/account/login");
                }

                CityService cityService = new CityService();
                model.Provinces = cityService.GetProvinces(true);
                if (!string.IsNullOrEmpty(model.UserEntity.LocationId))
                {
                    model.Cities = cityService.GetCitiesByProvinceId(model.UserEntity.Province, true); //市
                    model.Areas = cityService.GetAreasByCityId(model.UserEntity.City, true); //区
                }
            }
            catch (Exception e)
            {
                LogService.Log("用户中心-viewuser", e.ToString());
            }
            return View(model);
        }