3c729304db
Corrections verified against actual CMS/BackOffice/FrontOffice source code: - ClubActivationFee: 25,200,000 (not 25,000,000) - Tree depth: no limit (15 is commission calculation depth only) - IPG wallet charge: Balance=56M + Discount=56M - DayaLoan wallet charge: Balance=56M + Discount=112M (2×) - Discount: per-product MaxDiscountPercent (not fixed 30%) - VAT: 10% (ShopVAT) vs 9% (discount store PlaceOrder) - Kavenegar template: 'Afrino' only (not verify-foursat) - SMS sender: 1000001110100 - DayaLoan job: every 20min (not 15min) - Commission job: Sunday 00:05 (not Saturday) - Network tree: on User entity (not separate NetworkNode table) - UserWallets entity (not UserWalletBalances) - OTP: 6 digits, 5 attempts, 2min TTL, 60s cooldown - Removed non-existent constants (ClubJoiningPercentage, ClubActivationThreshold) - Fixed Hangfire Chatika interval: every 5min - Removed InventorySync from recurring jobs list
270 lines
7.3 KiB
Markdown
270 lines
7.3 KiB
Markdown
# 📄 محتوا، صفحات، بلاگ و ایمیل/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": "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%) | مالیات (فروشگاه تخفیفی: 9%) |
|
||
| 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
|
||
|
||
### ۶.۱ معماری
|
||
|
||
```
|
||
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% |
|