Initial commit: 小众厨房项目代码

Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
可乐加冰
2026-09-23 17:04:10 +08:00
当前提交 f7d3d7d1bd
共有 1761 个文件被更改,包括 453668 次插入 和 0 次删除

查看文件

@@ -0,0 +1,49 @@
<?php
namespace app\admin\command;
use think\Db;
use think\console\Command;
use think\console\Input;
use think\console\input\Option;
use think\console\Output;
class ShoproPrintRetry extends Command
{
protected function configure()
{
$this->setName('shopro:print-retry')
->addOption('order-id', null, Option::VALUE_REQUIRED, 'failed print task order id')
->addOption('all', null, Option::VALUE_NONE, 'retry all failed print tasks')
->setDescription('Requeue failed Shopro receipt print tasks');
}
protected function execute(Input $input, Output $output)
{
$orderId = (int)$input->getOption('order-id');
$all = (bool)$input->getOption('all');
if (!$orderId && !$all) {
$output->error('Use --order-id=<id> or --all.');
return 1;
}
$staleBefore = time() - 300;
$query = Db::name('shopro_order_print_task')
->whereRaw('(status = -1 OR (status = 2 AND updated_at < ' . $staleBefore . '))');
if ($orderId) {
$query->where('order_id', $orderId);
}
$tasks = $query->select();
foreach ($tasks as $task) {
Db::name('shopro_order_print_task')->where('id', $task['id'])->update([
'status' => 0,
'updated_at' => time(),
'last_error' => '',
]);
\think\Queue::push('\\addons\\shopro\\job\\OrderPrint@handle', ['order_id' => $task['order_id']], 'shopro-high');
}
$output->info('Requeued ' . count($tasks) . ' receipt print task(s).');
return 0;
}
}

查看文件

@@ -0,0 +1,21 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return [
'app\admin\command\Crud',
'app\admin\command\Menu',
'app\admin\command\Install',
'app\admin\command\Min',
'app\admin\command\Addon',
'app\admin\command\Api',
'app\admin\command\ShoproPrintRetry',
];