try
{
if (res.Element("xml").Element("return_code").Value == "SUCCESS")
{
//下单成功返回
string repayId = res.Element("xml").Element("prepay_id").Value;
wxpayconfig = new wxHandleModel.wxPayconfig();
wxpayconfig = wxhand.GetwxPay(repayId);
b2ccms_Model.b2ccms_order oredrsa = new b2ccms_Model.b2ccms_order();
oredrsa.o_static = res.Element("xml").Element("result_code").Value;
oredrsa.o_shh = res.Element("xml").Element("out_trade_no").Value;
b2ccms_BLL.b2ccms_orderBLL orderBLL = new b2ccms_BLL.b2ccms_orderBLL();
orderBLL.Update(oredr);
}
else
{
//下单失败返回
wxpayconfig = new wxHandleModel.wxPayconfig();
if (res.Element("xml").Element("return_msg").Value.Contains("openid"))
{
//如果错误信息为无效的openid,跳转到授权页面重新授权。
Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=" + oauthurl + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect");
}
else
{
//下单错误信息。
Response.Write("return_code:" + res.Element("xml").Element("return_code").Value + ",return_msg:" + res.Element("xml").Element("return_msg").Value);
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message + res.ToString());
}
为什么拿不到数据?