Merge branch 'main' of https://gitea.o2o.kr/Web4ai/o2o-site-AEO
This commit is contained in:
commit
95350cfdbf
4 files changed
+143
-12
No files matched your search
@@ -15,15 +15,15 @@ from crud.job_crud import JobQueue
|
||||
from crud.place_crud import PlaceCRUD
|
||||
from crud.post_crud import PostCRUD
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.database.model.models import jobs as jobs_table, place_posts, places
|
||||
from common.enums import DBWRType, ErrorType, JobStatus, JobType, PostStatus
|
||||
from common.database.model.models import jobs as jobs_table, place_posts, places, sites
|
||||
from common.enums import DBWRType, ErrorType, JobStatus, JobType, PostStatus, SiteStatus
|
||||
from common.logger import LOG
|
||||
from common.models.gmodel import Res_WebPacketProtocol, UserInfo
|
||||
from common.utils.gtime import GTime
|
||||
from router.v1.site.protocol import (
|
||||
GenerationBatch, PostData, Res_GenerateNow, Res_GenerateOne, Res_GenerationHistory, Res_MyPosts,
|
||||
)
|
||||
from services import blog_jobs, blog_service, social_service
|
||||
from services import blog_jobs, blog_service, site_payload, social_service
|
||||
from services.job_service import enqueue_job
|
||||
|
||||
EXPIRED = "처리할 수 없는 링크입니다."
|
||||
@@ -76,7 +76,36 @@ class PostService:
|
||||
return {"success": True, "message": SKIPPED}
|
||||
|
||||
await self._approve_and_publish(post_id, place_id)
|
||||
return {"success": True, "message": APPROVED}
|
||||
return {
|
||||
"success": True,
|
||||
"message": APPROVED,
|
||||
"redirect_url": await self._blog_url(place_id),
|
||||
}
|
||||
|
||||
async def _blog_url(self, place_id) -> str | None:
|
||||
"""이 업장의 발행된 사이트에서 미니 블로그가 보이는 자리. 승인 확인 화면이 몇 초
|
||||
뒤 여기로 자동 연결한다(2026-09-22, 사장님 지시) — 사장님이 승인만 하고 실제로
|
||||
어디에 올라갔는지 못 찾는 걸 줄인다. 사이트가 없거나 아직 미발행이면 None —
|
||||
호출부가 자동 연결 없이 확인 문구만 보여준다."""
|
||||
def query(session):
|
||||
return session.execute(
|
||||
select(places, sites)
|
||||
.join(sites, sites.place_id == places.place_id)
|
||||
.where(
|
||||
places.place_id == place_id,
|
||||
places.deleted == False, # noqa: E712
|
||||
sites.deleted == False, # noqa: E712
|
||||
sites.status == SiteStatus.PUBLISHED.value,
|
||||
)
|
||||
.limit(1)
|
||||
)
|
||||
|
||||
result = await DB_SESSION_MNG.execute_lambda(places.DBType(), DBWRType.DB_READ.value, query)
|
||||
row = result.first() if result is not None else None
|
||||
if not row:
|
||||
return None
|
||||
place, site = row
|
||||
return f"{site_payload.publish_url(place, site)}#blog"
|
||||
|
||||
async def _load_place(self, user_info: UserInfo, place_id: str):
|
||||
err_type, place = await DB_SESSION_MNG.execute_lambda(
|
||||
|
||||
Reference in new issue
Block a user