修复结算流水 账号查找失败bug

This commit is contained in:
chfei committed 2026-09-03 11:16:47 +08:00
1 parent 6969782e34
commit be894efae3
3 files changed
+16 -4

No files matched your search

+12 -2
View File
@@ -580,7 +580,7 @@ namespace KJD_Web.BLL.WXXD
/// 各项金额之和为总金额(元),写入 oem.available_balance(当前可提现);
/// 其中正数部分累计到 oem.total_rebate_amount(历史累计返利)。
/// 写oem金额与更新流水settlement=1在同一个事务内执行(由调用方开启的事务)。
/// </summary>
/// </summary>
/// <param name="mySql">事务连接(调用方已开启事务)</param>
/// <param name="oemIdCode">贴牌编号(wxxd.oem.oem_id / wxxd.user.oem_id)</param>
/// <param name="oemDbId">wxxd.oem.id 数字主键</param>
@@ -590,7 +590,17 @@ namespace KJD_Web.BLL.WXXD
if (oem_id.IsNullOrEmpty())
return 0;
// 1. 找到该oem下所有账户
string sql = "SELECT b.user_name FROM `wxxd`.`user` AS A LEFT JOIN `wxxd`.`user` AS B ON A.user_name = B.parent_user_name WHERE A.oem_id='" + MysqlUtils.ReplaceSqlSpecial(oem_id) + "'";
string sql = $@"SELECT user_name, '主账号' AS account_type
FROM `wxxd`.`user`
WHERE oem_id = '{MysqlUtils.ReplaceSqlSpecial(oem_id)}'
UNION
SELECT
B.user_name,
'子账号' AS account_type
FROM `wxxd`.`user` AS A
INNER JOIN `wxxd`.`user` AS B
ON A.user_name = B.parent_user_name
WHERE A.oem_id = '{MysqlUtils.ReplaceSqlSpecial(oem_id)}'";
var userDt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message) || userDt == null || userDt.Rows.Count == 0)
return 0;