111
This commit is contained in:
parent
5e23498031
commit
50989ce82d
@ -1,12 +1,12 @@
|
|||||||
from fastapi import APIRouter, Request, Form
|
from fastapi import APIRouter, Request, Form
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from app.services.stock_service import StockService
|
from app.services.stock_service_db import StockServiceDB
|
||||||
from app.services.ai_analysis_service import AIAnalysisService
|
from app.services.ai_analysis_service_db import AIAnalysisServiceDB
|
||||||
from app import templates
|
from app import templates
|
||||||
|
|
||||||
router = APIRouter(prefix="")
|
router = APIRouter(prefix="")
|
||||||
stock_service = StockService()
|
stock_service = StockServiceDB()
|
||||||
ai_service = AIAnalysisService()
|
ai_service = AIAnalysisServiceDB()
|
||||||
|
|
||||||
@router.get("/")
|
@router.get("/")
|
||||||
async def home(request: Request):
|
async def home(request: Request):
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class Config:
|
|||||||
MYSQL_PORT = int(os.getenv('MYSQL_PORT', 15340))
|
MYSQL_PORT = int(os.getenv('MYSQL_PORT', 15340))
|
||||||
MYSQL_USER = os.getenv('MYSQL_USER', 'stock')
|
MYSQL_USER = os.getenv('MYSQL_USER', 'stock')
|
||||||
MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD', 'stock')
|
MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD', 'stock')
|
||||||
MYSQL_DATABASE = os.getenv('MYSQL_DATABASE', 'stock2')
|
MYSQL_DATABASE = os.getenv('MYSQL_DATABASE', 'stock_monitor')
|
||||||
|
|
||||||
# 确保目录存在
|
# 确保目录存在
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@ -29,7 +29,10 @@ class DatabaseManager:
|
|||||||
database=self.config.database,
|
database=self.config.database,
|
||||||
user=self.config.user,
|
user=self.config.user,
|
||||||
password=self.config.password,
|
password=self.config.password,
|
||||||
port=self.config.port
|
port=self.config.port,
|
||||||
|
charset='utf8mb4',
|
||||||
|
collation='utf8mb4_unicode_ci',
|
||||||
|
autocommit=True
|
||||||
)
|
)
|
||||||
yield connection
|
yield connection
|
||||||
except Error as e:
|
except Error as e:
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
services:
|
|
||||||
stock-monitor:
|
|
||||||
build:
|
|
||||||
context: ..
|
|
||||||
dockerfile: ./dokcer/DockerFile
|
|
||||||
container_name: stock-monitor-app
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "15348:8000"
|
|
||||||
environment:
|
|
||||||
- PYTHONUNBUFFERED=1
|
|
||||||
volumes:
|
|
||||||
- ..:/app
|
|
||||||
Loading…
Reference in New Issue
Block a user