BLL/apis/Notify.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UAP;
namespace BLL.apis
{
[API]
public class Notify : UAP.Razor.Page
{
/// <summary>
/// 订单支付回调通知
/// </summary>
/// <returns></returns>
public static string Order()
{
try
{
byte[] buffer = new byte[Current.Request.InputStream.Length];
Current.Request.InputStream.Read(buffer, 0, buffer.Length);
string notify_string = System.Text.Encoding.UTF8.GetString(buffer);
WeiXing.Model model = new WeiXing.Model();
model = WeiXing.Com.DeserializeFromXml(notify_string, model.GetType()) as WeiXing.Model;
if (model.return_code != "SUCCESS") throw new Exception(model.return_msg);
if (model.result_code != "SUCCESS") throw new Exception(model.err_code_des);
Sure(model.out_trade_no, model.transaction_id, decimal.Parse((Convert.ToInt32(model.total_fee) * 100).ToString()));
return @"
<xml>
<return_code>SUCCESS</return_code>
<return_msg>OK</return_msg>
</xml>";
}
catch (Exception ex)
{
return ex.Message;
}
}
/// <summary>
/// 订单支付回调
/// </summary>
/// <param name="code"></param>
/// <param name="trade_no"></param>
/// <param name="pay_amount"></param>
/// <returns></returns>
private static void Sure(string code, string trade_no, decimal pay_amount)
{
using (var db = UAP.DataBase.Get())
{
db.Connect();
db.Transaction();
try
{
JSON o = db.getJson(string.Format("select * from ec_order where code='{0}'", code), 0);
if (o == null) throw new Exception("订单编号[" + code + "]不存在");
if (o["stated"] != Convert.ToInt32(Tools.OrderStated.待支付)) throw new Exception("订单[" + code + "]已支付");
后面还有 18 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。