public ActionResult Withdraw()
        {
            User userInfo = SessionTool.Get <User>("user");

            ViewBag.UserNo = userInfo.No;
            return(View());
        }
Example #2
0
 /// <summary>
 /// 获取产品详情
 /// </summary>
 /// <param name="no"></param>
 /// <returns></returns>
 public ProductApiModel Get(int no)
 {
     log.Info("start-获取产品详情");
     PublicModels.User u = SessionTool.Get <PublicModels.User>("user");
     if (u != null)
     {
         log.Info("获取产品详情,已经登录");
         bool isPeculiar = user.CheckIsPeculiar((int)u.No);
         if (isPeculiar)
         {
             log.Info("获取产品详情,已经登录,是会员");
             return(product.GetProduct(no));
         }
         else
         {
             log.Info("获取产品详情,已经登录,不是会员");
             return(new ProductApiModel()
             {
                 ResponseStatus = "不是会员"
             });
         }
     }
     else
     {
         log.Info("获取产品详情,未登录");
         return(new ProductApiModel()
         {
             ResponseStatus = "未登录"
         });
     }
 }
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="userParamModel"></param>
        /// <returns></returns>
        public string Post([FromBody] UserParamModel userParamModel)
        {
            if (userParamModel == null)
            {
                return("手机号不可为空");
            }
            if (string.IsNullOrEmpty(userParamModel.Mobile))
            {
                return("手机号不可为空");
            }
            if (string.IsNullOrEmpty(userParamModel.NickName))
            {
                return("昵称不可为空");
            }
            if (string.IsNullOrEmpty(userParamModel.RealName))
            {
                return("真实姓名不可为空");
            }
            if (string.IsNullOrEmpty(userParamModel.userpwd))
            {
                return("密码不可为空");
            }
            if (string.IsNullOrEmpty(userParamModel.Password))
            {
                return("密码不可为空");
            }
            if (userParamModel.userpwd != userParamModel.Password)
            {
                return("两次密码不一致");
            }
            if (string.IsNullOrEmpty(userParamModel.smscode))
            {
                return("短信验证码不可为空");
            }
            if (SessionTool.Get <string>("SmsCode") != userParamModel.smscode)
            {
                return("短信验证码错误");
            }
            int no = user.CreateUser(userParamModel);

            if (no > 0)
            {
                return("注册成功");
            }
            else if (no == 0)
            {
                return("注册失败");
            }
            else if (no == -1)
            {
                return("手机号已经注册");
            }
            else
            {
                log.Info("注册,逻辑异常,bll返回值为" + no);
                return("注册失败,服务异常");
            }
        }
Example #4
0
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     //base.OnActionExecuting(filterContext);
     PublicModels.User user = SessionTool.Get <PublicModels.User>("user");
     if (user == null)
     {
         filterContext.Result = new RedirectResult("/Me/Login");
     }
 }
        public ActionResult Sharemoney()
        {
            User   userInfo        = SessionTool.Get <User>("user");
            string spreadUrl       = "http://www.jiaodai.online/Me/SpreadRegister?fromUserNo=" + userInfo.No;
            string spreadQrCodeUrl = QrCode.CreateSpreadQrCode(spreadUrl, userInfo.NickName);

            ViewBag.SpreadQrCodeUrl = spreadQrCodeUrl;
            ViewBag.SpreadUrl       = spreadUrl;
            return(View());
        }
        public ActionResult MyShare()
        {
            User      userInfo = SessionTool.Get <User>("user");
            SpreadBLL bll      = new SpreadBLL();
            var       model    = bll.FindSpreadUser((int)userInfo.No);
            List <SpreadUserApiModel> teamSpread          = new List <SpreadUserApiModel>();
            List <SpreadUserApiModel> spreadUserApiModels = bll.FindSpreadUser((int)userInfo.No);

            foreach (var item in spreadUserApiModels)
            {
                List <SpreadUserApiModel> temp = bll.FindSpreadUser(item.ToUserNo);
                teamSpread = teamSpread.Concat(temp).ToList();
            }
            teamSpread         = teamSpread.Concat(bll.FindSpreadUser((int)userInfo.No)).ToList();
            ViewBag.TeamSpread = teamSpread;
            return(View(model));
        }
 public string CreateWithdrawApply(CreateWithdrawApplyParam param)
 {
     if (ModelState.IsValid)
     {
         User   userInfo         = SessionTool.Get <User>("user");
         string withdrawPassword = withdraw.GetWithdrawPassword((int)userInfo.No);
         if (param.WithdrawPassword != withdrawPassword)
         {
             return("提现密码错误");
         }
         UserBLL      userBLL             = new UserBLL();
         UserApiModel userApiModel1       = userBLL.GetUserInfo(Convert.ToInt32((int)userInfo.No));
         decimal      allowWithdrawAmount = userApiModel1.WithdrawAmount;
         if (param.ApplyWithwrawAmount <= allowWithdrawAmount)
         {
             WithdrawApplyApiModel model = new WithdrawApplyApiModel()
             {
                 Amount = allowWithdrawAmount,
                 ApplyWithwrawAmount = param.ApplyWithwrawAmount,
                 UserNo      = (int)userInfo.No,
                 ZFBAccount  = param.ZFBAccount,
                 SpareField1 = param.SpareField1
             };
             if (withdrawApply.Create(model) > 0)
             {
                 return("成功");
             }
             else
             {
                 return("失败");
             }
         }
         else
         {
             return("提现金额不可大于总金额,总金额为:" + allowWithdrawAmount);
         }
     }
     else
     {
         return("提现金额、提现密码和支付宝账号不可为空");
     }
 }
        public string SaveWithdrawPassword(string userpwd, string Password)
        {
            if (string.IsNullOrEmpty(userpwd) || string.IsNullOrEmpty(Password))
            {
                return("密码不可为空");
            }
            if (userpwd != Password)
            {
                return("两次输入的密码不一致");
            }
            User userInfo = SessionTool.Get <User>("user");

            if (withdraw.Save((int)userInfo.No, Password) > 0)
            {
                return("成功");
            }
            else
            {
                return("失败");
            }
        }
        /// <summary>
        /// 短信验证码登录
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="smscode"></param>
        /// <returns></returns>
        public string SmsLogin(string Mobile, string smscode)
        {
            if (string.IsNullOrEmpty(Mobile) || string.IsNullOrEmpty(smscode))
            {
                return("手机号和验证码不可为空");
            }
            if (SessionTool.Get <string>("SmsCode") != smscode)
            {
                return("短信验证码错误");
            }
            User userInfo = user.GetUserInfoByMobile(Mobile);

            if (userInfo != null && userInfo.No > 0)
            {
                SessionTool.Set("user", userInfo);
                return("登录成功");
            }
            else
            {
                return("用户不存在或手机号和密码不匹配");
            }
        }
 /// <summary>
 /// 论坛
 /// </summary>
 /// <returns></returns>
 public ActionResult Index()
 {
     PublicModels.User u = SessionTool.Get <PublicModels.User>("user");
     return(View());
 }
        public ActionResult Index()
        {
            User userInfo = SessionTool.Get <User>("user");

            return(View(userInfo.No));
        }
        public JsonResult SendWithdrawSms(string mobile, string verifyCode)
        {
            JsonResult json = new JsonResult();

            if (string.IsNullOrEmpty(mobile) || string.IsNullOrEmpty(verifyCode))
            {
                json.Data = new { Code = "NO", Message = "手机号和图形验证码不可为空。" };
                return(json);
            }
            string verify = SessionTool.Get <string>("verifyCode");

            log.Info("修改提现密码,Session中的图形验证码为:" + verify);
            if (verify != verifyCode)
            {
                json.Data = new { Code = "NO", Message = "图形验证码错误。" };
                return(json);
            }
            //01生成随机码
            long   tick = DateTime.Now.Ticks;
            Random ran  = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
            int    iResult;
            int    iUp   = 99999;
            int    iDown = 10000;

            iResult = ran.Next(iDown, iUp);
            string code = "8" + iResult.ToString();

            log.Info("修改提现密码,手机验证码为:" + code);
            SessionTool.Set("SmsCode", code);
            //02 调用阿里云短信接口
            IClientProfile   profile = DefaultProfile.GetProfile("cn-hangzhou", "LTAI4Fe7cxYGwM7MfJ2WHBuM", "EcwdmQTE3SlTgnRPU8EiCDv9LC5Rku");
            DefaultAcsClient client  = new DefaultAcsClient(profile);
            CommonRequest    request = new CommonRequest();

            request.Method  = MethodType.POST;
            request.Domain  = "dysmsapi.aliyuncs.com";
            request.Version = "2017-05-25";
            request.Action  = "SendSms";
            request.AddQueryParameters("PhoneNumbers", mobile);
            request.AddQueryParameters("SignName", "鑫汇");
            request.AddQueryParameters("TemplateCode", "SMS_174651230");
            request.AddQueryParameters("TemplateParam", "{\"code\":\"" + code + "\"}");
            try
            {
                log.Info("修改提现密码,发送短信,请求报文:" + JsonConvert.SerializeObject(request));
                CommonResponse response = client.GetCommonResponse(request);
                log.Info("修改提现密码,发送短信,response:" + JsonConvert.SerializeObject(response.Data));
                SmsResponseModel model = JsonConvert.DeserializeObject <SmsResponseModel>(response.Data);
                if (model.Code == "OK")
                {
                    json.Data = new { Code = "OK", Message = "验证码发送成功。" };
                }
                else
                {
                    json.Data = new { Code = "NO", Message = "验证码发送失败。" };
                }
            }
            catch (Aliyun.Acs.Core.Exceptions.ServerException e)
            {
                log.Info("修改提现密码,发送短信报异常,ServerException:" + JsonConvert.SerializeObject(e));
                json.Data = new { Code = "NO", Message = "验证码发送失败,ServerException异常。" };
            }
            catch (ClientException e)
            {
                log.Info("修改提现密码,发送短信报异常,ClientException:" + JsonConvert.SerializeObject(e));
                json.Data = new { Code = "NO", Message = "验证码发送失败,ClientException异常。" };
            }
            return(json);
        }