Commit 82be9055 by imwangxiaozhou Committed by 胡悦

refactor(企业微信同步): 重构同步接口,统一使用list_contacts并支持contact_type参数

- 更新协议定义,新增带可选contact_type参数的list_contacts方法
- 优化HTTP客户端实现,添加contact_type参数处理逻辑
- 将业务层的list_customers调用替换为list_contacts,移除无用的起止时间参数
- 更新所有测试用例的FakeClient及mock签名以适配新接口
1 parent e254668a
......@@ -277,10 +277,8 @@ class WeComCustomerGroupOrchestrationService:
remote_set: dict[str, dict] = {}
page = 1
while True:
payload = self.client.list_customers(
payload = self.client.list_contacts(
bot_id=bot.bot_id,
start_time=None,
end_time=None,
page=page,
page_size=self.page_size,
contact_type=self._customer_contact_type,
......@@ -352,10 +350,8 @@ class WeComCustomerGroupOrchestrationService:
remote_set: dict[str, dict] = {}
page = 1
while True:
payload = self.client.list_customers(
payload = self.client.list_contacts(
bot_id=bot.bot_id,
start_time=None,
end_time=None,
page=page,
page_size=self.page_size,
contact_type=self._customer_contact_type,
......
......@@ -57,6 +57,9 @@ class WeComSyncClient(Protocol):
def list_bots(self, *, page: int, page_size: int) -> dict[str, Any]:
...
def list_contacts(self, *, bot_id: str, page: int, page_size: int, contact_type: str | None = None) -> dict[str, Any]:
...
def list_customers(
self,
*,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!