123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace LYFZ.WeixinServers.PaymentService
- {
- public partial class PaymentService : System.Web.UI.Page
- {
- string desKey = "Ivz0IC3k";
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.IsPostBack)
- {
- if (this.Request.QueryString["type"] != null)
- {
- string type = this.Request.QueryString["type"].ToString();
- string path = Server.MapPath("/") + "/Payment/pay.txt";
- if (System.IO.File.Exists(path))
- {
- Newtonsoft.Json.Linq.JObject jobject = ( Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(System.IO.File.ReadAllText(path));
- if (type == "wx")
- {
- Newtonsoft.Json.Linq.JObject wxObject = (Newtonsoft.Json.Linq.JObject)jobject.GetValue("wx");
- var wxData = new
- {
- businessNumber = LYFZ.WinAPI.SDKSecurity.DESEncrypt(wxObject.GetValue("MchID").ToString(), desKey),
- appid = LYFZ.WinAPI.SDKSecurity.DESEncrypt(wxObject.GetValue("AppID").ToString(), desKey),
- key = LYFZ.WinAPI.SDKSecurity.DESEncrypt(wxObject.GetValue("Key").ToString(), desKey)
- };
- this.Response.Write(ReturnData(-1, "成功", wxData));
- }
- else if (type == "zfb")
- {
- Newtonsoft.Json.Linq.JObject zfbObject = (Newtonsoft.Json.Linq.JObject)jobject.GetValue("zfb");
- var zfbData = new
- {
- CompanyPid = LYFZ.WinAPI.SDKSecurity.DESEncrypt(zfbObject.GetValue("MchID").ToString(), desKey)
- };
- this.Response.Write(ReturnData(-1, "成功", zfbData));
- }
- else
- {
- this.Response.Write(ReturnData(-1, "没有找到你请求的数据"));
- }
- }
- else
- {
- if (type == "wx")
- {
- var wxData = new
- {
- businessNumber = LYFZ.WinAPI.SDKSecurity.DESEncrypt("1454966002", desKey),
- appid = LYFZ.WinAPI.SDKSecurity.DESEncrypt("wxe30d2c612847beeb", desKey),
- key = LYFZ.WinAPI.SDKSecurity.DESEncrypt("wcx420222fdsf7fdsf837f6d484fsghh", desKey)
- };
- this.Response.Write(ReturnData(-1, "成功", wxData));
- }
- else if (type == "zfb")
- {
- var zfbData = new
- {
- CompanyPid = LYFZ.WinAPI.SDKSecurity.DESEncrypt("2088621649564405", desKey)
- };
- this.Response.Write(ReturnData(-1, "成功", zfbData));
- }
- else
- {
- this.Response.Write(ReturnData(-1, "没有找到你请求的数据"));
- }
- }
- }
- else {
- this.Response.Write(ReturnData(-1,"参数不正确"));
- }
- }
- }
- public string ReturnData(int code,string msg, object data=null)
- {
- var retData = new {
- code=code,
- msg=msg,
- data=data
- };
- return Newtonsoft.Json.JsonConvert.SerializeObject(retData);
- }
- }
- }
|