예제 #1
0
 /// <summary>
 /// 根据用户名密码返回一个实体
 /// </summary>
 /// <param name="user_name">用户名(明文)</param>
 /// <param name="password">密码</param>
 /// <param name="emaillogin">是否允许邮箱做为登录</param>
 /// <param name="mobilelogin">是否允许手机做为登录</param>
 /// <param name="is_encrypt">是否需要加密密码</param>
 /// <returns></returns>
 public Model.users GetModel(string user_name, string password, int emaillogin, int mobilelogin, bool is_encrypt)
 {
     //检查一下是否需要加密
     if (is_encrypt)
     {
         //先取得该用户的随机密钥
         string salt = dal.GetSalt(user_name);
         if (string.IsNullOrEmpty(salt))
         {
             return(null);
         }
         //2015-4-21 minson 判断是否天润旧用户,如果是用md5验证旧密码
         var context = new Agp2p.Linq2SQL.Agp2pDataContext();
         var user    = context.dt_users.FirstOrDefault(u => u.user_name == user_name);
         if (user != null && string.IsNullOrEmpty(user.password))
         {
             if (user.salt.Equals(Utils.MD5(password)))
             {
                 try
                 {
                     //使用当前系统加密方法
                     salt          = Utils.GetCheckCode(6);
                     password      = DESEncrypt.Encrypt(password, salt);
                     user.salt     = salt;
                     user.password = password;
                     context.SubmitChanges();
                 }
                 catch (Exception ex)
                 {
                     return(null);
                 }
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             //把明文进行加密重新赋值
             password = DESEncrypt.Encrypt(password, salt);
         }
     }
     return(dal.GetModel(user_name, password, emaillogin, mobilelogin));
 }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string billNo      = Request.Params["BillNo"];      //商户流水号
            string amount      = Request.Params["Amount"];      //实际成交金额
            string succeed     = Request.Params["Succeed"];     //状态码
            string result      = Request.Params["Result"];      //支付结果描述
            string signMD5info = Request.Params["SignMD5info"]; //md5签名

            var context  = new Agp2p.Linq2SQL.Agp2pDataContext();
            var bankTran = context.li_bank_transactions.FirstOrDefault(b => b.no_order == billNo);

            if (bankTran != null && Helper.CheckReturnMD5(billNo, amount, succeed, signMD5info, bankTran.pay_api == (int)Agp2pEnums.PayApiTypeEnum.EcpssQ))
            {
                //md5校验成功,输出OK
                Response.Write("ok");
                if (succeed.Equals("88"))
                {
                    //开始下面的操作,处理订单
                    try
                    {
                        if (bankTran.status == (int)Agp2p.Common.Agp2pEnums.BankTransactionStatusEnum.Acting)
                        {
                            context.ConfirmBankTransaction(bankTran.id, null);
                            new BLL.manager_log().Add(1, "admin", "ReCharge", "支付成功(" + billNo + ")!来自异步通知。");
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new InvalidEnumArgumentException("确认充值信息失败(" + billNo + "):" + ex.Message);
                    }
                }
                else
                {
                    new BLL.manager_log().Add(1, "admin", "ReCharge", "支付失败(" + billNo + "):" + Helper.GetResultInfo(succeed));
                }
            }
            else
            {
                new BLL.manager_log().Add(1, "admin", "ReCharge", "支付失败(" + billNo + "),MD5验证不通过!");
                Response.Write("fail");
            }
        }