feat: linbot

restruct the project
This commit is contained in:
2026-03-10 10:15:22 +08:00
parent 00c76bec37
commit c0edc06ab1
11 changed files with 748 additions and 241 deletions

22
app/Invoice/Router.py Normal file
View File

@@ -0,0 +1,22 @@
import asyncio
import threading
from fastapi import APIRouter
router = APIRouter(prefix="/Invoice")
def _run_fetch():
from invoice_fetcher import main as fetch_main
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(fetch_main())
finally:
loop.close()
@router.get("/fetch")
async def fetch_invoices():
print("🚀 開始抓取發票...")
threading.Thread(target=_run_fetch).start()
return {"status": "started"}