protected void Page_Load(object sender, EventArgs e) { bool success = false; viviapi.Model.User.UserInfo _systemUser = viviapi.BLL.User.Factory.GetModel(800); String key = _systemUser.APIKey; //返回参数 String orderid = Request["orderid"]; //返回订单号 String opstate = Request["opstate"]; //返回处理结果 String ovalue = Request["ovalue"]; //返回实际充值金额 String sign = Request["sign"]; //返回签名 String sysorderid = Request["sysorderid"]; String systime = Request["systime"]; String attach = Request["attach"]; String msg = Request["msg"]; String param = String.Format("orderid={0}&opstate={1}&ovalue={2}{3}", orderid, opstate, ovalue, key); //比对签名是否有效 if (sign == viviLib.Security.Cryptography.MD5(param)) { int status = 0; successAmt = ovalue; //执行操作方法 if (opstate.Equals("0") || opstate.Equals("-3")) { success = true; } else if (opstate.Equals("-1")) { //卡号密码错误 } else if (opstate.Equals("-2")) { //卡实际面值和提交时面值不符,卡内实际面值未使用 } else if (opstate.Equals("-4")) { //卡在提交之前已经被使用 } else if (opstate.Equals("-5")) { //失败,原因请查看msg } } else { } if (success) { } else { } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; try { string email = context.Request.QueryString["email"]; string code = context.Request.QueryString["code"]; string cacheKey = string.Format(Constant.EmailRegCodeCacheKey, email); string validcode = (string)viviapi.Cache.WebCache.GetCacheService().RetrieveObject(cacheKey); string msg = "验证码不正确"; if (code.ToUpper() == validcode.ToUpper()) { viviapi.Model.User.UserInfo user = new viviapi.Model.User.UserInfo(); user.Email = email; user.IsEmailPass = 0; user.isagentDistribution = 0; DataTable table = DataBase.ExecuteDataset(CommandType.Text, "select * from emailCode where email='" + email + "'").Tables[0]; int id = -1; if (table.Rows.Count > 0) { id = Convert.ToInt32(table.Rows[0]["ID"].ToString()); } else { id = DataBase.ExecuteNonQuery(CommandType.Text, string.Format("insert into emailCode (email,count) values ('{0}',1);SELECT @@IDENTITY", email)); } msg = id.ToString(); } context.Response.Write(msg); } catch { context.Response.Write("-1"); } }
protected void Page_Load(object sender, EventArgs e) { try { string userid = Request.Form["userid"]; string suppid = Request.Form["suppid"]; string orderid = Request.Form["orderid"]; string orderAmt = Request.Form["orderAmt"]; string bankcode = Request.Form["bankcode"]; string time = Request.Form["time"]; string sign = Request.Form["sign"]; bool success = false; #region if (!string.IsNullOrEmpty(userid) && !string.IsNullOrEmpty(time)) { DateTime sumTime; if (DateTime.TryParse(time, out sumTime)) { if (DateTime.Now.Subtract(sumTime).TotalSeconds <= 10) { int intUserid = 0; if (int.TryParse(userid, out intUserid)) { var userinfo = viviapi.BLL.User.Factory.GetCacheUserBaseInfo(intUserid); if (userinfo != null) { string thisSign = string.Format( "userid={0}&suppid={1}&orderid={2}&orderAmt={3}&bankcode={4}&time={5}{6}" , userid , suppid , orderid , orderAmt , bankcode , time , userinfo.APIKey); thisSign = viviLib.Security.Cryptography.MD5(thisSign); if (thisSign == sign) { success = true; } } } } } } #endregion if (success == true) { string payform = string.Empty; bool isdcode = (bankcode == "1003") || (bankcode == "1004"); if (isdcode) { viviapi.Model.User.UserInfo user = viviapi.BLL.User.Factory.GetCacheUserBaseInfo(int.Parse(userid)); if (user != null) { payform = viviapi.ETAPI.Common.SellFactory.GetDCodeForm(int.Parse(userid) , user.APIKey , int.Parse(suppid) , orderid , decimal.Parse(orderAmt) , bankcode); } } else { payform = viviapi.ETAPI.Common.SellFactory.GetPayForm(int.Parse(suppid), orderid, decimal.Parse(orderAmt), bankcode, false); } this.litpayform.Text = payform; } } catch (Exception ex) { ExceptionHandler.HandleException(ex); Response.Write("error"); Response.End(); } }