当前位置:首页>python>Python 零基础100天—Day66 在线商城 MVP

Python 零基础100天—Day66 在线商城 MVP

  • 2026-08-18 23:10:46
Python 零基础100天—Day66 在线商城 MVP

在线商城 MVP — Django 终极实战

🕐 预计用时:3-4 小时 | 🎯 目标:用 Django 构建完整的在线商城(商品展示 + 购物车 + 订单 + 用户中心)


📖 今日目录

  1. 项目需求分析
  2. 项目结构
  3. 数据模型设计
  4. 商品展示模块
  5. 购物车模块
  6. 订单模块
  7. 用户中心
  8. 模板设计
  9. 完整代码
  10. 今日小结

1. 项目需求分析

功能
说明
涉及技术
商品分类
多级分类导航
ForeignKey 自关联
商品列表
分页、搜索、排序
ListView + Filter
商品详情
图片、描述、价格
DetailView
购物车
添加/修改/删除商品
Session 存储
下单结算
生成订单、扣减库存
数据库事务
用户中心
订单列表、收货地址
用户认证 + CRUD

2. 项目结构

shop/├── shop/│   ├── __init__.py│   ├── settings.py│   ├── urls.py│   └── wsgi.py├── apps/│   ├── products/       # 商品模块│   │   ├── models.py│   │   ├── views.py│   │   ├── urls.py│   │   └── admin.py│   ├── cart/           # 购物车模块│   │   ├── cart.py      # 购物车类│   │   ├── views.py│   │   └── urls.py│   ├── orders/         # 订单模块│   │   ├── models.py│   │   ├── views.py│   │   └── urls.py│   └── users/          # 用户模块│       ├── views.py│       └── urls.py├── templates/├── static/├── media/├── manage.py└── requirements.txt

3. 数据模型设计

# apps/products/models.pyfrom django.db import modelsclass Category(models.Model):    name = models.CharField('分类名称', max_length=100)    parent = models.ForeignKey('self', null=True, blank=True,                               on_delete=models.CASCADE,                               related_name='children',                               verbose_name='父分类')    icon = models.CharField('图标', max_length=50, blank=True)    order = models.IntegerField('排序', default=0)    class Meta:        verbose_name = '分类'        ordering = ['order']    def __str__(self):        return self.nameclass Product(models.Model):    name = models.CharField('商品名称', max_length=200)    slug = models.SlugField('URL别名', unique=True)    category = models.ForeignKey(Category, on_delete=models.SET_NULL,                                 null=True, related_name='products')    description = models.TextField('商品描述', blank=True)    price = models.DecimalField('价格', max_digits=10, decimal_places=2)    original_price = models.DecimalField('原价', max_digits=10, decimal_places=2,                                         null=True, blank=True)    stock = models.PositiveIntegerField('库存', default=0)    sales = models.PositiveIntegerField('销量', default=0)    image = models.ImageField('商品图片', upload_to='products/', blank=True)    is_active = models.BooleanField('上架', default=True)    created_at = models.DateTimeField('创建时间', auto_now_add=True)    updated_at = models.DateTimeField('更新时间', auto_now=True)    class Meta:        verbose_name = '商品'        ordering = ['-created_at']    def __str__(self):        return self.name    @property    def is_in_stock(self):        return self.stock > 0
# apps/orders/models.pyfrom django.db import modelsfrom django.conf import settingsclass Order(models.Model):    STATUS_CHOICES = [        ('pending', '待付款'),        ('paid', '已付款'),        ('shipped', '已发货'),        ('delivered', '已收货'),        ('cancelled', '已取消'),    ]    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE,                             related_name='orders')    order_no = models.CharField('订单号', max_length=64, unique=True)    status = models.CharField('状态', max_length=20, choices=STATUS_CHOICES, default='pending')    total_amount = models.DecimalField('总金额', max_digits=10, decimal_places=2)    # 收货信息    receiver_name = models.CharField('收货人', max_length=50)    receiver_phone = models.CharField('手机号', max_length=20)    receiver_address = models.CharField('收货地址', max_length=300)    created_at = models.DateTimeField('创建时间', auto_now_add=True)    paid_at = models.DateTimeField('付款时间', null=True, blank=True)    class Meta:        verbose_name = '订单'        ordering = ['-created_at']    def __str__(self):        return f'订单 {self.order_no}'class OrderItem(models.Model):    order = models.ForeignKey(Order, on_delete=models.CASCADE, related_name='items')    product = models.ForeignKey('products.Product', on_delete=models.SET_NULL, null=True)    product_name = models.CharField('商品名称', max_length=200)    price = models.DecimalField('单价', max_digits=10, decimal_places=2)    quantity = models.IntegerField('数量', default=1)    @property    def subtotal(self):        return self.price * self.quantity
# apps/users/models.pyclass Address(models.Model):    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE,                             related_name='addresses')    receiver_name = models.CharField('收货人', max_length=50)    phone = models.CharField('手机号', max_length=20)    province = models.CharField('省', max_length=50)    city = models.CharField('市', max_length=50)    district = models.CharField('区', max_length=50)    detail = models.CharField('详细地址', max_length=200)    is_default = models.BooleanField('默认地址', default=False)    class Meta:        verbose_name = '收货地址'        ordering = ['-is_default']

4. 商品展示模块

# apps/products/views.pyfrom django.views.generic import ListView, DetailViewfrom .models import Product, Categoryclass ProductListView(ListView):    model = Product    template_name = 'products/product_list.html'    context_object_name = 'products'    paginate_by = 12    def get_queryset(self):        queryset = super().get_queryset().filter(is_active=True)        # 分类筛选        category_id = self.kwargs.get('category_id')        if category_id:            category = Category.objects.get(id=category_id)            # 包含子分类            categories = category.get_descendants()            queryset = queryset.filter(category__in=categories)        # 关键词搜索        q = self.request.GET.get('q')        if q:            queryset = queryset.filter(name__icontains=q)        # 排序        sort = self.request.GET.get('sort', '-created_at')        if sort == 'price':            queryset = queryset.order_by('price')        elif sort == '-price':            queryset = queryset.order_by('-price')        elif sort == 'sales':            queryset = queryset.order_by('-sales')        return queryset    def get_context_data(self, **kwargs):        context = super().get_context_data(**kwargs)        context['categories'] = Category.objects.filter(parent=None)        context['current_sort'] = self.request.GET.get('sort', '-created_at')        context['query'] = self.request.GET.get('q', '')        return contextclass ProductDetailView(DetailView):    model = Product    template_name = 'products/product_detail.html'    context_object_name = 'product'    def get_queryset(self):        return super().get_queryset().filter(is_active=True)

5. 购物车模块

# apps/cart/cart.pyfrom decimal import Decimalclass Cart:    """Session 购物车"""    def __init__(self, request):        self.session = request.session        cart = self.session.get('cart')        if not cart:            cart = self.session['cart'] = {}        self.cart = cart    def add(self, product, quantity=1):        """添加商品"""        product_id = str(product.id)        if product_id not in self.cart:            self.cart[product_id] = {                'quantity': 0,                'price': str(product.price),                'name': product.name,            }        self.cart[product_id]['quantity'] += quantity        self.save()    def remove(self, product_id):        """删除商品"""        product_id = str(product_id)        if product_id in self.cart:            del self.cart[product_id]            self.save()    def update(self, product_id, quantity):        """更新数量"""        product_id = str(product_id)        if product_id in self.cart:            self.cart[product_id]['quantity'] = quantity            if quantity <= 0:                self.remove(product_id)            else:                self.save()    def save(self):        self.session.modified = True    def __iter__(self):        """遍历购物车商品"""        for item in self.cart.values():            item['total_price'] = Decimal(item['price']) * item['quantity']            yield item    def __len__(self):        """商品总数"""        return sum(item['quantity'] for item in self.cart.values())    def get_total_price(self):        return sum(Decimal(item['price']) * item['quantity'] for item in self.cart.values())    def clear(self):        del self.session['cart']        self.save()
# apps/cart/views.pyfrom django.shortcuts import render, redirect, get_object_or_404from django.contrib.auth.decorators import login_requiredfrom apps.products.models import Productfrom .cart import Cartdef cart_detail(request):    cart = Cart(request)    return render(request, 'cart/detail.html', {'cart': cart})def cart_add(request, product_id):    product = get_object_or_404(Product, id=product_id)    cart = Cart(request)    quantity = int(request.POST.get('quantity', 1))    cart.add(product, quantity)    return redirect('cart:detail')def cart_remove(request, product_id):    cart = Cart(request)    cart.remove(product_id)    return redirect('cart:detail')def cart_update(request, product_id):    cart = Cart(request)    quantity = int(request.POST.get('quantity', 1))    cart.update(product_id, quantity)    return redirect('cart:detail')

6. 订单模块

# apps/orders/views.pyimport uuidfrom django.shortcuts import render, redirectfrom django.contrib.auth.decorators import login_requiredfrom django.db import transactionfrom django.utils import timezonefrom .models import Order, OrderItemfrom apps.cart.cart import Cart@login_requireddef order_create(request):    """创建订单"""    cart = Cart(request)    if len(cart) == 0:        return redirect('cart:detail')    if request.method == 'POST':        with transaction.atomic():  # 数据库事务            # 创建订单            order = Order.objects.create(                user=request.user,                order_no=f'{timezone.now().strftime("%Y%m%d%H%M%S")}{uuid.uuid4().hex[:8]}',                total_amount=cart.get_total_price(),                receiver_name=request.POST['receiver_name'],                receiver_phone=request.POST['receiver_phone'],                receiver_address=request.POST['receiver_address'],            )            # 创建订单项 + 扣减库存            for item in cart:                product = Product.objects.select_for_update().get(name=item['name'])                if product.stock < item['quantity']:                    transaction.rollback()                    return render(request, 'cart/detail.html', {                        'cart': cart,                        'error': f'{product.name} 库存不足'                    })                OrderItem.objects.create(                    order=order,                    product=product,                    product_name=product.name,                    price=Decimal(item['price']),                    quantity=item['quantity'],                )                product.stock -= item['quantity']                product.sales += item['quantity']                product.save()            cart.clear()  # 清空购物车            return redirect('orders:detail', order_no=order.order_no)    return render(request, 'orders/create.html', {'cart': cart})@login_requireddef order_list(request):    """订单列表"""    orders = Order.objects.filter(user=request.user).prefetch_related('items')    return render(request, 'orders/list.html', {'orders': orders})@login_requireddef order_detail(request, order_no):    """订单详情"""    order = Order.objects.prefetch_related('items').get(        user=request.user, order_no=order_no    )    return render(request, 'orders/detail.html', {'order': order})@login_requireddef order_cancel(request, order_no):    """取消订单"""    order = Order.objects.get(user=request.user, order_no=order_no, status='pending')    with transaction.atomic():        for item in order.items.all():            if item.product:                item.product.stock += item.quantity                item.product.sales -= item.quantity                item.product.save()        order.status = 'cancelled'        order.save()    return redirect('orders:detail', order_no=order.order_no)

7. 用户中心

# apps/users/views.pyfrom django.shortcuts import render, redirectfrom django.contrib.auth.decorators import login_requiredfrom django.contrib.auth import update_session_auth_hashfrom .models import Addressfrom .forms import AddressForm@login_requireddef profile(request):    """个人中心"""    orders = request.user.orders.all()[:5]  # 最近 5 个订单    return render(request, 'users/profile.html', {'orders': orders})@login_requireddef address_list(request):    """收货地址列表"""    addresses = request.user.addresses.all()    return render(request, 'users/address_list.html', {'addresses': addresses})@login_requireddef address_create(request):    """添加地址"""    if request.method == 'POST':        form = AddressForm(request.POST)        if form.is_valid():            address = form.save(commit=False)            address.user = request.user            address.save()            return redirect('users:address_list')    else:        form = AddressForm()    return render(request, 'users/address_form.html', {'form': form})@login_requireddef change_password(request):    """修改密码"""    if request.method == 'POST':        old_pw = request.POST.get('old_password')        new_pw = request.POST.get('new_password')        if request.user.check_password(old_pw):            request.user.set_password(new_pw)            request.user.save()            update_session_auth_hash(request, request.user)            return redirect('users:profile')    return render(request, 'users/change_password.html')

8. 模板设计

<!-- templates/products/product_list.html -->{% extends "base.html" %}{% load static %}{% block content %}<div class="shop-layout">    {# 分类侧边栏 #}    <aside class="sidebar">        <h3>商品分类</h3>        <ul>        {% for cat in categories %}            <li>                <a href="{% url 'products:list' cat.id %}">{{ cat.name }}</a>                {% if cat.children.all %}                <ul>                    {% for child in cat.children.all %}                    <li><a href="{% url 'products:list' child.id %}">{{ child.name }}</a></li>                    {% endfor %}                </ul>                {% endif %}            </li>        {% endfor %}        </ul>    </aside>    {# 商品列表 #}    <main class="product-grid">        {# 搜索栏 #}        <form method="GET" class="search-bar">            <input type="text" name="q" value="{{ query }}" placeholder="搜索商品...">            <button type="submit">搜索</button>        </form>        {# 排序 #}        <div class="sort-bar">            <a href="?sort=-created_at" {% if current_sort == '-created_at' %}class="active"{% endif %}>最新</a>            <a href="?sort=price" {% if current_sort == 'price' %}class="active"{% endif %}>价格↑</a>            <a href="?sort=-price" {% if current_sort == '-price' %}class="active"{% endif %}>价格↓</a>            <a href="?sort=sales" {% if current_sort == 'sales' %}class="active"{% endif %}>销量</a>        </div>        {# 商品卡片 #}        <div class="products">        {% for product in products %}            <div class="product-card">                <a href="{% url 'products:detail' product.pk %}">                    <img src="{{ product.image.url }}" alt="{{ product.name }}">                    <h4>{{ product.name }}</h4>                    <p class="price">¥{{ product.price }}</p>                    {% if product.original_price %}                        <p class="original-price">¥{{ product.original_price }}</p>                    {% endif %}                    <p class="sales">已售 {{ product.sales }}</p>                </a>            </div>        {% endfor %}        </div>        {# 分页 #}        {% include "includes/pagination.html" %}    </main></div>{% endblock %}
<!-- templates/cart/detail.html -->{% extends "base.html" %}{% block content %}<h1>🛒 购物车</h1>{% if error %}    <div class="alert alert-danger">{{ error }}</div>{% endif %}{% if cart|length > 0 %}<table class="cart-table">    <tr>        <th>商品</th><th>单价</th><th>数量</th><th>小计</th><th>操作</th>    </tr>    {% for item in cart %}    <tr>        <td>{{ item.name }}</td>        <td>¥{{ item.price }}</td>        <td>            <form method="POST" action="{% url 'cart:update' item.product_id %}" style="display:inline">                {% csrf_token %}                <input type="number" name="quantity" value="{{ item.quantity }}" min="1">                <button type="submit">更新</button>            </form>        </td>        <td>¥{{ item.total_price }}</td>        <td><a href="{% url 'cart:remove' item.product_id %}">删除</a></td>    </tr>    {% endfor %}</table><div class="cart-total">    <p>共 {{ cart|length }} 件商品,合计:<strong>¥{{ cart.get_total_price }}</strong></p>    <a href="{% url 'orders:create' %}" class="btn">去结算</a></div>{% else %}    <p>购物车是空的,<a href="{% url 'products:list' %}">去逛逛</a></p>{% endif %}{% endblock %}

9. 完整代码

📄 urls.py

# shop/urls.pyfrom django.contrib import adminfrom django.urls import path, includefrom django.conf import settingsfrom django.conf.urls.static import staticurlpatterns = [    path('admin/', admin.site.urls),    path('', include('apps.products.urls')),    path('cart/', include('apps.cart.urls')),    path('orders/', include('apps.orders.urls')),    path('user/', include('apps.users.urls')),    path('accounts/', include('django.contrib.auth.urls')),]if settings.DEBUG:    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# apps/products/urls.pyfrom django.urls import pathfrom . import viewsapp_name = 'products'urlpatterns = [    path('', views.ProductListView.as_view(), name='list'),    path('category/<int:category_id>/', views.ProductListView.as_view(), name='category_list'),    path('product/<int:pk>/', views.ProductDetailView.as_view(), name='detail'),]# apps/cart/urls.pyapp_name = 'cart'urlpatterns = [    path('', views.cart_detail, name='detail'),    path('add/<int:product_id>/', views.cart_add, name='add'),    path('remove/<int:product_id>/', views.cart_remove, name='remove'),    path('update/<int:product_id>/', views.cart_update, name='update'),]# apps/orders/urls.pyapp_name = 'orders'urlpatterns = [    path('', views.order_list, name='list'),    path('create/', views.order_create, name='create'),    path('<str:order_no>/', views.order_detail, name='detail'),    path('<str:order_no>/cancel/', views.order_cancel, name='cancel'),]

10. 今日小结

模块
核心实现
商品分类
ForeignKey 自关联,支持多级分类
商品列表
ListView + 分页 + 搜索 + 排序
购物车
Session 存储,Cart 类封装 CRUD
订单
数据库事务(transaction.atomic)+ 库存扣减
用户中心
订单列表 + 收货地址 + 修改密码
权限控制
@login_required,只能操作自己的数据

🎉 Django 阶段完结!Day 59-66 你已经掌握了 Django 的全部核心:✅ MVT 架构 · 路由 · Admin · 模型 · 视图 · 模板✅ 表单 · 认证 · DRF API · 部署 · 综合项目接下来进入前端基础(Day 67-70)—— HTML、CSS、JavaScript,让你的全栈技能闭环!

轻松时刻:

请在微信客户端打开

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-08-21 14:41:50 HTTP/2.0 GET : https://f.mffb.com.cn/a/505928.html
  2. 运行时间 : 0.372130s [ 吞吐率:2.69req/s ] 内存消耗:4,843.56kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=3eb81a59269919cf87dd1c452429297d
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.001194s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001771s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.006861s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000719s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001551s ]
  6. SELECT * FROM `set` [ RunTime:0.000604s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001771s ]
  8. SELECT * FROM `article` WHERE `id` = 505928 LIMIT 1 [ RunTime:0.013104s ]
  9. UPDATE `article` SET `lasttime` = 1787294510 WHERE `id` = 505928 [ RunTime:0.052641s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.003794s ]
  11. SELECT * FROM `article` WHERE `id` < 505928 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001520s ]
  12. SELECT * FROM `article` WHERE `id` > 505928 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001155s ]
  13. SELECT * FROM `article` WHERE `id` < 505928 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.002468s ]
  14. SELECT * FROM `article` WHERE `id` < 505928 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.087381s ]
  15. SELECT * FROM `article` WHERE `id` < 505928 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.030925s ]
0.375666s