Exemple #1
0
        /// <summary>
        /// OnInit事件,检查用户是否登录
        /// </summary>
        void UserPage_Init(object sender, EventArgs e)
        {
            if (!IsUserLogin())
            {
                //微信自动登录
                var code = DTRequest.GetQueryString("code");
                if (!string.IsNullOrEmpty(code))
                {
                    MessageBus.Main.Publish(new UserLoginMsg(0, true, code, () =>
                    {
                        HttpContext.Current.Response.Redirect(linkurl("usercenter", "index"));
                    }));
                }

                //跳转URL
                HttpContext.Current.Response.Redirect(linkurl("login"));
                return;
            }
            //获得登录用户信息
            userModel  = GetUserInfoByLinq();
            groupModel = new BLL.user_groups().GetModel(userModel.group_id);
            if (groupModel == null)
            {
                groupModel = new Model.user_groups();
            }
            InitPage();
        }
        public async Task <IActionResult> Login(string userName, string password, string returnUrl = null)
        {
            ViewData["returnUrl"] = returnUrl;
            dt_users user = await _adminService.GetByStr(userName, password);

            if (user != null)
            {
                AuthenticationProperties props = new AuthenticationProperties
                {
                    IsPersistent = true,
                    ExpiresUtc   = DateTimeOffset.UtcNow.Add(TimeSpan.FromDays(1))
                };
                await HttpContext.SignInAsync(user.Id.ToString(), user.user_name, props);

                if (returnUrl != null)
                {
                    return(Redirect(returnUrl));
                }

                return(View());
            }
            else
            {
                return(View());
            }
        }
Exemple #3
0
        /// <summary>
        /// 查询普通项目的回款记录
        /// </summary>
        /// <param name="user"></param>
        /// <param name="type"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public static List <MyRepayment> QueryProjectRepayments(dt_users user, Agp2pEnums.MyRepaymentQueryTypeEnum type, string startTime = "", string endTime = "")
        {
            var myRepayingProjects = user.li_claims.Where(c =>
                                                          c.projectId == c.profitingProjectId && c.IsLeafClaim() &&
                                                          (int)Agp2pEnums.ProjectStatusEnum.Financing <= c.li_projects.status &&
                                                          c.status < (int)Agp2pEnums.ClaimStatusEnum.Transferred).ToLookup(cg => cg.li_projects);

            Model.siteconfig config = new siteconfig().loadConfig();

            var unsorted = myRepayingProjects.Select(p =>
            {
                var ratio = p.Sum(c => c.principal) / p.Key.investment_amount;
                var query = p.Key.li_repayment_tasks.Where(t => t.status != (int)Agp2pEnums.RepaymentStatusEnum.Invalid)
                            .Where(task => p.Key.dt_article_category.call_index != "newbie" || task.only_repay_to == user.id);

                if (!string.IsNullOrWhiteSpace(startTime))
                {
                    query = query.Where(tr => Convert.ToDateTime(startTime) <= tr.should_repay_time);
                }
                if (!string.IsNullOrWhiteSpace(endTime))
                {
                    query = query.Where(tr => tr.should_repay_time <= Convert.ToDateTime(endTime));
                }

                var validRepaymentTaskCount = query.Count();

                var reps1 =
                    query.Where(tr =>
                                type == Agp2pEnums.MyRepaymentQueryTypeEnum.Unpaid
                            ? tr.status < (int)Agp2pEnums.RepaymentStatusEnum.ManualPaid
                            : (int)Agp2pEnums.RepaymentStatusEnum.ManualPaid <= tr.status)
                    .Select(task => new MyRepayment
                {
                    RepaymentId    = task.id,
                    Project        = null,
                    RepayInterest  = Math.Round(task.repay_interest * ratio, 2),
                    RepayPrincipal = Math.Round(task.repay_principal * ratio, 2),
                    ShouldRepayDay = task.should_repay_time.ToString("yyyy/MM/dd"),
                    Term           = task.term.ToString() + "/" + validRepaymentTaskCount
                }).ToList();

                if (!reps1.Any())
                {
                    return(Enumerable.Empty <MyRepayment>());
                }
                reps1.First().Project = new MyInvestProject
                {
                    Id                 = p.Key.id,
                    Name               = p.Key.title,
                    Link               = linkurl(config, "project", p.Key.id),
                    InvestValue        = p.Sum(c => c.principal),
                    ProfitRateYear     = p.Key.GetProfitRateYearly(),
                    InvestCompleteTime = p.Key.invest_complete_time
                };

                return(reps1);
            }).ToList();

            return(unsorted.Where(ts => ts.Any()).OrderBy(ts => ts.First().ShouldRepayDay).SelectMany(x => x).ToList());
        }
Exemple #4
0
 public static List <TrialTicket> QueryTicket(dt_users user)
 {
     return(user.li_activity_transactions
            .Where(atr => atr.activity_type == (byte)Agp2pEnums.ActivityTransactionActivityTypeEnum.TrialTicket &&
                   atr.status == (byte)Agp2pEnums.ActivityTransactionStatusEnum.Acting)
            .AsEnumerable().Select(atr => new TrialTicket(atr)).ToList());
 }
Exemple #5
0
        public async Task <HttpResponseMessage> Login(string userName, string password, string returnUrl = null)
        {
            ViewData["returnUrl"] = returnUrl;
            dt_users user = await _adminService.GetByStr(userName, password);

            var response = new HttpResponseMessage();

            response.Content = new StringContent("");
            response.Content.Headers.ContentType         = new MediaTypeHeaderValue("text/html");
            response.Content.Headers.ContentType.CharSet = "utf-8";
            if (user != null)
            {
                AuthenticationProperties props = new AuthenticationProperties
                {
                    IsPersistent = true,
                    ExpiresUtc   = DateTimeOffset.UtcNow.Add(TimeSpan.FromDays(1))
                };
                await HttpContext.SignInAsync(user.Id.ToString(), user.user_name, props);

                HttpResponseMessage resp = new HttpResponseMessage(HttpStatusCode.Moved);
                resp.Headers.Location = new Uri("http://localhost:5002/" + returnUrl);
                return(resp);
            }
            else
            {
                response.Content = new StringContent("无效的订单id!");
                return(response);
            }
        }
Exemple #6
0
 protected decimal QueryWithdrawingMoney(dt_users user)
 {
     return(user.li_bank_transactions.Where(
                t =>
                t.status == (int)Agp2pEnums.BankTransactionStatusEnum.Acting &&
                t.type == (int)Agp2pEnums.BankTransactionTypeEnum.Withdraw).Select(t => t.value).AsEnumerable().Sum());
 }
        public static List<HongBao> QueryHongBao(dt_users user)
        {
            return user.li_activity_transactions
                .Where(atr => atr.activity_type == (byte)Agp2pEnums.ActivityTransactionActivityTypeEnum.HongBao &&
                atr.status == (byte)Agp2pEnums.ActivityTransactionStatusEnum.Acting)
                .AsEnumerable().Select(atr => new HongBao(atr)).ToList();

        }
 public static string GetFriendlyUserName(this dt_users user)
 {
     if (!string.IsNullOrWhiteSpace(user.real_name))
     {
         return($"{user.user_name}({user.real_name})");
     }
     return(!string.IsNullOrWhiteSpace(user.nick_name) ? $"{user.user_name}({user.nick_name})" : user.user_name);
 }
Exemple #9
0
 protected string QueryInvestmentToday(dt_users user)
 {
     return
         (user.li_project_transactions.Where(
              tr =>
              tr.status == (int)Agp2pEnums.ProjectTransactionStatusEnum.Success &&
              tr.type == (int)Agp2pEnums.ProjectTransactionTypeEnum.Invest &&
              tr.create_time.Date == DateTime.Now.Date).Sum(t => t.principal).ToString("c"));
 }
Exemple #10
0
 public RankItem(dt_users u, DateTime?startTime, DateTime?endTime)
 {
     User           = u;
     _investmentSum = new Lazy <decimal>(() => QueryInvestmentSum(u, startTime, endTime));
     _inviteeCount  = new Lazy <int>(() =>
                                     u.li_invitations1.Where(inv => inv.first_invest_transaction != null)
                                     .Where(inv => startTime == null || startTime <= inv.dt_users.reg_time)
                                     .Where(inv => endTime == null || inv.dt_users.reg_time <= endTime).Count());
     _inviteeInvestmentSum = new Lazy <decimal>(() => QueryInviteeInvestmentSum(u, startTime, endTime));
 }
Exemple #11
0
 protected static decimal QueryInvestmentSum(dt_users user, DateTime?startTime, DateTime?endTime)
 {
     return(user.li_project_transactions
            .Where(
                t =>
                t.status == (int)Agp2pEnums.ProjectTransactionStatusEnum.Success &&
                t.type == (int)Agp2pEnums.ProjectTransactionTypeEnum.Invest)
            .Where(t => startTime == null || startTime <= t.create_time)
            .Where(t => endTime == null || t.create_time <= endTime)
            .Select(t => t.principal).AsEnumerable().DefaultIfEmpty(0).Sum());
 }
Exemple #12
0
 protected static decimal QueryInviteeInvestmentSum(dt_users user, DateTime?startTime, DateTime?endTime)
 {
     return(user.li_invitations1.Where(
                i =>
                i.li_project_transactions != null &&
                i.li_project_transactions.status == (int)Agp2pEnums.ProjectTransactionStatusEnum.Success)
            .Where(i => startTime == null || startTime <= i.dt_users.reg_time)
            .Where(i => endTime == null || i.dt_users.reg_time <= endTime)
            .Select(i => i.li_project_transactions.principal).AsEnumerable()
            .DefaultIfEmpty(0)
            .Sum());
 }
Exemple #13
0
        /// <summary>
        /// 验证用户,成功则返回用户信息,否则返回null
        /// </summary>
        /// <param name="username"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public async Task <dt_users> GetByStr(string username, string pwd)
        {
            dt_users m = await db.dt_users.Where(a => a.user_name == username && a.site_id == Convert.ToInt32(pwd)).SingleOrDefaultAsync();

            if (m != null)
            {
                return(m);
            }
            else
            {
                return(null);
            }
        }
Exemple #14
0
 private bool CheckUserLogin(out dt_users user, bool checkToken = true)
 {
     user = BasePage.GetUserInfoByLinq();
     if (user == null)
     {
         Response.Write("对不起,用户尚未登录或已超时!");
         return(false);
     }
     if (checkToken && string.IsNullOrEmpty(user.identity_id))
     {
         Response.Write("请先开通托管账户!");
         return(false);
     }
     return(true);
 }
Exemple #15
0
        /// <summary>
        /// 业务员开放注册
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="name"></param>
        /// <param name="telphone"></param>
        /// <returns>1:成功,0:失败,-1:用户名已存在</returns>
        public int AddSalesman(string username, string password, string name, string telphone)
        {
            SqlSugarHelper helper = new SqlSugarHelper();
            int            reun   = helper.Db.Queryable <Models.dt_users>().Where(m => m.username == username).Count();

            if (reun > 0)
            {
                return(-1);
            }
            string maxbh  = helper.Db.Ado.GetScalar("select maxbh from dt_Maxbh where BiaoShi='YW'").ToString();
            string entid  = helper.Db.Ado.GetScalar("select top 1 entid from dt_entdoc").ToString();
            string userid = (Convert.ToInt32(maxbh) + 1).ToString();

            while (userid.Length < 7)
            {
                userid = "0" + userid;
            }
            userid = "YW" + userid;
            Models.dt_users model = new dt_users
            {
                userid    = userid,
                entid     = entid,
                username  = username,
                password  = Encryption.GetMD5_16(password),
                name      = name,
                telphone  = telphone,
                role_type = 3,// 业务员
                status    = 1,
                salt      = "2H8H0P",
                role_id   = 1,
                add_time  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
            };
            int flag = helper.Db.Insertable(model).ExecuteCommand();

            if (flag > 0)
            {
                int new_maxbh = Convert.ToInt32(maxbh) + 1;
                helper.Db.Ado.ExecuteCommand("update dt_Maxbh set [maxbh]=" + new_maxbh + " where BiaoShi='YW'");
            }
            return(flag);
        }
Exemple #16
0
        protected Tuple <List <li_bank_accounts>, string> GetWithdrawableCards(dt_users user)
        {
            var allCards      = user.li_bank_accounts.ToList();
            var quickPayCards = allCards.Where(ac => ac.type == (int)Agp2pEnums.BankAccountType.QuickPay).ToList();

            if (quickPayCards.Count == 1)
            {
                return(new Tuple <List <li_bank_accounts>, string>(quickPayCards, ""));
            }
            else if (allCards.All(ac => ac.type == (int)Agp2pEnums.BankAccountType.Unknown))
            {
                return(new Tuple <List <li_bank_accounts>, string>(allCards, "尊敬的会员,因您未在丰付平台中绑定银行卡,所以在丰付平台提现时需要手动输入银行卡号。"));
            }
            else if (allCards.All(ac => ac.type == (int)Agp2pEnums.BankAccountType.WebBank))
            {
                return(new Tuple <List <li_bank_accounts>, string>(Enumerable.Empty <li_bank_accounts>().ToList(), "尊敬的会员,因您在安广融合平台绑定的银行卡与丰付平台绑定的银行卡不一致,请重新绑定。"));
            }
            else
            {
                return(new Tuple <List <li_bank_accounts>, string>(Enumerable.Empty <li_bank_accounts>().ToList(), "查询银行卡出错,请联系客服"));
            }
        }
Exemple #17
0
 private void LoadAlbum(dt_users model, Agp2pEnums.AlbumTypeEnum type)
 {
     string[] albumArr  = Request.Form.GetValues("hid_photo_name");
     string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
     DBContext.li_albums.DeleteAllOnSubmit(DBContext.li_albums.Where(a => a.the_user == model.id && a.type == (int)type));
     if (albumArr != null && remarkArr != null)
     {
         var preAdd = albumArr.Zip(remarkArr, (album, remark) =>
         {
             var albumSplit = album.Split('|');
             return(new li_albums
             {
                 original_path = albumSplit[1],
                 thumb_path = albumSplit[2],
                 remark = remark,
                 add_time = DateTime.Now,
                 dt_users = model,
                 type = (byte)type
             });
         });
         DBContext.li_albums.InsertAllOnSubmit(preAdd);
     }
 }
Exemple #18
0
 protected static string GetFriendlyUserName(dt_users user)
 {
     return(string.IsNullOrWhiteSpace(user.real_name)
         ? user.user_name
         : $"{user.user_name}({user.real_name})");
 }
 public static bool IsCompanyAccount(this dt_users user)
 {
     return(user.dt_user_groups.title == AutoRepay.CompanyAccount);
 }
 public static bool IsAgent(this dt_users user)
 {
     return(user.dt_user_groups.title == AutoRepay.AgentGroup);
 }
Exemple #21
0
        public static string Apply(string userName, string mobile, string type)
        {
            try
            {
                Agp2pDataContext context = new Agp2pDataContext();
                if (context.dt_users.SingleOrDefault(u => u.user_name == userName && u.mobile == mobile) == null)
                {
                    if (!new Regex(@"^[\u4e00-\u9fa5·]{2,15}$").IsMatch(userName))
                    {
                        return(JsonConvert.SerializeObject(new
                        {
                            status = 2,
                            msg = "请输入正确的中文姓名!"
                        }));
                    }

                    if (!new Regex(@"^\d{11}$").IsMatch(mobile))
                    {
                        return(JsonConvert.SerializeObject(new
                        {
                            status = 2,
                            msg = "请输入正确的手机号码!"
                        }));
                    }
                    //申请人ip,30分钟内只允许申请一次
                    string userip = DTRequest.GetIP();
                    var    userA  = context.dt_users.OrderByDescending(u => u.reg_time).FirstOrDefault(u => u.reg_ip == userip);
                    if (userA != null && DateTime.Now.Subtract((DateTime)userA.reg_time).TotalMinutes <= 30)
                    {
                        return(JsonConvert.SerializeObject(new
                        {
                            status = 2,
                            msg = "30分钟内只允许申请一次!"
                        }));
                    }

                    var user = new dt_users();
                    user.user_name = userName;
                    user.mobile    = mobile;
                    var group = context.dt_user_groups.SingleOrDefault(u => u.title.Equals("融资合作组"));
                    user.group_id = @group?.id ?? 1;
                    user.salt     = Utils.GetCheckCode(6);
                    user.password = DESEncrypt.Encrypt("a123456", user.salt);
                    user.status   = 1;
                    user.area     = type;
                    user.reg_ip   = userip;
                    user.reg_time = DateTime.Now;
                    context.dt_users.InsertOnSubmit(user);
                    context.SubmitChanges();
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        status = 2,
                        msg = "申请人信息已存在!"
                    }));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(JsonConvert.SerializeObject(new
            {
                status = 1,
                msg = "ok"
            }));
        }
Exemple #22
0
        /// <summary>
        /// 用户登陆回调
        /// </summary>
        /// <param name="context"></param>
        /// <param name="userId"></param>
        /// <param name="regTime"></param>
        private static void NewUser(int userId, bool remember, string code, Action doLogin)
        {
            var context = new Agp2pDataContext();
            //string openId = string.Empty;
            dt_users user = null;

            //微信端进入时获取客户openId
            //if (!string.IsNullOrEmpty(code))
            //{
            //    try
            //    {
            //        //根据微信oauth返回的code获取用户openid
            //        var accountModel = context.dt_weixin_account.SingleOrDefault(a => a.id == 1);
            //        var accessToken = OAuth.GetAccessToken(accountModel.appid, accountModel.appsecret, code);
            //        openId = accessToken.openid;
            //    }
            //    catch (Exception)
            //    {
            //        //暂不处理
            //        return;
            //    }
            //}

            //userId为0则是通过微信号自动登录
            //if (userId == 0)
            //{
            //    user = context.dt_users.SingleOrDefault(u => u.openid == openId);
            //    //没有绑定微信号的不自动登录
            //    if (user == null) return;
            //}
            //else
            user = context.dt_users.Single(u => u.id == userId);

            //检查用户每天登录是否获得积分

            /* var userLog = context.dt_user_login_log.OrderByDescending(u => u.login_time).FirstOrDefault(u => u.user_name == user.user_name);
             * if (userLog != null && userLog.login_time != null && ((DateTime)userLog.login_time).Day != DateTime.Now.Day)
             * {
             *  MessageBus.Main.PublishAsync(new UserPointMsg(user.id, user.user_name, (int)Agp2pEnums.PointEnum.Sign));
             * } */

            //记住登录状态下次自动登录
            if (remember)
            {
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "Agp2p", user.user_name, 43200, true);
            }
            else
            {
                // 清除用户名 cookie
                //Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "Agp2p", user.user_name, true);
                Utils.WriteCookie(DTKeys.COOKIE_USER_NAME_REMEMBER, "Agp2p", -43200);
            }

            //写入登录日志
            var dtUserLoginLog = new dt_user_login_log
            {
                user_id    = user.id,
                user_name  = user.user_name,
                remark     = "会员登录",
                login_ip   = DTRequest.GetIP(),
                login_time = DateTime.Now
            };

            context.dt_user_login_log.InsertOnSubmit(dtUserLoginLog);

            //绑定微信openId
            //if (string.IsNullOrEmpty(user.openid) && !string.IsNullOrEmpty(openId))
            //    user.openid = openId;

            context.SubmitChanges();

            //微信自动登录回调
            //if (doLogin != null) doLogin();
        }
        public IHttpActionResult Register([FromFormData] string mobile, [FromFormData] string password, [FromFormData] string verifyCode, [FromFormData] string inviter)
        {
            if (!MobileRegex.IsMatch(mobile))
            {
                return(BadRequest("手机号码的格式不正确"));
            }
            if (!PasswordRegex.IsMatch(password))
            {
                return(BadRequest("请输入6-16数字或字母的密码"));
            }

            var context = new Lip2pDataContext();

            if (context.dt_users.Any(u => u.mobile == mobile))
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.Conflict, "此手机已被注册")));
            }

            var strcode = (string)MemoryCache.Default["Reg-verify:" + mobile];

            if (strcode != verifyCode)
            {
                Debug.WriteLine("Verify: {0}, infact: {1}", strcode, verifyCode);
                return(BadRequest("短信验证码错误"));
            }

            var defaultGroup = context.dt_user_groups.FirstOrDefault(g => g.is_default == 1);

            if (defaultGroup == null)
            {
                return(InternalServerError(new Exception("用户尚未分组,请联系网站管理员")));
            }

            var salt    = Utils.GetCheckCode(6);
            var newUser = new dt_users
            {
                group_id  = defaultGroup.id,
                user_name = mobile,
                salt      = salt, //获得6位的salt加密字符串
                password  = DESEncrypt.Encrypt(password, salt),
                mobile    = mobile,
                reg_ip    = Request.GetClientIp(),
                reg_time  = DateTime.Now,
                status    = 0,
            };

            context.dt_users.InsertOnSubmit(newUser);

            // 查出邀请人
            if (!string.IsNullOrWhiteSpace(inviter))
            {
                var inviteUser = context.dt_users.SingleOrDefault(u => u.mobile == inviter || u.user_name == inviter);
                if (inviteUser == null)
                {
                    var code = context.dt_user_code.SingleOrDefault(c => c.str_code == inviter && c.type == DTEnums.CodeEnum.Register.ToString());
                    if (code != null)
                    {
                        inviteUser = code.dt_users;
                    }
                }
                if (inviteUser != null)
                {
                    var liInvitations = new li_invitations
                    {
                        dt_users  = newUser,
                        dt_users1 = inviteUser
                    };
                    context.li_invitations.InsertOnSubmit(liInvitations);
                    // 会员部功能,被推荐人自动归组
                    if (inviteUser.li_user_group_servers != null)
                    {
                        newUser.group_id = inviteUser.li_user_group_servers.group_id;
                    }
                }
            }

            try
            {
                context.SubmitChanges();
                // 广播新用户注册消息
                MessageBus.Main.PublishAsync(new NewUserCreatedMsg(newUser.id, newUser.reg_time.Value));
                return(Ok("注册成功"));
            }
            catch (Exception ex)
            {
                return(InternalServerError(new Exception("注册失败:" + ex.Message)));
            }
        }
Exemple #24
0
 protected int GetBankTransactionCount(dt_users user)
 {
     return(user.li_bank_transactions.Count + user.li_bank_accounts.Sum(a => a.li_bank_transactions.Count));
 }
Exemple #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //TODO 在页面显示错误提示
            dt_users   user       = null;
            BaseReqMsg reqMsg     = null;
            int        requestApi = DTRequest.GetQueryInt("api", 0);

            switch (requestApi)
            {
            //个人/企业开户
            case (int)Agp2pEnums.SumapayApiEnum.URegi:
                if (!CheckUserLogin(out user, false))
                {
                    return;
                }
                reqMsg = user.dt_user_groups.title.Equals(GroupName) ? new CompanyRegisterReqMsg(user.id) : new UserRegisterReqMsg(user.id, user.mobile, user.real_name, user.id_card_number, user.token);
                break;

            case (int)Agp2pEnums.SumapayApiEnum.URegM:
                if (!CheckUserLogin(out user, false))
                {
                    return;
                }
                reqMsg = new UserRegisterMoblieReqMsg(user.id, user.mobile, user.real_name, user.id_card_number, user.token,
                                                      HttpContext.Current.Request.UrlReferrer.ToString().ToLower());
                break;

            //个人账户激活
            case (int)Agp2pEnums.SumapayApiEnum.Activ:
                if (!CheckUserLogin(out user, false))
                {
                    return;
                }
                reqMsg = new UserActivateReqMsg(user.id);
                break;

            //跳转托管账户
            case (int)Agp2pEnums.SumapayApiEnum.Accou:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = user.dt_user_groups.title.Equals(GroupName) ? new CompanyToAccountReqMsg(user.id) : new UserToAccountReqMsg(user.id);
                break;

            case (int)Agp2pEnums.SumapayApiEnum.AccoM:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new UserToAccountReqMsg(user.id, HttpContext.Current.Request.UrlReferrer.ToString().ToLower());
                break;

            //个人自动投标续约
            case (int)Agp2pEnums.SumapayApiEnum.AtBid:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new AutoBidSignReqMsg(user.id);
                break;

            //个人自动投标取消
            case (int)Agp2pEnums.SumapayApiEnum.ClBid:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new AutoBidSignReqMsg(user.id, true, user.protocolCode);
                break;

            //个人/企业 自动账户/银行还款开通
            case (int)Agp2pEnums.SumapayApiEnum.AcReO:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = user.dt_user_groups.title.Equals(GroupName) ?
                         new CompanyRepaySignReqMsg(user.id, DTRequest.GetQueryInt("projectCode"), DTRequest.GetQueryString("repayLimit")) :
                         new AutoRepaySignReqMsg(user.id, DTRequest.GetQueryInt("projectCode"), DTRequest.GetQueryString("repayLimit"), false);
                break;

            case (int)Agp2pEnums.SumapayApiEnum.AbReO:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new AutoRepaySignReqMsg(user.id, DTRequest.GetQueryInt("projectCode"), DTRequest.GetQueryString("repayLimit"), true);
                break;

            //个人/企业 自动还款取消
            case (int)Agp2pEnums.SumapayApiEnum.ClRep:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = user.dt_user_groups.title.Equals(GroupName) ?
                         new CompanyAutoRepayCancelReqMsg(user.id, DTRequest.GetQueryInt("projectCode")) :
                         new AutoRepayCancelReqMsg(user.id, DTRequest.GetQueryInt("projectCode"));
                break;

            //个人网银充值
            case (int)Agp2pEnums.SumapayApiEnum.WeRec:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = user.dt_user_groups.title.Equals(GroupName) ?
                         new CompanyWebRechargeReqMsg(user.id, DTRequest.GetQueryString("sum"), DTRequest.GetQueryString("bankCode")) :
                         new WebRechargeReqMsg(user.id, DTRequest.GetQueryString("sum"), DTRequest.GetQueryString("bankCode"));
                break;

            //个人一键充值
            case (int)Agp2pEnums.SumapayApiEnum.WhRec:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                if (user.dt_user_groups.title.Equals(GroupName))
                {
                    Response.Write("对不起,企业用户不能使用快捷充值!");
                    return;
                }
                reqMsg = new WhRechargeReqMsg(user.id,
                                              DTRequest.GetQueryString("sum"));
                break;

            //个人移动端一键充值
            case (int)Agp2pEnums.SumapayApiEnum.WhReM:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                if (user.dt_user_groups.title.Equals(GroupName))
                {
                    Response.Write("对不起,企业用户不能使用快捷充值!");
                    return;
                }
                reqMsg = new WhRechargeReqMsg(user.id,
                                              DTRequest.GetQueryString("sum"), DTRequest.GetQueryString("backUrl"), "", "3", "", "");
                break;

            //个人/企业 提现
            case (int)Agp2pEnums.SumapayApiEnum.Wdraw:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = user.dt_user_groups.title.Equals(GroupName) ?
                         new CompanyWithdrawReqMsg(user.id, DTRequest.GetQueryString("sum"), DTRequest.GetQueryString("bankId"), DTRequest.GetQueryString("bankName"), DTRequest.GetQueryString("bankAccount")) :
                         new WithdrawReqMsg(user.id, DTRequest.GetQueryString("sum"), DTRequest.GetQueryString("bankId"), DTRequest.GetQueryString("bankName"), DTRequest.GetQueryString("bankAccount"), "3", "", "");
                break;

            //个人移动端提现
            case (int)Agp2pEnums.SumapayApiEnum.WdraM:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new WithdrawReqMsg(user.id, DTRequest.GetQueryString("sum"),
                                            DTRequest.GetQueryString("bankId"), DTRequest.GetQueryString("backUrl"), "3", "", "");
                break;

            //个人投标 普通/集合项目
            case (int)Agp2pEnums.SumapayApiEnum.MaBid:
            case (int)Agp2pEnums.SumapayApiEnum.McBid:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new ManualBidReqMsg(user.id,
                                             DTRequest.GetQueryInt("projectCode"), DTRequest.GetQueryString("sum"),
                                             DTRequest.GetQueryString("projectSum"), DTRequest.GetQueryString("projectDescription"), DTRequest.GetQueryInt("ticketId"),
                                             requestApi == (int)Agp2pEnums.SumapayApiEnum.McBid);
                reqMsg.Remarks = DTRequest.GetQueryString("ticketId");
                break;

            //个人移动端投标 普通/集合项目
            case (int)Agp2pEnums.SumapayApiEnum.MaBiM:
            case (int)Agp2pEnums.SumapayApiEnum.McBiM:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new ManualBidReqMsg(user.id,
                                             DTRequest.GetQueryInt("projectCode"), DTRequest.GetQueryString("sum"),
                                             DTRequest.GetQueryString("projectSum"), DTRequest.GetQueryString("projectDescription"), DTRequest.GetQueryInt("ticketId"),
                                             DTRequest.GetQueryString("backUrl"), requestApi == (int)Agp2pEnums.SumapayApiEnum.McBid);
                reqMsg.Remarks = DTRequest.GetQueryString("ticketId");
                break;

            //个人/企业 存管账户还款普通/集合项目 TODO Remarks移动到RequestApiHandle处理
            case (int)Agp2pEnums.SumapayApiEnum.MaRep:
            case (int)Agp2pEnums.SumapayApiEnum.McRep:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = user.dt_user_groups.title.Equals(GroupName) ?
                         new CompanyAccountRepayReqMsg(user.id, DTRequest.GetQueryInt("projectCode"), DTRequest.GetQueryString("sum"),
                                                       "http://" + HttpContext.Current.Request.Url.Authority.ToLower() +
                                                       "/user/center/index.html#/recharge", requestApi == (int)Agp2pEnums.SumapayApiEnum.McRep) :
                         new AccountRepayReqMsg(user.id, DTRequest.GetQueryInt("projectCode"), DTRequest.GetQueryString("sum"),
                                                "http://" + HttpContext.Current.Request.Url.Authority.ToLower() +
                                                "/user/center/index.html#/recharge", requestApi == (int)Agp2pEnums.SumapayApiEnum.McRep);
                reqMsg.Remarks = $"isEarly=false&repayTaskId={DTRequest.GetQueryString("repayTaskId")}";
                break;

            //个人协议还款普通/集合项目 TODO Remarks移动到RequestApiHandle处理
            case (int)Agp2pEnums.SumapayApiEnum.BaRep:
            case (int)Agp2pEnums.SumapayApiEnum.BcRep:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new BankRepayReqMsg(user.id, DTRequest.GetQueryInt("projectCode"), DTRequest.GetQueryString("sum")
                                             , requestApi == (int)Agp2pEnums.SumapayApiEnum.BcRep);
                reqMsg.Remarks = $"isEarly=false&repayTaskId={DTRequest.GetQueryString("repayTaskId")}";
                break;

            //债权转让
            case (int)Agp2pEnums.SumapayApiEnum.CreAs:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new CreditAssignmentReqMsg(user.id, DTRequest.GetQueryInt("claimId"), DTRequest.GetQueryString("undertakeSum"));
                break;

            //移动端债权转让
            case (int)Agp2pEnums.SumapayApiEnum.CreAM:
                if (!CheckUserLogin(out user))
                {
                    return;
                }
                reqMsg = new CreditAssignmentReqMsg(user.id, DTRequest.GetQueryInt("claimId"), DTRequest.GetQueryString("undertakeSum"), DTRequest.GetQueryString("backUrl"), "1", "", "");
                break;

            default:
                reqMsg = new BaseReqMsg();
                break;
            }
            //生成、保存请求内容
            MessageBus.Main.Publish(reqMsg);
            //跳转丰付平台开通托管账户
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GBK");
            Response.Write(reqMsg.RequestContent);
        }
 private static string GetUserPassword(dt_users user)
 {
     return(DESEncrypt.Decrypt(user.password, user.salt));
 }