Files
docs/business/BUSINESS-05-CONTENT-MANAGEMENT.md
masoodafar-web 421a651975 docs: Magic Wallet + VAT 10% documentation update
- All 14 totalDoc files updated with Magic Wallet additions
- MAGIC-WALLET-PLAN.md: Phase 1-6 checklist fully marked complete
- Business docs: Magic Wallet section, commission filter, new entities
- Payment docs: VAT 9%→10%, TransactionType 14+15, ZarinPal 4th usage
- Technical docs: UserWallet fields, ClubMembershipCycle, gRPC RPCs
- Overview docs: Magic flowchart, ER diagram, changelog, glossary, roadmap
2026-02-22 20:09:01 +03:30

251 lines
7.5 KiB
Markdown
Raw Permalink 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`
> **آخرین بروزرسانی:** اسفند ۱۴۰۴ (بروزرسانی: Magic Wallet + VAT 10%)
---
## ۱. مدیریت صفحات سایت (Site Pages)
### ۱.۱ معماری ساده‌شده (Shopify-style)
```mermaid
flowchart LR
subgraph BEFORE["قبل — پیچیده"]
X1["SitePage"] --> X2["SitePageSetting"] --> X3["SitePageContent"] --> X4["Template\n... 7 جدول"]
end
subgraph AFTER["بعد — ساده ✅"]
Y1["SitePage\nPageType + JsonSettings"] --> Y2["هر PageType\nیک typed editor"]
end
```
### ۱.۲ انواع صفحات
| 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)
### ۳.۱ معماری
```mermaid
flowchart TD
A["آپلود فایل\nتصویر / سند"] --> B["FileManagementService"]
B --> C["ذخیره در فایل‌سیستم\n+ ثبت در DB"]
C --> D["مسیر: /app/uploads/year/month/guid.ext\nURL: /api/files/guid"]
```
> محدودیت: حداکثر 10MB • 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": "1000001110100",
"DefaultTemplate": "Afrino",
"_note": "تمام OTPها با قالب Afrino ارسال می‌شوند"
}
}
```
### ۴.۲ ایمیل
```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 | `ClubActivationFee` | 25200000 | هزینه فعالسازی (ریال) |
| Club | `ClubMembershipGiftValue` | 25200000 | واریز Pool |
| Club | `BasePackageAmount` | 56000000 | قیمت پکیج طلایی (ریال) |
| Club | `CommissionMaxNetworkLevel` | 15 | عمق محاسبه کمیسیون |
| Club | `CommissionMaxWeeklyBalancesPerLeg` | 300 | سقف هفتگی |
| Payment | `ShopVAT` | 0.1 (10%) | مالیات ارزش افزوده (هر دو فروشگاه) |
| Magic | `MagicWalletMultiplier` | 2.5 | ضریب شارژ جادویی |
| Magic | `MagicWalletMaxDeposit` | 1,000,000,000 | سقف واریز/دور (100M تومان) |
| Magic | `MagicWalletMaxCredit` | 2,500,000,000 | سقف اعتبار/دور (250M تومان) |
| Payment | `DayaLoanAmount` | 56000000 | مبلغ وام (ریال) |
| Payment | `MinimumWithdrawAmount` | 1000000 | حداقل برداشت (ریال) |
| Store | `MaxDiscountPercent` | per-product | 0-100، هر محصول جداگانه |
| Store | `ProductsPerPage` | 12 (FO) / 10 (CMS) | تعداد در صفحه |
| System | `CommissionCalculationMethod` | "SP" | Stored Procedure |
| System | `MaintenanceMode` | false | حالت تعمیر |
---
## ۶. Chatika AI Integration
### ۶.۱ معماری
```mermaid
flowchart TD
A["Hangfire Recurring Job\nهر ۵ دقیقه"] --> B["ChatikaJob\nبررسی پیام‌های جدید"]
B --> C["ارسال به Chatika API\nPolly retry ×3"]
C --> D["دریافت پاسخ\nذخیره در ChatMessages"]
D --> E["نمایش در UI باشگاه\nSignalR planned"]
```
### ۶.۲ فعلی vs آینده
| آیتم | فعلی | آینده |
|------|-------|-------|
| ارتباط | Polling (Hangfire) | SignalR real-time |
| دسترسی | فقط اعضای باشگاه | تعمیم به همه؟ |
| نوع پیام | متنی | متنی + تصویری |
---
## ۷. Landing Page
### ۷.۱ ساختار
```mermaid
flowchart TD
A["🎨 Hero Section\nانیمیشن fade-in"] --> B["✨ ویژگی‌ها\nFeatures Grid — 3 ستونه"]
B --> C["📦 محصولات ویژه\nCarousel"]
C --> D["📊 آمار\nCounter animation\nlinear interpolation"]
D --> E["🚀 CTA\nثبت‌نام / ورود"]
```
### ۷.۲ اصلاح انیمیشن 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% |