feat(staff): 员工列表排序对齐云客API返回顺序(list_order列+抓取记序+API按序排)
- wechat_account 加 list_order 列(云客 wxUser/list 返回顺序) - 抓取器记录每行在API响应中的序号 - /api/accounts ORDER BY list_order(对齐云客员工列表排列) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,7 @@ async def list_accounts(
|
||||
WechatAccount.group_num.label("group_num"),
|
||||
WechatAccount.is_on_job.label("is_on_job"),
|
||||
WechatAccount.raw_json.label("raw_json"),
|
||||
WechatAccount.list_order.label("list_order"),
|
||||
)
|
||||
whatsapp_q = sa.select(
|
||||
WhatsappAccount.uid.label("account_id"),
|
||||
@@ -127,6 +128,7 @@ async def list_accounts(
|
||||
WhatsappAccount.group_num.label("group_num"),
|
||||
WhatsappAccount.is_on_job.label("is_on_job"),
|
||||
WhatsappAccount.raw_json.label("raw_json"),
|
||||
sa.literal(None).label("list_order"),
|
||||
)
|
||||
|
||||
if channel == "wechat":
|
||||
@@ -148,7 +150,12 @@ async def list_accounts(
|
||||
|
||||
page_q = (
|
||||
sa.select(sub)
|
||||
.order_by(sub.c.channel.asc(), sub.c.account_id.asc())
|
||||
.order_by(
|
||||
sub.c.channel.asc(),
|
||||
# list_order 优先(云客员工列表排列顺序,2026-08-24),NULL 排后
|
||||
sa.nullslast(sa.cast(sub.c.list_order, sa.Integer).asc()),
|
||||
sub.c.account_id.asc(),
|
||||
)
|
||||
.offset((page - 1) * page_size)
|
||||
.limit(page_size)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user