Skip to main content

หน้าคอนเทนต์

ภาพรวม

โดเมนนี้คือระบบ CMS ย่อยสำหรับสร้าง หน้าเว็บคอนเทนต์ เช่น บทความหรือแลนดิ้งเพจ แยกตาม LINE OA รองรับหลายภาษา งาน SEO และ Open Graph การควบคุมสิทธิ์การเข้าถึง (public token / password / audience) รวมถึงการเก็บสถิติผู้เข้าชมพร้อมค่า UTM

หลักการออกแบบคือ แยกเนื้อหาออกจากตัวหน้า ตาราง content_page เก็บโครงสร้าง สถานะ และสิทธิ์ ส่วนข้อความจริงอยู่ใน content_page_translation ซึ่งแยกตามภาษา

โครงสร้างข้อมูลหลัก

content_page (model ContentPage)

  • uuid (unique) และ slug VARCHAR(255) ซึ่ง unique ร่วมกันเป็น (line_oa_id, slug)
  • status (enum ContentPageStatus) — draft / published / archived พร้อม version
  • การควบคุมการเข้าถึง public_token (unique), require_auth, password_protected และ password_hash
  • ข้อมูลการเผยแพร่ published_at / published_by และ archived_at / archived_by
  • สถิติ view_count และ unique_view_count (BIGINT)
  • การจัดหมวดหมู่ category_idcontent_category.id และ subcategory_idcontent_subcategory.id
  • audience_ids JSONB — จำกัดว่ากลุ่มใดเห็นหน้านี้ได้
  • Friend track: friend_track_campaign_idfriend_track_campaign.id (ON DELETE SET NULL) ร่วมกับ friend_track_button_text สำหรับปุ่มชวนเพิ่มเพื่อนบนหน้า
  • soft delete ผ่าน deleted_date และ deleted_by

content_page_translation

เนื้อหารายภาษา unique (content_page_id, language) และ FK content_page_id แบบ ON DELETE CASCADE

  • เนื้อหา title, content, excerpt
  • ข้อมูล SEO meta_title, meta_description, meta_keywords, og_title, og_description, og_image_url, twitter_card

content_page_utm

ความสัมพันธ์ 1:1 กับหน้า (content_page_id unique) เก็บค่า utm_source, utm_medium, utm_campaign, utm_term, utm_content

content_page_analytics

ความสัมพันธ์ 1:1 กับหน้า เก็บสคริปต์และการตั้งค่าอีเวนต์

  • ga_events JSONB, fb_pixel_events, line_tag_events, custom_head_scripts, custom_body_scripts
  • สวิตช์เปิดปิด enable_ga (default true), enable_fb_pixel, enable_line_tag

content_page_view

log การเข้าชมรายครั้ง

  • ข้อมูลผู้ชม viewer_ip, viewer_user_agent, viewer_referrer, viewer_line_uid
  • ค่า UTM ที่ติดมากับ URL พร้อม session_id, language, device_type, viewed_at
  • index บน (content_page_id), (session_id) และ (viewed_at)

ไฟล์ที่เกี่ยวข้อง

  • prisma/schema.prisma:1013 — model ContentPage
  • prisma/schema.prisma:1079 — model ContentPageTranslation
  • prisma/schema.prisma:1112 — model ContentPageUtm
  • prisma/schema.prisma:1135 — model ContentPageAnalytics
  • prisma/schema.prisma:1163 — model ContentPageView
  • schema-dumps/2026-07-24/schema.sql:1338, :1437, :1482, :1375, :1521

จุดเชื่อมต่อกับ Service อื่น

  • cms-api-go — จัดการหน้า แปลภาษา ตั้งค่า SEO และสคริปต์ รวมถึง publish และ archive
  • client-api-go — หน้าสาธารณะ ตรวจสิทธิ์ทั้งแบบ token, password และ audience จากนั้น render translation ที่ตรงภาษา เขียน content_page_view และเพิ่มตัวนับ

โดเมนที่เกี่ยวข้อง: หมวดหมู่คอนเทนต์และลิงก์รวม, Audience, ติดตามที่มาของเพื่อน