Files
docs/business/BUSINESS-05-CONTENT-MANAGEMENT.md
T
masoodafar-web efff5e9cd5 docs: consolidate 53 files into 15 structured files in 3 folders
- business/ (5): club-commission, payment, ecommerce, membership, content
- technical/ (5): cms-arch, ui, deployment, migration, api
- overview/ (5): flowcharts, index, changelog, glossary, roadmap
- Removed all old folders: backoffice, cms, deployment, docs, frontoffice, migration, ui-modernization, business (old)
- Updated internal links with relative folder paths
2026-02-18 22:29:37 +03:30

273 lines
7.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 📄 محتوا، صفحات، بلاگ و ایمیل/SMS
> **منابع ادغام‌شده:** `SITE-PAGES-SIMPLIFICATION.md`, `system-constants.md`, `email-sms-configuration.md`, `chatika-integration.md`, `CMS-README.md`
> **آخرین بروزرسانی:** اسفند ۱۴۰۴
---
## ۱. مدیریت صفحات سایت (Site Pages)
### ۱.۱ معماری ساده‌شده (Shopify-style)
```
قبل (پیچیده):
SitePage → SitePageSetting → SitePageContent → Template → ... (7 جدول)
بعد (ساده):
SitePage (PageType, JsonSettings, IsPublished)
└─→ هر PageType → یک typed editor در BackOffice
```
### ۱.۲ انواع صفحات
| PageType | Route | Editor | وضعیت |
|----------|-------|--------|--------|
| `Home` | `/` | HomePageEditor | ✅ |
| `About` | `/about` | AboutPageEditor | ✅ |
| `Contact` | `/contact` | ContactPageEditor | ✅ |
| `Landing` | `/landing` | LandingPageEditor | ✅ |
| `Licenses` | `/licenses` | LicensesPageEditor | ✅ |
| `FAQ` | `/faq` | FAQPageEditor | ✅ |
| `Terms` | `/terms` | MarkdownEditor | ✅ |
| `Privacy` | `/privacy` | MarkdownEditor | ✅ |
### ۱.۳ SitePageSettingsService
```csharp
public interface ISitePageSettingsService {
Task<T> GetSettingsAsync<T>(string pageType) where T : class, new();
Task SaveSettingsAsync<T>(string pageType, T settings) where T : class;
}
// ذخیره‌سازی: JSON serialization در فیلد Settings
// Cache: MemoryCache با Expiry 15 دقیقه
```
### ۱.۴ مثال — تنظیمات صفحه اصلی
```json
{
"heroTitle": "کارا بازار سلامت",
"heroSubtitle": "سلامتی در دستان شما",
"heroImageUrl": "/images/hero.jpg",
"featuredCategories": ["guid1", "guid2"],
"showPromotionBanner": true,
"promotionText": "تخفیف ویژه زمستانه"
}
```
---
## ۲. سیستم بلاگ
### ۲.۱ Entity
```csharp
public class BlogPost {
public Guid Id { get; set; }
public string Title { get; set; }
public string Slug { get; set; } // URL-friendly
public string Content { get; set; } // HTML/Markdown
public string Summary { get; set; }
public string FeaturedImageUrl { get; set; }
public Guid AuthorId { get; set; }
public Guid? CategoryId { get; set; }
public bool IsPublished { get; set; }
public DateTime PublishedAt { get; set; }
public List<string> Tags { get; set; }
public int ViewCount { get; set; }
}
```
### ۲.۲ Pagination (gRPC)
```protobuf
message GetBlogPostsRequest {
PaginationState pagination = 1;
string categoryId = 2;
string searchTerm = 3;
bool publishedOnly = 4;
}
```
---
## ۳. مدیریت فایل (File Management)
### ۳.۱ معماری
```
آپلود فایل (تصویر/سند)
FileManagementService → ذخیره در فایل‌سیستم + ثبت در DB
مسیر فیزیکی: /app/uploads/{year}/{month}/{guid}.{ext}
مسیر URL: /api/files/{guid}
محدودیت‌ها:
• حداکثر حجم: 10MB (configurable)
• فرمت‌های مجاز: jpg, png, webp, pdf, doc, docx
• تصاویر: resize خودکار به 800×800 (محصولات)
```
### ۳.۲ Storage Strategy
| محیط | ذخیره‌سازی |
|------|------------|
| Development | Local filesystem |
| Staging | Local filesystem (server) |
| Production | Local filesystem (server) |
| آینده | MinIO / S3 compatible (planned) |
---
## ۴. تنظیمات ایمیل و SMS
### ۴.۱ SMS (Kavenegar)
```json
{
"Kavenegar": {
"ApiKey": "***",
"SenderNumber": "10008663",
"Templates": {
"OTP": "verify-foursat",
"ContractOTP": "contract-verify",
"WelcomeClub": "club-welcome",
"OrderConfirm": "order-confirm"
}
}
}
```
### ۴.۲ ایمیل
```json
{
"Email": {
"SmtpHost": "smtp.example.com",
"SmtpPort": 587,
"Username": "noreply@foursat.ir",
"FromName": "کارا بازار سلامت",
"UseSsl": true,
"Templates": {
"WelcomeEmail": "welcome.html",
"OrderReceipt": "order-receipt.html"
}
}
}
```
> ⚠️ ایمیل فعلاً فقط برای اطلاع‌رسانی ادمین استفاده می‌شود — SMS کانال اصلی کاربران
---
## ۵. ثوابت سیستمی (SystemConstants)
### ۵.۱ جدول اصلی
```sql
CREATE TABLE SystemConfigurations (
[Key] NVARCHAR(200) PRIMARY KEY,
[Value] NVARCHAR(MAX),
[Description] NVARCHAR(500),
[Category] NVARCHAR(100),
[LastModified] DATETIME2
);
```
### ۵.۲ مقادیر کلیدی
| Category | Key | Value | توضیح |
|----------|-----|-------|--------|
| Club | `Club.ActivationFee` | 25000000 | هزینه فعالسازی |
| Club | `Club.GiftValue` | 25200000 | واریز Pool |
| Club | `GoldenPackageAmount` | 56000000 | قیمت پکیج طلایی |
| Club | `MaxNetworkLevel` | 15 | حداکثر عمق درخت |
| Club | `MaxWeeklyBalance` | 300 | سقف هفتگی |
| Payment | `VAT.Percentage` | 10 | مالیات ارزش افزوده |
| Payment | `DayaLoanAmount` | 56000000 | مبلغ وام |
| Store | `DiscountPercentage` | 30 | تخفیف باشگاه |
| Store | `ProductsPerPage` | 12 | تعداد در صفحه |
| System | `SmsProvider` | Kavenegar | ارائه‌دهنده SMS |
| System | `MaintenanceMode` | false | حالت تعمیر |
---
## ۶. Chatika AI Integration
### ۶.۱ معماری
```
Hangfire Recurring Job (هر ۵ دقیقه)
ChatikaJob → بررسی پیام‌های جدید کاربران
ارسال به Chatika API (با Polly retry ×3)
دریافت پاسخ → ذخیره در ChatMessages
نمایش در UI باشگاه (real-time via SignalR planned)
```
### ۶.۲ فعلی vs آینده
| آیتم | فعلی | آینده |
|------|-------|-------|
| ارتباط | Polling (Hangfire) | SignalR real-time |
| دسترسی | فقط اعضای باشگاه | تعمیم به همه؟ |
| نوع پیام | متنی | متنی + تصویری |
---
## ۷. Landing Page
### ۷.۱ ساختار
```
Hero Section (انیمیشن fade-in)
ویژگی‌ها (Features Grid — 3 ستونه)
محصولات ویژه (Carousel)
آمار (Counter animation — اصلاح‌شده)
CTA — Call to Action (ثبت‌نام / ورود)
```
### ۷.۲ اصلاح انیمیشن Counter
```
مشکل: اعداد به صورت exponential افزایش پیدا می‌کردند
راه‌حل: linear interpolation با requestAnimationFrame
start → target در ۲ ثانیه، مساوی‌الفاصله
```
---
## ۸. خلاصه وضعیت
| ماژول | وضعیت | درصد |
|-------|--------|------|
| Site Pages (Shopify-style) | ✅ | 100% |
| بلاگ + Pagination | ✅ | 100% |
| مدیریت فایل | ✅ | 100% |
| SMS (Kavenegar) | ✅ | 100% |
| ایمیل | ⚠️ محدود | 50% |
| Chatika AI | ✅ | 100% |
| Landing Page | ✅ | 100% |
| SystemConstants | ✅ | 100% |
| SEO Meta Tags | ⬜ | 20% |