LikeShop Documentation

repository·master·Indexed 23 days ago

https://github.com/likeadmin-likeshop/likeshop

LikeShop is an open-source B2C e-commerce system featuring a complete suite of terminals including PC, H5, WeChat Mini Programs, and mobile apps. Built with a technical stack comprising PHP 7.4+, ThinkPHP 5.1, MySQL 5.7+, and Redis 6+, it utilizes Vue.js 2 and Nuxt.js for the PC storefront and Layui 2.7 for the admin backend. The system supports Docker deployment and provides both a Free Enterprise version (v3.5.1) and a Paid Enterprise version with additional support and update services.

Tokens
16.5K
Snippets
24
Records
100
Agent score
80%

What's inside LikeShop

  1. Overview of Painter 画板 (Beta)

    master
    Painter 画板 is a poster generation solution for uniapp. It provides an elegant way to design and generate posters/images within a uniapp environment. It is currently in Beta and supports multiple platforms including H5, WeChat Mini Programs, Alipay Mini Programs, Toutiao Mini Programs, QQ Mini Programs, and App. Note that Baidu Mini Program support is untested.
  2. LikeShop Technical Stack Overview

    master

    LikeShop is built using a modern web stack across different terminals:

    Server-side

    • PHP: 7.4+
    • Framework: ThinkPHP 5.1
    • Database: MySQL 5.7+
    • Caching/Queue: Redis 6+
    • Deployment: Docker

    PC Admin Backend

    • Framework: Layui 2.7
    • Rendering: Server-side rendering

    Mobile Frontend

    • Framework: uni-app, Vue.js 2
    • Compatibility: Adapted for WeChat Mini Programs, H5, Android, and iOS apps.

    PC Storefront

    • Framework: Vue.js 2, Nuxt.js
    • Architecture: Front-end/Back-end separation
  3. ThinkPHP 5.1 System Requirements and Features

    master

    ThinkPHP 5.1 is an LTS (Long Term Support) framework.

    Requirements:

    • PHP version: 5.6+ (compatible with PHP 8.0)

    Key Features:

    • Container-based object management
    • Support for Facades and Dependency Injection
    • Enhanced routing (including annotation routing and cross-domain support)
    • Enhanced validation, models, and database support
    • Middleware support (available in V5.1.6+)
    • Support for Swoole/Workerman runtimes (available in V5.1.18+)
    • PSR-3 logging specification support

    Deprecated Features:

    • Aggregate models
    • Built-in controller extension classes
    • Model automatic validation
  4. Preview the LikeShop Single-Merchant Interface

    master

    LikeShop provides three distinct interfaces for the single-merchant version:

    1. Mobile Mall Interface: Optimized for mobile users.
    2. PC Mall Interface: Optimized for desktop web browsing.
    3. PC Admin Backend: The management console for administrators to control store operations.

    Visual previews of these interfaces are available in the project documentation to help you understand the user experience before deployment.

  5. Compare Free and Paid Enterprise versions

    master

    LikeShop offers two main tiers for its single-merchant B2C system:

    Free Enterprise Version (Current Repository)

    • Version: v3.5.1
    • License: Fully open source and supports commercial use (must retain copyright information).
    • Features: Includes full functionality such as distribution, group buying, price cutting, lucky draws, and payments.
    • Terminals: H5, WeChat Mini Program, APP, PC Store, and Admin Backend.
    • Limitations: Does not support online upgrades or automatic updates.
    • Updates: Supports continuous updates and online upgrade services.
    • Branding: Allows removal of copyright identifiers.
    • Support: Provides a more comprehensive technical support system.
  6. Use object-fit to control image scaling

    master

    When styling image elements within the painter, use the object-fit property to define how the image fills its container:

    • contain: Scales the image to maintain aspect ratio so the entire image is visible.
    • cover: Scales the image to fill the container, maintaining aspect ratio but potentially cropping the edges.
    • fill: Stretches the image to exactly match the container dimensions.
    • none: Maintains the original image dimensions without scaling.
  7. Follow ThinkPHP 5.1 naming conventions

    master

    To maintain compatibility with the framework's auto-loading and standards, follow these naming rules:

    Classes and Files

    • Classes: Use PascalCase (e.g., User, UserType). Do not append Controller to the class name if it's in a controller directory (e.g., use User instead of UserController).
    • Files: Class filenames must match the class name and use PascalCase. All library/function files must use the .php extension.

    Methods and Properties

    • Methods: Use camelCase starting with a lowercase letter (e.g., getUserName).
    • Properties: Use camelCase starting with a lowercase letter (e.g., tableName).
    • Functions: Use lowercase with underscores (e.g., get_client_ip).
    • Magic Methods: Prefix with double underscores (e.g., __call).

    Constants and Configuration

    • Constants: Use uppercase with underscores (e.g., APP_PATH).
    • Configuration Parameters: Use lowercase with underscores (e.g., url_route_on).

    Database

    • Tables and Fields: Use lowercase with underscores (e.g., think_user table, user_name field). Avoid camelCase or Chinese characters for database identifiers.
  8. Understand the ThinkPHP 5.1 directory structure

    master

    The project follows a specific directory layout for separating application logic, configuration, and public assets:

    • www/: The web deployment directory (or subdirectory).
    • application/: The application directory containing modules, controllers, models, and views.
      • application/common/: Common module directory.
      • application/module_name/: Specific module directory (contains controller, model, view, etc.).
    • config/: Application configuration directory (e.g., database.php, app.php, cache.php).
    • route/: Route definition directory.
    • public/: The web root directory accessible to the public (contains index.php).
    • thinkphp/: The framework system directory.
    • extend/: Extension library directory.
    • runtime/: Application runtime directory (must be writable).
    • vendor/: Third-party libraries managed by Composer.
    • think: The command-line entry point file.
    www  WEB部署目录
    ├─application           应用目录
    │  ├─common             公共模块目录
    │  ├─module_name        模块目录
    │  │  ├─controller      控制器目录
    │  │  ├─model           模型目录
    │  │  └─view            视图目录
    │  ├─common.php         公共函数文件
    ├─config                应用配置目录
    ├─route                 路由定义目录
    ├─public                WEB目录(对外访问目录)
    ├─thinkphp              框架系统目录
    ├─extend                扩展类库目录
    ├─runtime               应用的运行时目录
    ├─vendor                第三方类库目录
    └─think                 命令行入口文件
  9. Understand the difference between Free and Paid Enterprise versions

    master

    LikeShop operates on an "Open Source + Commercial Support" model. When choosing a version, consider the following:

    • Free Enterprise Edition: Provides full functional capabilities and supports commercial use. However, you must retain the official copyright identifiers to support the open-source ecosystem.
    • Paid Enterprise Edition: Receives continuous feature updates, improved stability, and priority access to new features. This version is recommended if you require the removal of copyright identifiers or advanced commercial support.

    To remove copyright branding or access higher-tier services, you should obtain official authorization from the LikeShop team.

  10. Use lime-painter via HTML or JSON schema

    master

    The l-painter component supports two ways to draw posters: using specialized HTML components or a JSON schema.

    1. HTML Method

    Use the following components within <l-painter>:

    • <l-painter-view>: A container similar to a div that can nest other components.
    • <l-painter-text>: For rendering text.
    • <l-painter-image>: For rendering images.
    • <l-painter-qrcode>: For rendering QR codes.

    Note: Instead of the standard style attribute, use the css attribute to define styles (e.g., css="background: #000; height: 100rpx;").

    2. JSON Schema Method

    Pass a JSON object to the :board prop. In the JSON schema:

    • Component types are defined by the type field: view, text, image, or qrcode.
    • Styles are defined in a css object using camelCase keys (e.g., lineHeight instead of line-height).
    • Nested elements are placed in a views array within a view type object.
  11. Quickstart: Configure uView UI in uni-app

    master

    Follow these four steps to integrate uView UI into your project. This setup enables component auto-import via easycom and global styles.

    1. Register the library in main.js: Import uView and use it with Vue.

    2. Import base styles in App.vue: Ensure your <style> tag has the lang="scss" attribute.

    3. Import global SCSS variables in uni.scss: This allows you to use uView's theme variables throughout your project.

    4. Configure easycom in pages.json: This enables automatic component loading. For npm installations, use the path without the @/ prefix.

    // 1. main.js
    import uView from 'uview-ui';
    Vue.use(uView);
    
    // 2. App.vue
    <style lang="scss">
    @import "uview-ui/index.scss";
    </style>
    
    // 3. uni.scss
    @import "uview-ui/theme.scss";
    
    // 4. pages.json
    {
    	"easycom": {
    		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
    	},
    	"pages": [
    		// ...
    	]
    }