关于微信支付返回值,为什么会调用5次,请大神看下我哪里错了,只要一次就够啊
public static string notice_url()
{
string result = "";
string resultFromWx = getPostStr();
var res = System.Xml.Linq.XDocument.Parse(resultFromWx);
string patha1 = System.Web.HttpRuntime.BinDirectory;
System.IO.StreamWriter loga1 = new System.IO.StreamWriter(patha1 + "SUOYOU.txt", true);
loga1.WriteLine(res);
loga1.Close();
if (res.Element("xml").Element("return_code").Value == "SUCCESS")
{
if (res.Element("xml").Element("result_code").Value == "SUCCESS")
{
string attach = res.Element("xml").Element("attach").Value;
string total_fee_str = res.Element("xml").Element("total_fee").Value;
//存入数据库
DalHelper dbHelper = new DalHelper();
int ss = dbHelper.AjaxInserttotal_fee(System.Convert.ToString(total_fee_str), attach);
if (ss > 0)
{
//告诉微信我知道了,不要再给我发消息了,否则微信会8连击的反馈支付信息
WxPayData Res = new WxPayData();
Res.SetValue("return_code", "SUCCESS");
Res.SetValue("return_msg", "OK");
result = Res.ToXml();
string patha = System.Web.HttpRuntime.BinDirectory;
System.IO.StreamWriter loga = new System.IO.StreamWriter(patha + "resultInfo.txt", true);
loga.WriteLine(result);
loga.Close();
}
}
}
return result;
result 的结果:
<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>
但是微信还是调用我的方法 5次