结算流水 增加 34 类型 礼物订单发送失败扣除金额

This commit is contained in:
chfei committed 2026-09-04 15:07:12 +08:00
1 parent 1514916d69
commit 0039ca5bf6
1 file changed
+11 -1
+11 -1
View File
@@ -613,13 +613,14 @@ namespace KJD_Web.BLL.WXXD
if (userLst.Count == 0) if (userLst.Count == 0)
return 0; return 0;
// 2. 该oem所有账户的未结算流水,按id升序 // 2. 该oem所有账户的未结算流水,按id升序
sql = "SELECT * FROM `wxxd`.`user_payment_record` WHERE user_name IN ('" + string.Join("','", userLst) + "') AND type IN (20,23,26,16,31) AND settlement=0 AND is_deleted=0 ORDER BY id ASC"; sql = "SELECT * FROM `wxxd`.`user_payment_record` WHERE user_name IN ('" + string.Join("','", userLst) + "') AND type IN (20,23,26,16,31,34) AND settlement=0 AND is_deleted=0 ORDER BY id ASC";
var flowDt = mySql.ExecuteDataTable(sql); var flowDt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message) || flowDt == null || flowDt.Rows.Count == 0) if (!string.IsNullOrEmpty(mySql.Message) || flowDt == null || flowDt.Rows.Count == 0)
return 0; return 0;
decimal total_amount = 0m; // 总金额(元) decimal total_amount = 0m; // 总金额(元)
decimal rebate_amount = 0m; // 正数部分(累计返利) decimal rebate_amount = 0m; // 正数部分(累计返利)
HashSet<string> deductedOrderSet = new HashSet<string>(); // type=23 已扣减的订单 HashSet<string> deductedOrderSet = new HashSet<string>(); // type=23 已扣减的订单
HashSet<string> giftsOrderSet = new HashSet<string>(); // type=34 礼物已扣减的订单
List<long> settleIdLst = new List<long>(); // 参与结算的流水id List<long> settleIdLst = new List<long>(); // 参与结算的流水id
foreach (DataRow row in flowDt.Rows) foreach (DataRow row in flowDt.Rows)
@@ -647,6 +648,15 @@ namespace KJD_Web.BLL.WXXD
deductedOrderSet.Add(orderId); deductedOrderSet.Add(orderId);
itemAmount = -(amount - 2.2m); itemAmount = -(amount - 2.2m);
} }
else if (type == 34)
{
// 同一个订单只能减少一次
string orderId = row["order_id"].ParseToString();
if (orderId.IsNullOrEmpty() || giftsOrderSet.Contains(orderId))
continue;
giftsOrderSet.Add(orderId);
itemAmount = -oem_amount;
}
else else
{ {
continue; // 其他类型不计入 continue; // 其他类型不计入