/// <summary>
 /// 登录
 /// </summary>
 /// <param name="value"></param>
 public string Post([FromBody] UserParamModel userParamModel)
 {
     if (userParamModel != null)
     {
         if (!string.IsNullOrEmpty(userParamModel.Mobile) && !string.IsNullOrEmpty(userParamModel.Password))
         {
             User userInfo = user.GetUserInfo(userParamModel.Mobile, userParamModel.Password);
             if (userInfo != null && userInfo.No > 0)
             {
                 //缓存到redis
                 //cache.SetCache(userInfo.No.ToString(), userInfo);
                 SessionTool.Set("user", userInfo);
                 return("登录成功");
             }
             else
             {
                 return("用户不存在或手机号和密码不匹配");
             }
         }
         else
         {
             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("用户不存在或手机号和密码不匹配");
            }
        }
        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);
        }