数据生成器

¥688.00 ¥800.00
无货
快速生成 InnoShop 系统测试数据,包括访问日志、访问事件、产品、订单、客户等,用于测试 IP、PV、UV、转化率等统计功能。
加入收藏

Data Generator Plugin for InnoShop

A powerful test data generator plugin for InnoShop e-commerce system. Generate realistic visit logs, conversion events, products, orders, and more for development and testing purposes.

Features

  • Visit Data Generation

    • Generate realistic visit sessions with IP addresses, device info, browser, OS, and geolocation
    • Configurable daily PV (Page Views), UV/PV ratio, and new visitor rate
    • Device distribution control (desktop, mobile, tablet)
    • Hourly traffic distribution to simulate real user behavior
  • Visit Event Generation

    • Generate conversion funnel events
    • Configurable conversion rates at each funnel stage
    • Automatic funnel simulation:
      • Product Views → Add to Cart → Checkout → Order → Payment
    • Register events tracking
  • Business Data Generation

    • Products with SKUs, prices, and multi-language translations
    • Category tree structure
    • Brands
    • Customers with addresses
    • Orders with items and payment status
  • Statistics Aggregation

    • Automatically aggregates daily statistics for visit and conversion data
    • Generates visit_daily and conversion_daily records

Installation

  1. Copy the plugin to the plugins/DataGenerator directory
  2. Enable the plugin in InnoShop admin panel
  3. Access via: Plugins > Data Generator or use CLI commands

CLI Commands (Recommended)

The plugin provides powerful CLI commands for quick and efficient data generation.

1. Scenario Commands

Quickly generate data using predefined scenarios:

# small - Small scale testing (50 PV/day)
php artisan data:scenario small --days=7

# medium - Medium scale (200 PV/day, includes products & orders)
php artisan data:scenario medium --days=30

# large - Large scale (1000 PV/day)
php artisan data:scenario large --days=90

# demo - Demo data (auto-clears first)
php artisan data:scenario demo --days=30

# With custom locale
php artisan data:scenario medium --days=30 --locale=zh-cn

# Clear existing data before generating
php artisan data:scenario small --clear

Scenario Comparison

Scenario Daily PV Products Customers Orders Use Case
small 50 10 5 5 Quick testing
medium 200 50 20 30 Development
large 1000 200 100 200 Stress testing
demo 500 100 50 80 Demo/Presentation

2. Generate Command

Customize all parameters for fine-grained control:

# Generate only visit data
php artisan data:generate --types=visits,visit_events --daily-pv=500

# Generate all types with custom configuration
php artisan data:generate \
  --types=visits,visit_events,products,customers,orders \
  --start=2024-01-01 \
  --end=2024-01-31 \
  --daily-pv=1000 \
  --uv-pv-ratio=0.4 \
  --view-to-cart=5 \
  --cart-to-checkout=40

# High conversion rate testing
php artisan data:generate \
  --types=visits,visit_events \
  --view-to-cart=20 \
  --cart-to-checkout=80 \
  --checkout-to-order=80 \
  --order-to-payment=90

# Generate Chinese locale products
php artisan data:generate --types=products --locale=zh-cn

Available Options

Option Description Default
--types Data types (comma-separated) visits,visit_events
--start Start date (Y-m-d) 30 days ago
--end End date (Y-m-d) today
--daily-pv Daily page views 1000
--uv-pv-ratio UV/PV ratio 0.4
--new-visitor-rate New visitor rate 0.4
--desktop-ratio Desktop traffic ratio 0.6
--mobile-ratio Mobile traffic ratio 0.35
--view-to-cart View→Cart rate (%) 5
--cart-to-checkout Cart→Checkout rate (%) 40
--checkout-to-order Checkout→Order rate (%) 60
--order-to-payment Order→Payment rate (%) 80
--product-count Product count 50
--category-count Category count 10
--brand-count Brand count 10
--customer-count Customer count 20
--order-count Order count 30
--locale Locale (en, zh-cn) en
--clear Clear existing data first false

3. Clear Command

Remove generated test data:

# Clear visit data for date range
php artisan data:clear --types=visits,visit_events --start=2024-01-01 --end=2024-01-31

# Clear all test data
php artisan data:clear --all

# Clear specific data types
php artisan data:clear --types=products,categories,brands

Web Interface

Access via admin panel at /panel/data-generator:

  1. Navigate to Admin > Plugins > Data Generator
  2. Select data types to generate
  3. Configure date range and settings
  4. Click Generate Data

Programmatic Usage

use Plugin\DataGenerator\Services\GeneratorService;

$service = app(GeneratorService::class);

$results = $service->generate([
    'types' => ['visits', 'visit_events', 'products'],
    'start_date' => '2024-01-01',
    'end_date' => '2024-01-31',
    'daily_pv' => 1000,
    'uv_pv_ratio' => 0.4,
    'view_to_cart' => 5,
    'cart_to_checkout' => 40,
    'checkout_to_order' => 60,
    'order_to_payment' => 80,
]);

Data Models

Visit (visits table)

- session_id       // Unique session identifier
- customer_id      // Associated customer (nullable)
- ip_address       // Visitor IP
- user_agent       // Browser user agent
- country_code     // ISO country code
- country_name     // Country name
- city             // City name
- referrer         // Traffic source
- device_type      // desktop/mobile/tablet
- browser          // Browser name
- os               // Operating system
- locale           // Language code
- first_visited_at // First visit timestamp
- last_visited_at  // Last visit timestamp

Visit Event (visit_events table)

- session_id  // Associated visit session
- event_type  // Event type (see Event Types below)
- event_data  // JSON event details
- customer_id // Associated customer (nullable)
- ip_address  // IP address
- page_url    // Current page URL
- referrer    // Referrer URL

Event Types

Type Description
product_view Product page viewed
add_to_cart Product added to cart
checkout_start Checkout process started
order_placed Order successfully placed
payment_completed Payment completed
register User registration

Conversion Funnel

Product Views (100%)
        ↓
    Add to Carts (5% default)
        ↓
   Checkout Start (40% default)
        ↓
    Orders Placed (60% default)
        ↓
  Payment Completed (80% default)

Generated Statistics

After generating visit data, the plugin automatically aggregates statistics into:

  • visit_daily table: Daily PV, UV, IP counts, device breakdown, bounce rate, avg duration
  • conversion_daily table: Conversion funnel counts and rates

CLI vs Web Interface

Feature CLI Web Interface
Speed Fast Slower
Scripting Easy Difficult
CI/CD Supported Not supported
Automation Perfect Limited
Visual Feedback Console output UI display

License

This plugin is licensed under the Open Software License (OSL 3.0).

Support

For issues and feature requests, please visit: https://www.innoshop.com