update
This commit is contained in:
parent
e5dfb94318
commit
beddeeb3ed
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
||||||
1
|
|
||||||
/var/lib/postgresql/data
|
|
||||||
1767598673
|
|
||||||
5432
|
|
||||||
/var/run/postgresql
|
|
||||||
*
|
|
||||||
742 0
|
|
||||||
ready
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,16 +0,0 @@
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from app.integrations.base import BaseClient
|
|
||||||
|
|
||||||
|
|
||||||
class ExampleClient(BaseClient):
|
|
||||||
"""
|
|
||||||
演示用 Client:真实业务中应封装 OA/HR/ERP 的 API。
|
|
||||||
这里不做实际外部请求,仅保留结构与调用方式。
|
|
||||||
"""
|
|
||||||
|
|
||||||
def ping(self) -> dict:
|
|
||||||
# 真实情况:return self.get_json("/ping")
|
|
||||||
return {"ok": True}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import logging
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from app.jobs.base import BaseJob
|
|
||||||
from extensions.example.client import ExampleClient
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger("connecthub.extensions.example")
|
|
||||||
|
|
||||||
|
|
||||||
class ExampleJob(BaseJob):
|
|
||||||
job_id = "example.hello"
|
|
||||||
|
|
||||||
def run(self, params: dict[str, Any], secrets: dict[str, Any]) -> dict[str, Any]:
|
|
||||||
# params: 明文配置,例如 {"name": "Mars"}
|
|
||||||
name = params.get("name", "World")
|
|
||||||
|
|
||||||
# secrets: 解密后的明文,例如 {"token": "..."}
|
|
||||||
token = secrets.get("token", "<missing>")
|
|
||||||
|
|
||||||
client = ExampleClient(base_url="https://baidu.com", headers={"Authorization": f"Bearer {token}"})
|
|
||||||
try:
|
|
||||||
pong = client.ping()
|
|
||||||
|
|
||||||
finally:
|
|
||||||
client.close()
|
|
||||||
|
|
||||||
logger.info("ExampleJob ran name=%s pong=%s", name, pong)
|
|
||||||
return {"hello": name, "pong": pong}
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue