private void GetAccountSummary(Hashtable Params) { string passport = PickParam(Params).GetValueAsString(); if (string.IsNullOrEmpty(passport)) { PickParam(Params).Clear().SetError("未传入通行证"); } else { // 得到会员信息 DataSet dsMember = new ParamUtil().SQLCmdLoadData().SQLEntityScript("CAIKA_MEMBER", string.Format("SELECT * FROM CAIKA_MEMBER WHERE SSOPST='{0}'", passport)) .ExecuteCmd(ADataLoader.DataLoader()).GetValueAsDataSet(); if (dsMember.Tables["CAIKA_MEMBER"].Rows.Count == 0) { PickParam(Params).Clear().SetError("未找到会员记录"); } else { // 通行证+超级密码 string key = new DictSetUtil(null).PushSLItem(passport).PushSLItem("6B276432FFAF4FD4E086E739009256B3") .DoSignature(); DictSetUtil dsSummary = new DictSetUtil(AEntryDic.Pick().GetDic(key)); dsSummary.SetValue("NICKNAME", dsMember.Tables["CAIKA_MEMBER"].Rows[0]["NICKNAME"].ToString()); PickParam(Params).Clear(); PickParam(Params).SetParam(dsSummary.MyDS); // 将账户摘要同步到Member表中 if (dsMember.Tables["CAIKA_MEMBER"].Rows[0]["UPDFLAG"].ToString() != "N") { dsMember.Tables["CAIKA_MEMBER"].Rows[0]["TOTALAMOUNT"] = dsSummary.GetValue("TOTALAMOUNT"); dsMember.Tables["CAIKA_MEMBER"].Rows[0]["AVAILABLE"] = dsSummary.GetValue("AVAILABLE"); dsMember.Tables["CAIKA_MEMBER"].Rows[0]["FREEZED"] = dsSummary.GetValue("FREEZED"); dsMember.Tables["CAIKA_MEMBER"].Rows[0]["SCORE"] = dsSummary.GetValue("SCORE"); dsMember.Tables["CAIKA_MEMBER"].Rows[0]["UPDFLAG"] = "N"; new ParamUtil().SQLCmdPersistent().SetParam(dsMember).ExecuteCmd(ADataLoader.DataLoader()); } } } }
private void PostMemberInfo(Hashtable Params) { string account = PickParam(Params).GetValueAsString(); string c_pass = PickParam(Params).GetValueAsString("c_pass"); DataSet ds_member = PickParam(Params).GetValueAsDataSet("member"); try { if (string.IsNullOrEmpty(account)) { throw new ArgumentNullException("account", "未传入账户名"); } if (string.IsNullOrEmpty(c_pass)) { throw new ArgumentNullException("c_pass", "未传入登录密码"); } if (ds_member == null) { throw new ArgumentNullException("member", "未传入会员数据"); } DictSetUtil dsinfo = new DictSetUtil(ds_member); // 验证密码 ParamUtil verifyPwd = new ParamUtil().SetCmd(CVerifyPasswrod).SetParam(account).SetParam("pwd", c_pass).SetParam("type", "pay").ExecuteCmd(this); if (verifyPwd.GetValueAsBool() == false) { throw new Exception(verifyPwd.GetError()); } else { // 修改会员信息 string passport = string.Format("{0}@caika.com", account); DataSet dsMember = new ParamUtil() .SQLCmdLoadData() .SQLEntityScript("CAIKA_MEMBER", string.Format("SELECT * FROM CAIKA_MEMBER WHERE SSOPST='{0}'", passport)) .ExecuteCmd(ADataLoader.DataLoader()) .GetValueAsDataSet(); dsMember.Tables[0].Rows[0]["NICKNAME"] = dsinfo.GetValue("nickname"); dsMember.Tables[0].Rows[0]["EMAIL"] = dsinfo.GetValue("email"); dsMember.Tables[0].Rows[0]["REALNAME"] = dsinfo.GetValue("realname"); dsMember.Tables[0].Rows[0]["IDTYPE"] = dsinfo.GetValue("idtype"); dsMember.Tables[0].Rows[0]["UID"] = dsinfo.GetValue("id"); dsMember.Tables[0].Rows[0]["ASKID"] = dsinfo.GetValue("ask"); dsMember.Tables[0].Rows[0]["ANSWER"] = dsinfo.GetValue("answer"); dsMember.Tables[0].Rows[0]["ETIME"] = DateTime.Now; new ParamUtil().SQLCmdPersistent().SetParam(dsMember).ExecuteCmd(ADataLoader.DataLoader()); } } catch (Exception ex1) { PickParam(Params).Clear().SetError(ex1.Message); } }
public PageModel(BaseController controller, string file) { Parameters = new DynamicParameters(); ParamUtil aPU = new ParamUtil().SQLCmdLoadDataFromXML(file).ExecuteCmd(ADataLoader.LocalDataLoader()); if (!aPU.IsOK()) { throw new InvalidOperationException(string.Format("上下文中未匹配到合适的Model信息! file={0}", file)); } DictSetUtil aXTCS = new DictSetUtil(aPU.GetValueAsDataSet()); Title = aXTCS.GetValue("Title"); Description = aXTCS.GetValue("Description"); Keywords = aXTCS.GetValue("Keywords"); ResConfigFile = aXTCS.GetValue("ResConfigFile"); AppDomain = controller.AppDomain; ResVersion = controller.ResVersion; }
private void DIGEST(Hashtable Params) { // 编辑器属性成员集合 MyPropertyDescriptorCollection properties = PickParam(Params).GetValue() as MyPropertyDescriptorCollection; if (properties != null) { MyPropertyItemDescriptor curProperty = properties.FirstOrDefault(cm => cm.PropertyName == PickParam(Params).GetCmd()); if (curProperty == null) { throw new Exception(string.Format("在当前编辑器内未解析到【{0}】属性信息。", PickParam(Params).GetCmd())); } // 得到账户的资金摘要 DictSetUtil dictDigest = new DictSetUtil(AEntryDic.Pick(GetControl()).GetDic(curProperty.Value as string)); DataRow curRow = (DataRow)PickParam(Params).GetValue(ActionUtil.Current); curRow["TOTALAMOUNT"] = dictDigest.GetValue("TOTALAMOUNT"); curRow["AVAILABLE"] = dictDigest.GetValue("AVAILABLE"); curRow["FREEZED"] = dictDigest.GetValue("FREEZED"); curRow["SCORE"] = dictDigest.GetValue("SCORE"); // 总资金 MyPropertyItemDescriptor total = properties.FirstOrDefault(cm => cm.PropertyName == "TOTALAMOUNT"); if (total != null) { total.Value = dictDigest.GetValue("TOTALAMOUNT"); } // 可用资金 MyPropertyItemDescriptor available = properties.FirstOrDefault(cm => cm.PropertyName == "AVAILABLE"); if (available != null) { available.Value = dictDigest.GetValue("AVAILABLE"); } // 冻结资金 MyPropertyItemDescriptor freezed = properties.FirstOrDefault(cm => cm.PropertyName == "FREEZED"); if (freezed != null) { freezed.Value = dictDigest.GetValue("FREEZED"); } // 积分 MyPropertyItemDescriptor score = properties.FirstOrDefault(cm => cm.PropertyName == "SCORE"); if (score != null) { score.Value = dictDigest.GetValue("SCORE"); } } }
private void GetQRImage(Hashtable Params) { DictSetUtil dictSet = new DictSetUtil(PickParam(Params).ExportDS()); DictSetUtil dictParams = new DictSetUtil(new DSUtil(dictSet.MyDS).SetFilter(DictSet.TableName, string.Format("{0} LIKE 'params.%'", DictSet.FN_MCCanShu)).ExportDS()); string s_id = PickParam(Params).GetValueAsString("v"); string u_id = PickParam(Params).GetValueAsString("u"); string a_id = PickParam(Params).GetValueAsString("a"); string orderId = new DictSetUtil(null).PushSLItem(s_id).PushSLItem(u_id).DoSignature(); List <string> aList = new List <string>(); aList.Add("parter=" + dictParams.GetValue("params.customerid")); // 商户id,由分配 aList.Add("type=" + dictParams.GetValue("params.paytype")); //银行类型,具体请参考附录1 aList.Add("value=" + a_id); //单位元(人民币),2位小数,最小支付金额为0.02 aList.Add("orderid=" + "12345678910"); // 商户系统订单号,该订单号将作为接口的返回数据。该值需在商户系统内唯一,系统暂时不检查该值是否唯一 aList.Add("callbackurl=" + dictParams.GetValue("params.callbackurl")); //下行异步通知过程的返回地址,需要以http://开头且没有任何参数 string sign = PaymentUtil.EncryptMD5(string.Join("&", aList) + dictParams.GetValue("params.paymentkey")); aList.Add("refbackurl=" + dictParams.GetValue("params.refbackurl")); // 页面通知地址 aList.Add("payerIp=127.0.0.1"); //用户在下单时的真实IP,接口将会判断玩家支付时的ip和该值是否相同。若不相同,接口将提示用户支付风险(可为空) aList.Add("attach=test"); //备注信息,下行中会原样返回。若该值包含中文,请注意编码 aList.Add("sign=" + sign); // 签名信息 ,MD5 后32位小写 string postDataStr = string.Join("&", aList); HttpWebRequest aRequest = (HttpWebRequest)WebRequest.Create("http://pay.shengyuanpay.com/chargebank.aspx" + (postDataStr == "" ? "" : "?") + postDataStr); aRequest.Method = "GET"; aRequest.ContentType = "text/html; charset=UTF-8"; using (HttpWebResponse postResponse = aRequest.GetResponse() as HttpWebResponse) { using (StreamReader aStream = new StreamReader(postResponse.GetResponseStream(), Encoding.UTF8)) { string retString = aStream.ReadToEnd(); } } }
public JsonResult queryJournalList() { Hashtable aHT = Authorizes.GetAuthorizeCache(Request); if (aHT != null) { // 返回账户流水清单 DataSet ds_result = new ParamUtil() .SetCmd(AAccountUtil.CGetJournalList) .SetParam(aHT["DOMAINUSER"]).SetParam("type", Request["t"]).SetParam("time", Request["m"]).SetParam("pageno", Request["pageno"]) .ExecuteCmd(new AAccountUtil()) .GetValueAsDataSet(); var rows = ds_result.Tables["list"].Rows.OfType <DataRow>().Select( cm => new journalItem() { t_id = cm["ID"].ToString(), time = cm["JOURNALTIME"].ToString(), type = cm["TYPE"].ToString(), amount = string.Format("{0:f}", cm["AMOUNT"]), available = string.Format("{0:f}", cm["AVAILABLE"]), remark = cm["REMARK"].ToString(), state = cm["STATE"].ToString() }); DictSetUtil ds_total = new DictSetUtil(ds_result); return(Json(new { flag = "y", pagenums = ds_result.Tables["pages"].Rows.Count > 0 ? ds_result.Tables["pages"].Rows[0][0] : 0, pageno = string.IsNullOrEmpty(Request["pageno"]) ? "1" : Request["pageno"], deposited = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.充值)) ? "0.00" : ds_total.GetValue(journal_type.充值)), bonus = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.中奖)) ? "0.00" : ds_total.GetValue(journal_type.中奖)), exchanged = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.积分兑换)) ? "0.00" : ds_total.GetValue(journal_type.积分兑换)), returned = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.返点)) ? "0.00" : ds_total.GetValue(journal_type.返点)), consume = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.投注)) ? "0.00" : ds_total.GetValue(journal_type.投注)), withdraw = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.提现)) ? "0.00" : ds_total.GetValue(journal_type.提现)), rows = rows.ToList() })); } return(Json(new { flag = "n" })); }
public ActionResult UserCenter(string id) { Hashtable aHT = Authorizes.GetAuthorizeCache(Request); if (aHT != null) { if (string.IsNullOrEmpty(id)) { id = "zhmx"; } PageModel model = new PageModel(this, @"model\usercenter.xml"); model.Parameters.Subpage = id; model.Parameters.Pid = string.Format("{0}{1}", id, Request["t"]); model.Parameters.Account = ParamUtil.Pick(aHT).GetValueAsString("DOMAINUSER"); model.Parameters.NickName = ParamUtil.Pick(aHT).GetValueAsString("NICKNAME"); model.Parameters.LoginTime = ParamUtil.Pick(aHT).GetValueAsString("LOGINTIME"); model.Parameters.Available = string.Format("{0:f2}", Convert.ToDecimal(aHT["AVAILABLE"])); model.Parameters.Freezed = string.Format("{0:f2}", Convert.ToDecimal(aHT["FREEZED"])); model.Parameters.Score = aHT["SCORE"].ToString(); switch (id) { case "czlink": model.Parameters.PayList = CommonDBUtils.GetPaymentList(); break; case "zhmx": // 返回账户流水清单 DataSet ds_result = new ParamUtil() .SetCmd(AAccountUtil.CGetJournalList) .SetParam(model.Parameters.Account).SetParam("type", Request["t"]).SetParam("time", Request["m"]).SetParam("pageno", Request["pageno"]) .ExecuteCmd(new AAccountUtil()) .GetValueAsDataSet(); model.Parameters.List = ds_result.Tables["list"]; DictSetUtil ds_total = new DictSetUtil(ds_result); model.Parameters.Deposited = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.充值)) ? "0.00" : ds_total.GetValue(journal_type.充值)); model.Parameters.Bonus = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.中奖)) ? "0.00" : ds_total.GetValue(journal_type.中奖)); model.Parameters.Exchanged = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.积分兑换)) ? "0.00" : ds_total.GetValue(journal_type.积分兑换)); model.Parameters.Returned = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.返点)) ? "0.00" : ds_total.GetValue(journal_type.返点)); model.Parameters.Consume = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.投注)) ? "0.00" : ds_total.GetValue(journal_type.投注)); model.Parameters.Withdraw = string.Format("{0:f}", string.IsNullOrEmpty(ds_total.GetValue(journal_type.提现)) ? "0.00" : ds_total.GetValue(journal_type.提现)); model.Parameters.Type = Request["t"]; model.Parameters.Time = Request["m"]; model.Parameters.PageNo = string.IsNullOrEmpty(Request["pageno"]) ? "1" : Request["pageno"]; model.Parameters.PageNums = 0; if (ds_result.Tables["pages"].Rows.Count > 0) { model.Parameters.PageNums = ds_result.Tables["pages"].Rows[0][0]; } break; case "zhmm": model.Parameters.WithdrawIsEmpty = AAccountUtil.WithdrawIsEmpty(ParamUtil.Pick(aHT).GetValueAsString("DOMAINUSER")); break; case "bdyhk": model.Parameters.Provinces = CommonDBUtils.GetAreas(); // 返回账户的绑定的银行卡数据 DictSetUtil ds_bank = new DictSetUtil(AAccountUtil.GetBankData(ParamUtil.Pick(aHT).GetValueAsString("DOMAINUSER"))); model.Parameters.BankData = ds_bank.MyDS; model.Parameters.HaveBank = ds_bank.DSxtcs.Rows.Count > 0; break; case "grzl": DictSetUtil ds_info = new DictSetUtil(AAccountUtil.GetMemberInfo(ParamUtil.Pick(aHT).GetValueAsString("DOMAINUSER"))); model.Parameters.MemberInfo = ds_info.MyDS; model.Parameters.InfoIsFull = !string.IsNullOrEmpty(ds_info.GetValue("REALNAME")) && !string.IsNullOrEmpty(ds_info.GetValue("UID")) && !string.IsNullOrEmpty(ds_info.GetValue("ANSWER")); break; case "msglist": DataSet ds_msglist = AAccountUtil.GetMessageList(ParamUtil.Pick(aHT).GetValueAsString("DOMAINUSER"), Request["pageno"]); model.Parameters.List = ds_msglist.Tables["list"]; model.Parameters.PageNums = ds_msglist.Tables["pages"].Rows.Count > 0 ? ds_msglist.Tables["pages"].Rows[0][0] : 0; model.Parameters.PageNo = string.IsNullOrEmpty(Request["pageno"]) ? "1" : Request["pageno"]; break; } return(View("UserCenter", model)); } return(Redirect("/")); }
private void GetQRImage(Hashtable Params) { DictSetUtil dictSet = new DictSetUtil(PickParam(Params).ExportDS()); DictSetUtil dictParams = new DictSetUtil(new DSUtil(dictSet.MyDS).SetFilter(DictSet.TableName, string.Format("{0} LIKE 'params.%'", DictSet.FN_MCCanShu)).ExportDS()); string s_id = PickParam(Params).GetValueAsString("v"); string u_id = PickParam(Params).GetValueAsString("u"); string a_id = PickParam(Params).GetValueAsString("a"); string orderId = new DictSetUtil(null).PushSLItem(s_id).PushSLItem(u_id).DoSignature(); List <string> aList = new List <string>(); /*------------天下付---------------- * //aList.Add("customerid=" + dictParams.GetValue("params.customerid")); // 商户ID * //aList.Add("paytype=" + dictParams.GetValue("params.paytype")); // 支付方式 * //aList.Add("total_fee=" + a_id); // 支付金额 * //aList.Add("sdorderno=" + orderId); // 商户平台唯一订单号 * //aList.Add("notifyurl=" + dictParams.GetValue("params.notifyurl")); // 商户异步回调通知地址 * //aList.Add("returnurl=" + dictParams.GetValue("params.returnurl")); // 商户同步通知地址 * //aList.Add("version=" + dictParams.GetValue("params.version")); // 版本号 * //aList.Add("remark="); //备注(可为空) * //aList.Add("bankcode="); // 网银直连不可为空,其他支付方式可为空 * //aList.Add("sign="+ PaymentUtil.EncryptMD5(string.Join("&", aList)+"&"+ dictParams.GetValue("params.paymentkey")));// 签名 * ------------------------------------*/ aList.Add("Amount=" + a_id.Split('.')[0]); aList.Add("MerNo=" + dictParams.GetValue("params.customerid")); // 商户号 aList.Add("NotifyUrl=" + dictParams.GetValue("params.notifyurl")); //异步通知URL aList.Add("PdtName=" + "测试账户"); //商品名称,不可空 aList.Add("ProductId=" + dictParams.GetValue("params.ProductId")); // 产品类型(0601:微信扫码,0602 :支付宝扫码,0603 :银联扫码,0604 :QQ扫码) aList.Add("Remark=test"); //备注(可为空) aList.Add("ReturnUrl=" + dictParams.GetValue("params.returnurl")); // 页面通知地址 aList.Add("TxCode=" + dictParams.GetValue("params.TxCode")); // 交易编码 ,默认值 :210110 aList.Add("TxSN=" + DateTime.Now.ToString("yyyyMMddHHmmss")); // AosuApp.Functions.ToTimestamp(DateTime.Now)商户交易流水号 唯一orderId string sign = PaymentUtil.EncryptMD5(HttpUtility.UrlEncode(PaymentUtil.Encode(string.Join("&", aList)), Encoding.UTF8) + dictParams.GetValue("params.paymentkey")); aList.Add("Signature=" + sign); // 签名信息 ,MD5 后32位小写 aList.Add("SignMethod=" + "MD5"); // 签名方法 ,默认值 :MD5 byte[] data = Encoding.UTF8.GetBytes(string.Join("&", aList)); //http://pay.095pay.com/api/order/pay HttpWebRequest aRequest = HttpWebRequest.Create("http://api.1yigou.com.cn:8881/merchant-trade-api/command") as HttpWebRequest; aRequest.Method = "POST"; aRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; aRequest.ContentLength = data.Length; using (Stream postStream = aRequest.GetRequestStream()) { postStream.Write(data, 0, data.Length); } using (HttpWebResponse postResponse = aRequest.GetResponse() as HttpWebResponse) { using (StreamReader aStream = new StreamReader(postResponse.GetResponseStream(), Encoding.UTF8)) { txf_qr_response response_data = AosuApp.DataToJsonString.Deserialize <txf_qr_response>(aStream.ReadToEnd()); if (response_data != null) { switch (response_data.Status) { case 1: //PickParam(Params).SetParam(response_data); //PickParam(Params).SetParam(imgstream); //PickParam(Params).SetParam("content-type", "image/png"); using (HttpWebResponse response = HttpWebRequest.Create(response_data.ImgUrl).GetResponse() as HttpWebResponse) { using (Image img = new Bitmap(response.GetResponseStream())) { MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); PickParam(Params).SetParam(ms.ToArray()); PickParam(Params).SetParam("content-type", "image/png"); } } break; default: PickParam(Params).SetError(response_data.RspCod + response_data.RspMsg); break; } } } } }
private void GetQRImage(Hashtable Params) { // HTTP请求参数 // 商户ID p1_mchtid 是 int 商户ID,由金阳支付分配 // 支付方式 p2_paytype 是 String(20) WEIXIN 支付网关(参见附录说明4.3) // 支付金额 p3_paymoney 是 decimal 0.01 订单金额最小0.01(以元为单位) // 商户平台唯一订单号 p4_orderno 是 String(50) 商户系统内部订单号,要求50字符以内,同一商户号下订单号唯一 // 商户异步回调通知地址 p5_callbackurl 是 String(200) 商户异步回调通知地址 // 商户同步通知地址 p6_notifyurl 否 String(200) 商户同步通知地址 // 版本号 p7_version 是 String(4) V2.8 V2.8 // 签名加密方式 p8_signtype 是 int 1.MD5 签名加密方式 // 备注信息,上行中attach原样返回 p9_attach 否 String(128) 备注信息,上行中attach原样返回 // 分成标识 p10_appname 否 Strng(25) 分成标识 // 是否显示收银台 p11_isshow 是 int 0 是否显示PC收银台 // 商户的用户下单IP p12_orderip 否 String(20) 192.168.10.1 商户的用户下单IP // 签名 sign 是 String(40) MD5签名 // HTTP响应数据(JSON) // rspCode 响应码 int 响应码(参见附录说明4.2) 是 // rspMsg 响应消息 String 200 Http请求响应消息 是 // data 响应结果 JSON类 是 // DATA的JSON格式: // r1_mchtid 商户ID int 商户ID 是 // r2_systemorderno 系统平台订单号 String 50 第三方平台订单号码 是 // r3_orderno 商户的平台订单号 String 50 商户系统内部订单号,要求50字符以内,同一商户号下订单号唯一 是 // r4_amount 支付金额 decimal 订单金额(以元为单位) 是 // r5_version 版本号 string 4 版本号(与请求参数一致) 是 // r6_qrcode 二维码信息 String 200 二维码信息(QQ,支付宝,微信,银联,百度,京东) 是 // r7_paytype 支付方式 String 20 支付网关(参见附录说明4.3) 是 // sign 签名 String 40 MD5签名 是 DictSetUtil dictSet = new DictSetUtil(PickParam(Params).ExportDS()); DictSetUtil dictParams = new DictSetUtil(new DSUtil(dictSet.MyDS).SetFilter(DictSet.TableName, string.Format("{0} LIKE 'params.%'", DictSet.FN_MCCanShu)).ExportDS()); string s_id = PickParam(Params).GetValueAsString("v"); string u_id = PickParam(Params).GetValueAsString("u"); string a_id = PickParam(Params).GetValueAsString("a"); string orderId = new DictSetUtil(null).PushSLItem(s_id).PushSLItem(u_id).DoSignature(); List <string> aList = new List <string>(); aList.Add("p1_mchtid=" + dictParams.GetValue("params.p1_mchtid")); // 商户ID aList.Add("p2_paytype=" + dictParams.GetValue("params.p2_paytype")); // 支付方式 aList.Add("p3_paymoney=" + a_id); // 支付金额 aList.Add("p4_orderno=" + orderId); // 商户平台唯一订单号 aList.Add("p5_callbackurl=" + dictParams.GetValue("params.p5_callbackurl")); // 商户异步回调通知地址 aList.Add("p6_notifyurl=" + dictParams.GetValue("params.p6_notifyurl")); // 商户同步通知地址 aList.Add("p7_version=" + dictParams.GetValue("params.p7_version")); // 版本号 aList.Add("p8_signtype=" + dictParams.GetValue("params.p8_signtype")); // 签名加密方式 aList.Add("p9_attach="); // 备注信息,上行中attach原样返回 aList.Add("p10_appname="); // 分成标识 aList.Add("p11_isshow="); // 是否显示收银台 aList.Add("p12_orderip="); // 商户的用户下单IP aList.Add("sign="); // 签名 byte[] data = Encoding.UTF8.GetBytes(string.Join("&", aList)); HttpWebRequest aRequest = HttpWebRequest.Create("http://pay.095pay.com/api/order/pay") as HttpWebRequest; aRequest.Method = "POST"; aRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; aRequest.ContentLength = data.Length; using (Stream postStream = aRequest.GetRequestStream()) { postStream.Write(data, 0, data.Length); } using (HttpWebResponse postResponse = aRequest.GetResponse() as HttpWebResponse) { using (StreamReader aStream = new StreamReader(postResponse.GetResponseStream(), Encoding.UTF8)) { jy_qr_response response_data = AosuApp.DataToJsonString.Deserialize <jy_qr_response>(aStream.ReadToEnd()); if (response_data != null) { response_data.data = new jy_qr_response.jy_qr_response_data(); response_data.data.r6_qrcode = "http://www.55tx.cn/img/ewmlogo/1001025.png"; response_data.rspCode = 1; switch (response_data.rspCode) { case 1: using (HttpWebResponse response = HttpWebRequest.Create(response_data.data.r6_qrcode).GetResponse() as HttpWebResponse) { using (Image img = new Bitmap(response.GetResponseStream())) { MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); PickParam(Params).SetParam(ms.ToArray()); PickParam(Params).SetParam("content-type", "image/png"); } } break; default: PickParam(Params).SetError(response_data.rspMsg); break; } } } } }
/// <summary> /// 创建一个新的会员账号 /// </summary> /// <param name="objControl"></param> /// <param name="Params"></param> public static void CreateMemberRecord(IControl objControl, Hashtable Params) { Hashtable aHT = new Hashtable(); ParamUtil.Pick(aHT).SQLEntityScript("CAIKA_MEMBER", string.Format("SELECT * FROM CAIKA_MEMBER WHERE ACCOUNTID='{0}'", Params["DOMAINUSER"])); ParamUtil.Pick(aHT).SQLEntityScript("BASE_CATEGORY", string.Format("SELECT * FROM BASE_CATEGORY WHERE CATEGORYID LIKE '{0}%' ORDER BY CATEGORYID DESC", Params["PARENTAGENT"])); // 得到一个待持久化的记录集 if (ParamUtil.Pick(aHT).SQLCmdLoadData().ExecuteCmd(ADataLoader.DataLoader()).IsOK()) { DataSet dsPersistent = ParamUtil.Pick(aHT).GetValueAsDataSet(); if (dsPersistent.Tables["CAIKA_MEMBER"].Rows.Count == 0) { // 生成当前账号的代理编号 if (ParamUtil.Pick(Params).IsNullOrEmpty("PARENTAGENT") || dsPersistent.Tables["BASE_CATEGORY"].Rows.Count == 0) { throw new Exception("参数列表中没有解析到上级代理商编号。"); } string strAgentCode = ""; int intLevel = 0; int intSeqNo = 0; if (dsPersistent.Tables["BASE_CATEGORY"].Rows.Count == 1) { strAgentCode = string.Format("{0}001", Params["PARENTAGENT"]); intLevel = Convert.ToInt32(dsPersistent.Tables["BASE_CATEGORY"].Rows[0]["LEVEL"]) + 1; intSeqNo = 1; } else { int idx = 0; string curCode = dsPersistent.Tables["BASE_CATEGORY"].Rows[0]["CATEGORYID"] + ""; if (!int.TryParse(curCode.Substring(curCode.Length - 3), out idx)) { throw new Exception(string.Format("解析代理商{0}的索引值出错。", dsPersistent.Tables["BASE_CATEGORY"].Rows[0]["CATEGORYID"])); } if ((idx + 1) > 998) { throw new Exception(string.Format("代理商{0}的下级代理数量已满。", Params["PARENTAGENT"])); } strAgentCode = Params["PARENTAGENT"] + (idx + 1).ToString().PadLeft(3, '0'); intLevel = Convert.ToInt32(dsPersistent.Tables["BASE_CATEGORY"].Rows[0]["LEVEL"]); intSeqNo = Convert.ToInt32(dsPersistent.Tables["BASE_CATEGORY"].Rows[0]["SEQNO"]) + 1; } DataRow rowNew = dsPersistent.Tables["CAIKA_MEMBER"].NewRow(); rowNew["ACCOUNTID"] = Params["DOMAINUSER"]; rowNew["NICKNAME"] = Params["DOMAINUSER"]; rowNew["TYPE"] = Params["TYPE"]; if (Params["TYPE"].ToString() == account_type.AgentAccount) { rowNew["LEVEL"] = member_level.L3; } else { rowNew["LEVEL"] = member_level.L5; } rowNew["AGENTCODE"] = strAgentCode; rowNew["CERTTYPE"] = "身份证"; rowNew["STATE"] = state.Enabled; rowNew["CTIME"] = DateTime.Now; rowNew["CUSER"] = objControl.GetContext().MyInfo["USERID"]; rowNew["ETIME"] = DateTime.Now; rowNew["EUSER"] = objControl.GetContext().MyInfo["USERID"]; // 通行证+超级密码 string key = new DictSetUtil(null) .PushSLItem(string.Format("{0}@{1}", Params["DOMAINUSER"], Params["DOMAINNAME"])) .DoSignature(); rowNew["DIGEST"] = key; DictSetUtil dictDigest = new DictSetUtil(ParamUtil.Pick(Params).GetValueAsDataSet()); rowNew["TOTALAMOUNT"] = dictDigest.GetValue("TOTALAMOUNT"); rowNew["AVAILABLE"] = dictDigest.GetValue("AVAILABLE"); rowNew["FREEZED"] = dictDigest.GetValue("FREEZED"); rowNew["SCORE"] = dictDigest.GetValue("SCORE"); dsPersistent.Tables["CAIKA_MEMBER"].Rows.Add(rowNew); DataRow rowAgent = dsPersistent.Tables["BASE_CATEGORY"].NewRow(); rowAgent["CATEGORYID"] = strAgentCode; rowAgent["NAME"] = Params["DOMAINUSER"]; rowAgent["DESC"] = Params["DOMAINUSER"]; rowAgent["PARENTID"] = Params["PARENTAGENT"]; rowAgent["LEVEL"] = intLevel; rowAgent["SEQNO"] = intSeqNo; rowAgent["ISEND"] = "Y"; rowAgent["CTYPE"] = category.CType_Label; rowAgent["STATE"] = state.Enabled; rowAgent["CTIME"] = DateTime.Now; rowAgent["CUSER"] = objControl.GetContext().MyInfo["USERID"]; rowAgent["ETIME"] = DateTime.Now; rowAgent["EUSER"] = objControl.GetContext().MyInfo["USERID"]; dsPersistent.Tables["BASE_CATEGORY"].Rows.Add(rowAgent); dsPersistent.Tables["BASE_CATEGORY"].Rows[dsPersistent.Tables["BASE_CATEGORY"].Rows.Count - 1]["ISEND"] = "N"; if (new ParamUtil().SQLCmdPersistent().SetParam(dsPersistent).ExecuteCmd(ADataLoader.DataLoader()).IsOK()) { // 会员账户的金额摘要数据 if (AEntryDic.Pick(objControl).SetDic(dictDigest.MyDS, key)) { ParamUtil.Pick(Params).Clear(); ParamUtil.Pick(Params).SetError(ActionUtil.DefaultError); } } } } }