|
@@ -118,5 +118,59 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ public string NoticePay()
|
|
|
+ {
|
|
|
+ StreamReader sr = new StreamReader(Request.Body);
|
|
|
+ string requestMes = sr.ReadToEnd();
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\r\n" + requestMes + "\r\n\r\n", "支付宝支付回调2");
|
|
|
+ return PayCallBack2("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnw14hKejqS+si/XZpNQpFAVOVXJIThj5Qn7H14n/vsb7uRLug1+Jcve8ehTkaN3s5ibrrELCnz0dvshi3cOz9svDSbLG5OdC1biAvZzpDkvVPswOd9f9jO8Jvqk3QTXTI3MSN9gOpKomI0te3qs5kkOQx6kRozzKjU/G//o/PbJCxpBxf/QNRV3XmCwJLZMBE7ukYqi1WO9Jra8jdczFKwrd/nhiKBKdupAtVVeKlylGD2i2YLkGAH1cLsPUN9DtzrXNblGXm2HK3l9SnMDjqnakiVdEQJTNYNpEiHaOJsVmPQL38nM6miz5wNd4gTchKzXPtoZWqto+eIvYaEA/KwIDAQAB", requestMes);
|
|
|
+ }
|
|
|
+
|
|
|
+ public string PayCallBack2(string publickey, string requestMes, bool IsRedis = false)
|
|
|
+ {
|
|
|
+
|
|
|
+ var result = "fail";
|
|
|
+ var sPara = GetRequestPost(requestMes);
|
|
|
+ if (sPara.Count > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ bool verifyResult = false;
|
|
|
+ var aliNotify = new Com.Alipay.Notify();
|
|
|
+ string signtype = sPara["sign_type"];
|
|
|
+ var total_fee = 0m;
|
|
|
+ string strPrice = sPara["total_amount"];
|
|
|
+ decimal.TryParse(strPrice, out total_fee);
|
|
|
+ verifyResult = AlipaySignature.RSACheckV1(sPara, publickey, "UTF-8", signtype, false);
|
|
|
+
|
|
|
+ if (verifyResult)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ string out_trade_no = sPara["out_trade_no"];
|
|
|
+
|
|
|
+ string trade_no = sPara["trade_no"];
|
|
|
+
|
|
|
+ string trade_status = sPara["trade_status"];
|
|
|
+
|
|
|
+
|
|
|
+ if (trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS")
|
|
|
+ {
|
|
|
+ if(out_trade_no.StartsWith("D"))
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddList("AlipayCallBack1", "{\"out_trade_no\":\"" + out_trade_no + "\",\"transaction_id\":\"" + trade_no + "\",\"total_fee\":\"" + total_fee + "\",\"pay_mode\":\"1\",\"openid\":\"\",\"attach\":\"\"}");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddList("AlipayCallBack2", "{\"out_trade_no\":\"" + out_trade_no + "\",\"transaction_id\":\"" + trade_no + "\",\"total_fee\":\"" + total_fee + "\",\"pay_mode\":\"1\",\"openid\":\"\",\"attach\":\"\"}");
|
|
|
+ }
|
|
|
+ result = "success";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|