fix(groups): 排序终判——owner 二进制字符串序(云客逐位吻合),弃 list_order
上版按 list_order 排不对:云客员工列表序 ≠ 群统计页员工序。真机对照 切换点员工终判:群统计员工顺序 = owner(微信号/wxid 混存)的**区分大小写 二进制字符串升序**(Nancyjade < csf7169708 < wxid_01gv…,大写在小写前, 逐位吻合),组内 room_id 字符串升序。COLLATE BINARY 双库通用,且无需 JOIN wechat_account。 726 测试绿。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -102,18 +102,13 @@ async def list_groups(
|
||||
if conditions:
|
||||
list_stmt = list_stmt.where(*conditions)
|
||||
if (channel or "wechat") == "wechat":
|
||||
# 云客「微信群统计」同款排序(2026-09-10 真机判别):员工分组——
|
||||
# 按云客员工列表序(wechat_account.list_order,NULL 垫底按 wx_id)、
|
||||
# 组内按 room_id(chatRoomId)字符串升序。WA 保持最近活跃优先。
|
||||
# 云客「微信群统计」同款排序(2026-09-10 真机终判):owner_account_id
|
||||
# (=微信号/wxid 混存,如 Nancyjade < csf7169708 < wxid_01gv…——大写
|
||||
# 在小写前=区分大小写)**二进制字符串升序**分组,组内 room_id 字符串
|
||||
# 升序。COLLATE BINARY 双库通用(MySQL/SQLite)。WA 保持最近活跃优先。
|
||||
list_stmt = (
|
||||
list_stmt.outerjoin(
|
||||
WechatAccount,
|
||||
WechatAccount.wx_id == ChatGroup.owner_account_id,
|
||||
)
|
||||
.order_by(
|
||||
WechatAccount.list_order.is_(None),
|
||||
WechatAccount.list_order.asc(),
|
||||
ChatGroup.owner_account_id.asc(),
|
||||
list_stmt.order_by(
|
||||
ChatGroup.owner_account_id.collate("BINARY").asc(),
|
||||
ChatGroup.room_id.asc(),
|
||||
)
|
||||
.limit(page_size)
|
||||
|
||||
Reference in New Issue
Block a user