文件
yjyf/server/application/admin/command/OrderAutoclose.php
MiAn 14533eadb7 feat: 用户端与师傅端双小程序架构解耦,新增师傅独立认证及超时自动关单机制
1. 账号体系与数据库解耦:
   - 师傅表 fa_master 解除对 fa_user.id 的外键依赖,升级为独立认证账号主表;
   - 新增师傅端独立支撑表:fa_master_security、fa_master_token、fa_master_wechat、fa_master_agreement_read;
   - 新增工单超时未接单自动关闭与原路退款配置(order_unaccepted_close_days)。

2. 服务端(Server):
   - 新增师傅端独立 API 控制器与认证库(MasterAuth, MasterBase, MasterMessage, MasterSecurity, MasterToken);
   - WxLogin 支持双小程序端(user/master)独立换取 session_key、openid 与 access_token;
   - 新增控制台调度命令 php think order:autoclose,支持订单超时自动关闭与售后退款闭环;
   - 修复 PHP 8.5 兼容性问题(Request.php 的 (bool) 强制转换);
   - 系统业务配置全面收敛至数据库 fa_config 及 site.php。

3. 小程序端:
   - yjyf-app(用户端):彻底剥离师傅端路由、组件及静态资源,增加隐私授权弹窗与评价模块;
   - yjyf-master-app(师傅端):全新独立微信小程序工程(wx140d90ceda786107),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
2026-11-23 15:10:30 +08:00

41 行
1.5 KiB
PHP

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<?php
namespace app\admin\command;
use app\common\library\OrderAutoCloseService;
use think\console\Command;
use think\console\Input;
use think\console\Output;
/**
* 超时未接单订单自动关闭、原路退款及消息提醒守护任务
* 运行方式:php think order:autoclose
*/
class OrderAutoclose extends Command
{
protected function configure()
{
$this->setName('order:autoclose')
->setDescription('自动关闭下单超过后台配置天数仍无师傅接单的订单并退款提醒');
}
protected function execute(Input $input, Output $output)
{
$res = OrderAutoCloseService::closeExpiredOrders(100);
if ($res['days'] <= 0) {
$output->writeln('[OrderAutoclose] 后台配置超时自动关闭天数为 0,功能已关闭');
return;
}
$output->writeln("[OrderAutoclose] 配置天数={$res['days']}天,扫描到 {$res['scanned']} 笔超时未接单订单");
foreach ($res['details'] as $item) {
if ($item['status'] === 'closed') {
$output->writeln(" [OK] 订单 #{$item['order_id']} ({$item['order_no']}) 已自动关闭,退款状态={$item['refund_state']}");
} elseif ($item['status'] === 'error') {
$output->writeln(" [FAIL] 订单 #{$item['order_id']} 处理失败: {$item['error']}");
}
}
$output->writeln("[OrderAutoclose] 执行结束:关闭 {$res['closed']} 笔,退款成功 {$res['refunded']} 笔,退款待重试 {$res['refund_failed']} 笔");
}
}