当前位置:首页>java>C++设计模式代码重构实录:将混乱代码变为艺术品

C++设计模式代码重构实录:将混乱代码变为艺术品

  • 2026-02-05 00:45:36
C++设计模式代码重构实录:将混乱代码变为艺术品

在软件开发的漫长旅程中,代码质量的退化是一个不可避免的问题。随着业务需求的不断变化和功能的持续迭代,曾经优雅的代码逐渐变得臃肿、耦合度高、难以维护。这种现象被称为"代码腐化",它不仅会降低开发效率,还会增加项目的技术债务。

最近不少同学在准备春招/考研复试,也有朋友打算在社招跳槽换一份更好的工作。如果你也在做规划,这段时间其实非常适合静下心来补强技术。

如果你的目标是把技术水平拉起来,也想在简历上增加一些真正能说得出口的内容,可以趁这段时间做几个C++ 实战项目。既能把底层功底练扎实,也能让春招、考研复试、社招面试里遇到的技术问题更从容,有需要的朋友可以移步文末查看训练营相关介绍。

原始代码展示

#include<iostream>
#include<string>
#include<vector>
#include<fstream>

usingnamespacestd;

voidprocessOrder(conststring& orderId, constvector<string>& items){
// 验证订单
if (orderId.empty()) {
cout << "订单ID不能为空" << endl;
return;
    }

// 计算总价
double totalPrice = 0.0;
for (constauto& item : items) {
if (item == "book") {
            totalPrice += 50.0;
        } elseif (item == "pen") {
            totalPrice += 10.0;
        } elseif (item == "notebook") {
            totalPrice += 20.0;
        }
    }

// 生成订单文件
ofstream orderFile("order_" + orderId + ".txt");
if (orderFile.is_open()) {
        orderFile << "订单ID: " << orderId << endl;
        orderFile << "商品列表: ";
for (constauto& item : items) {
            orderFile << item << " ";
        }
        orderFile << endl;
        orderFile << "总价: " << totalPrice << endl;
        orderFile.close();
cout << "订单文件生成成功" << endl;
    } else {
cout << "无法创建订单文件" << endl;
    }

// 发送通知
cout << "订单已处理,通知客户" << endl;
}

intmain(){
vector<string> items = {"book""pen""notebook"};
    processOrder("20260203001", items);
return 0;
}

问题分析

这段代码存在以下主要问题:

  1. 单一职责原则违反processOrder函数承担了验证订单、计算总价、生成文件和发送通知等多个职责,导致函数过于庞大复杂。

  2. 紧耦合:函数内部直接依赖于具体的商品定价逻辑和文件操作方式,难以进行单元测试和扩展。

  3. 可扩展性差:当新增商品类型时,需要修改processOrder函数中的条件判断,违反了开闭原则。

  4. 代码重复:如果系统中存在多个类似的订单处理逻辑,会导致大量重复代码。

  5. 错误处理不完善:函数中的错误处理比较简单,缺乏统一的错误处理机制。

重构方案设计

设计思路

针对上述问题,我们将采用以下重构策略:

  1. 单一职责原则:将订单处理的不同职责拆分到不同的类中。
  2. 策略模式:将商品定价逻辑封装到策略类中,实现运行时切换。
  3. 工厂模式:根据不同的订单类型创建不同的订单处理器。
  4. 观察者模式:实现订单处理完成后的通知机制。

重构阶段规划

  1. 第一阶段:职责拆分,将订单处理的不同功能拆分到不同的类中。
  2. 第二阶段:应用策略模式,将商品定价逻辑抽象为策略接口。
  3. 第三阶段:应用工厂模式,实现订单处理器的动态创建。
  4. 第四阶段:应用观察者模式,实现订单处理完成后的通知机制。
  5. 第五阶段:代码优化与测试,确保重构后的代码功能正确且性能良好。

重构实施

第一阶段:职责拆分

将订单处理的不同职责拆分到不同的类中:

// 订单验证器
classOrderValidator {
public:
boolvalidate(conststring& orderId){
if (orderId.empty()) {
cout << "订单ID不能为空" << endl;
returnfalse;
        }
returntrue;
    }
};

// 价格计算器
classPriceCalculator {
public:
doublecalculate(constvector<string>& items){
double totalPrice = 0.0;
for (constauto& item : items) {
if (item == "book") {
                totalPrice += 50.0;
            } elseif (item == "pen") {
                totalPrice += 10.0;
            } elseif (item == "notebook") {
                totalPrice += 20.0;
            }
        }
return totalPrice;
    }
};

// 订单文件生成器
classOrderFileGenerator {
public:
boolgenerate(conststring& orderId, constvector<string>& items, double totalPrice){
ofstream orderFile("order_" + orderId + ".txt");
if (orderFile.is_open()) {
            orderFile << "订单ID: " << orderId << endl;
            orderFile << "商品列表: ";
for (constauto& item : items) {
                orderFile << item << " ";
            }
            orderFile << endl;
            orderFile << "总价: " << totalPrice << endl;
            orderFile.close();
cout << "订单文件生成成功" << endl;
return true;
        } else {
cout << "无法创建订单文件" << endl;
return false;
        }
    }
};

// 通知发送器
classNotificationSender {
public:
voidsend(conststring& orderId){
cout << "订单" << orderId << "已处理,通知客户" << endl;
    }
};

// 订单处理器
classOrderProcessor {
private:
    OrderValidator validator;
    PriceCalculator calculator;
    OrderFileGenerator fileGenerator;
    NotificationSender sender;

public:
voidprocess(conststring& orderId, constvector<string>& items){
if (!validator.validate(orderId)) {
return;
        }

double totalPrice = calculator.calculate(items);

if (!fileGenerator.generate(orderId, items, totalPrice)) {
return;
        }

        sender.send(orderId);
    }
};

intmain(){
vector<string> items = {"book""pen""notebook"};
    OrderProcessor processor;
    processor.process("20260203001", items);
return 0;
}

重构效果:将原来的单一函数拆分为多个类,每个类只负责一个职责,符合单一职责原则,提高了代码的可读性和可维护性。

第二阶段:应用策略模式

将商品定价逻辑抽象为策略接口,实现运行时切换:

// 定价策略接口
classPricingStrategy {
public:
virtualdoublecalculatePrice(conststring& item)0;
virtual ~PricingStrategy() = default;
};

// 图书定价策略
classBookPricingStrategy :public PricingStrategy {
public:
doublecalculatePrice(conststring& item)override{
return 50.0;
    }
};

// 笔定价策略
classPenPricingStrategy :public PricingStrategy {
public:
doublecalculatePrice(conststring& item)override{
return 10.0;
    }
};

// 笔记本定价策略
classNotebookPricingStrategy :public PricingStrategy {
public:
doublecalculatePrice(conststring& item)override{
return 20.0;
    }
};

// 价格计算器
classPriceCalculator {
private:
map<stringunique_ptr<PricingStrategy>> strategies;

public:
    PriceCalculator() {
        strategies["book"] = make_unique<BookPricingStrategy>();
        strategies["pen"] = make_unique<PenPricingStrategy>();
        strategies["notebook"] = make_unique<NotebookPricingStrategy>();
    }

doublecalculate(constvector<string>& items){
double totalPrice = 0.0;
for (constauto& item : items) {
if (strategies.find(item) != strategies.end()) {
                totalPrice += strategies[item]->calculatePrice(item);
            }
        }
return totalPrice;
    }
};

重构效果:将商品定价逻辑封装到策略类中,当新增商品类型时,只需新增对应的策略类,无需修改价格计算器的代码,符合开闭原则,提高了代码的可扩展性。

第三阶段:应用工厂模式

实现订单处理器的动态创建:

// 订单处理器接口
classOrderProcessor {
public:
virtualvoidprocess(conststring& orderId, constvector<string>& items)0;
virtual ~OrderProcessor() = default;
};

// 普通订单处理器
classNormalOrderProcessor :public OrderProcessor {
private:
    OrderValidator validator;
    PriceCalculator calculator;
    OrderFileGenerator fileGenerator;
    NotificationSender sender;

public:
voidprocess(conststring& orderId, constvector<string>& items)override{
if (!validator.validate(orderId)) {
return;
        }

double totalPrice = calculator.calculate(items);

if (!fileGenerator.generate(orderId, items, totalPrice)) {
return;
        }

        sender.send(orderId);
    }
};

// 加急订单处理器
classExpressOrderProcessor :public OrderProcessor {
private:
    OrderValidator validator;
    PriceCalculator calculator;
    OrderFileGenerator fileGenerator;
    NotificationSender sender;

public:
voidprocess(conststring& orderId, constvector<string>& items)override{
if (!validator.validate(orderId)) {
return;
        }

double totalPrice = calculator.calculate(items) * 1.2// 加急订单加价20%

if (!fileGenerator.generate(orderId, items, totalPrice)) {
return;
        }

        sender.send(orderId + " (加急)");
    }
};

// 订单处理器工厂
classOrderProcessorFactory {
public:
staticunique_ptr<OrderProcessor> createProcessor(conststring& orderType){
if (orderType == "normal") {
return make_unique<NormalOrderProcessor>();
        } elseif (orderType == "express") {
return make_unique<ExpressOrderProcessor>();
        }
return nullptr;
    }
};

intmain(){
vector<string> items = {"book""pen""notebook"};

// 创建普通订单处理器
auto normalProcessor = OrderProcessorFactory::createProcessor("normal");
if (normalProcessor) {
        normalProcessor->process("20260203001", items);
    }

// 创建加急订单处理器
auto expressProcessor = OrderProcessorFactory::createProcessor("express");
if (expressProcessor) {
        expressProcessor->process("20260203002", items);
    }

return 0;
}

重构效果:通过工厂模式实现了订单处理器的动态创建,客户端代码无需知道具体的处理器实现类,只需通过工厂类获取处理器实例,降低了客户端与具体实现的耦合度,提高了代码的可扩展性。

第四阶段:应用观察者模式

实现订单处理完成后的通知机制:

// 观察者接口
classOrderObserver {
public:
virtualvoidonOrderProcessed(conststring& orderId)0;
virtual ~OrderObserver() = default;
};

// 邮件通知观察者
classEmailNotificationObserver :public OrderObserver {
public:
voidonOrderProcessed(conststring& orderId)override{
cout << "发送邮件通知:订单" << orderId << "已处理" << endl;
    }
};

// 短信通知观察者
classSMSNotificationObserver :public OrderObserver {
public:
voidonOrderProcessed(conststring& orderId)override{
cout << "发送短信通知:订单" << orderId << "已处理" << endl;
    }
};

// 订单处理器接口
classOrderProcessor {
public:
virtualvoidprocess(conststring& orderId, constvector<string>& items)0;
virtualvoidaddObserver(unique_ptr<OrderObserver> observer)0;
virtual ~OrderProcessor() = default;
};

// 普通订单处理器
classNormalOrderProcessor :public OrderProcessor {
private:
    OrderValidator validator;
    PriceCalculator calculator;
    OrderFileGenerator fileGenerator;
vector<unique_ptr<OrderObserver>> observers;

public:
voidprocess(conststring& orderId, constvector<string>& items)override{
if (!validator.validate(orderId)) {
return;
        }

double totalPrice = calculator.calculate(items);

if (!fileGenerator.generate(orderId, items, totalPrice)) {
return;
        }

// 通知所有观察者
for (constauto& observer : observers) {
            observer->onOrderProcessed(orderId);
        }
    }

voidaddObserver(unique_ptr<OrderObserver> observer)override{
        observers.push_back(move(observer));
    }
};

intmain(){
vector<string> items = {"book""pen""notebook"};

// 创建普通订单处理器
auto normalProcessor = OrderProcessorFactory::createProcessor("normal");
if (normalProcessor) {
// 添加观察者
        normalProcessor->addObserver(make_unique<EmailNotificationObserver>());
        normalProcessor->addObserver(make_unique<SMSNotificationObserver>());

        normalProcessor->process("20260203001", items);
    }

return 0;
}

重构效果:通过观察者模式实现了订单处理完成后的通知机制,当新增通知方式时,只需新增对应的观察者类,无需修改订单处理器的代码,符合开闭原则,提高了代码的可扩展性。

C++ 校招 / 社招跳槽逆袭!从0到1打造高含金量项目,导师1v1辅导,助你斩获大厂offer!

很多同学准备校招时最焦虑的问题就是:“简历没项目,怎么打动面试官?”

为了解决这个痛点,我们推出了 C++项目实战训练营

在这里,你可以:

  • 系统学习 C++ 进阶知识
  • 自选项目,从 0 到 1 实战造轮子
  • 导师一对一指导,代码逐行 Review
  • 拿到能写进简历的项目成果,秋招直接加分!

我们不只是教你写代码,更带你走一遍完整的项目流程: 从需求分析、架构设计、编译调试,到版本管理、测试发布,全流程掌握!

项目配套资料齐全,遇到问题还有导师帮你答疑,不怕卡壳!

📌 想了解具体项目可以看这篇:新上线了几个好项目或直接添加vx(cppmiao24)了解详情~

项目准备好了,你只差一次出发。

相信我,这些项目绝对能够让你进步巨大!下面是其中某三个项目的说明文档

训练营适用人群:

  • 备战春招和秋招的应届生,科班非科班均可,
  • 工作 3 年以内,想跳槽的社招同学
  • 如果你有以下困扰,欢迎联系我们,我们愿意为你提供帮助和支持
  • 不知道该复习哪些内容,如何开始复习。
  • 对面试考察重点不清楚,复习效率低下。
  • 缺乏有含金量的实战项目经验。
  • 想要提升自己的实战能力,提升做项目及解决问题的能力
  • 对算法题无从下手,缺乏解题思路和常见解题模板。
  • 自控力不足,难以专注于系统复习。
  • 希望获得大厂的内推机会。
  • 独自备战校招社招感到孤单,想要找到学习伙伴。

不适合人群:

  • 缺乏耐心和毅力,急于求成的人
  • 对编程逻辑思维基础薄弱,且不愿努力提升的人
  • 只想快速获得成果而不注重基础学习的人
推荐阅读:
C++内存管理指南:从new/delete到定制分配器
对象的“移动”生涯:详解移动构造函数与移动赋值运算符
年薪百万的 C++ 量化交易系统,到底在优化什么?

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-07 18:31:28 HTTP/2.0 GET : https://f.mffb.com.cn/a/472584.html
  2. 运行时间 : 0.251943s [ 吞吐率:3.97req/s ] 内存消耗:4,540.62kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=2208ab6f84455dfefb4f27db021145a2
  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.001109s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001590s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.002742s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000675s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001448s ]
  6. SELECT * FROM `set` [ RunTime:0.000629s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001464s ]
  8. SELECT * FROM `article` WHERE `id` = 472584 LIMIT 1 [ RunTime:0.001160s ]
  9. UPDATE `article` SET `lasttime` = 1770460288 WHERE `id` = 472584 [ RunTime:0.074677s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 65 LIMIT 1 [ RunTime:0.003302s ]
  11. SELECT * FROM `article` WHERE `id` < 472584 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001243s ]
  12. SELECT * FROM `article` WHERE `id` > 472584 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001070s ]
  13. SELECT * FROM `article` WHERE `id` < 472584 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.010339s ]
  14. SELECT * FROM `article` WHERE `id` < 472584 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.004248s ]
  15. SELECT * FROM `article` WHERE `id` < 472584 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.005574s ]
0.256506s