|
|
@@ -47,11 +47,12 @@ class ContractRepository:
|
|
|
await self.db.refresh(db_templates)
|
|
|
return db_templates
|
|
|
|
|
|
- async def mark_signed_by_phone(self, contact_phone: str, sign_flow_id: str, signing_time: datetime | None = None):
|
|
|
+ async def mark_signed_by_phone(self, contact_phone: str, sign_flow_id: str, signing_time: datetime | None = None, contract_download_url: str | None = None):
|
|
|
"""
|
|
|
根据手机号 + sign_flow_id 将合同标记为已签署,只更新匹配的合同项
|
|
|
当 is_master 为 1 时,更新签署状态和时间字段
|
|
|
同时写入签署/生效/到期时间(签署时间=T,生效=T+1天0点,失效=生效+365天)
|
|
|
+ 同时更新 contract_download_url 到对应的字典中
|
|
|
"""
|
|
|
result = await self.db.execute(
|
|
|
ContractStore.__table__.select().where(ContractStore.contact_phone == contact_phone)
|
|
|
@@ -72,6 +73,9 @@ class ContractRepository:
|
|
|
for item in items:
|
|
|
if item.get("sign_flow_id") == sign_flow_id:
|
|
|
item["status"] = 1
|
|
|
+ # 更新 contract_download_url
|
|
|
+ if contract_download_url:
|
|
|
+ item["contract_download_url"] = contract_download_url
|
|
|
matched_item = item
|
|
|
changed = True
|
|
|
break
|