
[root@d826b26981f1 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 2
- done: 1030
[root@d826b26981f1 channel-pub-api]# ./yii copy-asset-queue/run --verbose=1 --isolate=1 --color=0
2020-08-26 11:04:06 [pid: 17985] - Worker is started
2020-08-26 11:04:06 [pid: 17985] - Worker is stopped (0:00:00)
[root@d826b26981f1 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 2
- done: 1030

[root@d826b26981f1 channel-pub-api]# supervisorctl status
cronolog RUNNING pid 960, uptime 20:18:51
nginx RUNNING pid 949, uptime 20:18:51
php-fpm RUNNING pid 945, uptime 20:18:51
report_client RUNNING pid 959, uptime 20:18:51
yii-baijia-article-sync RUNNING pid 19164, uptime 0:00:00
yii-copy-asset-queue-worker:yii-copy-asset-queue-worker_00 RUNNING pid 943, uptime 20:18:51
yii-douyin-web-video-sync STARTING
yii-log-delete STARTING
yii-netease-tp-article-sync STARTING
yii-pub-article-queue-worker:yii-pub-article-queue-worker_00 RUNNING pid 940, uptime 20:18:51
yii-qq-cw-transaction-article-sync STARTING
yii-qq-cw-transaction-video-sync STARTING
yii-qq-tp-transaction-article-sync STARTING
yii-qq-tp-transaction-video-sync STARTING
yii-source-callback-queue-worker:yii-source-callback-queue-worker_00 RUNNING pid 958, uptime 20:18:51
yii-task-group-queue-worker:yii-task-group-queue-worker_00 RUNNING pid 954, uptime 20:18:51
yii-upload-asset-queue-worker:yii-upload-asset-queue-worker_00 RUNNING pid 941, uptime 20:18:51
[root@f2159c1afb23 /]# cd /mcloud/www/channel-pub-api/
[root@f2159c1afb23 channel-pub-api]# supervisorctl status
cronolog RUNNING pid 961, uptime 1:37:18
nginx RUNNING pid 949, uptime 1:37:18
php-fpm RUNNING pid 944, uptime 1:37:18
report_client RUNNING pid 959, uptime 1:37:18
yii-baijia-article-sync RUNNING pid 10238, uptime 0:00:00
yii-copy-asset-queue-worker:yii-copy-asset-queue-worker_00 RUNNING pid 943, uptime 1:37:18
yii-douyin-web-video-sync STARTING
yii-log-delete STARTING
yii-netease-tp-article-sync STARTING
yii-pub-article-queue-worker:yii-pub-article-queue-worker_00 RUNNING pid 940, uptime 1:37:18
yii-qq-cw-transaction-article-sync STARTING
yii-qq-cw-transaction-video-sync STARTING
yii-qq-tp-transaction-article-sync STARTING
yii-qq-tp-transaction-video-sync STARTING
yii-source-callback-queue-worker:yii-source-callback-queue-worker_00 RUNNING pid 957, uptime 1:37:18
yii-upload-asset-queue-worker:yii-upload-asset-queue-worker_00 RUNNING pid 941, uptime 1:37:18
[root@f2159c1afb23 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 2
- done: 1030
[root@f2159c1afb23 channel-pub-api]# ./yii copy-asset-queue/run --verbose=1 --isolate=1 --color=0
2020-08-26 13:04:47 [pid: 10271] - Worker is started
2020-08-26 13:04:47 [pid: 10271] - Worker is stopped (0:00:00)
[root@f2159c1afb23 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 2
- done: 1030
// 还原前:
Yii::$app->copyAssetQueue->push(new CopyAssetJob(['taskId' => $data['task_id']]));
// 还原后:
Yii::$app->copyAssetQueue->push(new CopyAssetJob([
'taskId' => $data['task_id'],
]));
// 还原前:
if (count($notAbsoluteUrlStartKeys) > 0) {
$notAbsoluteUrlStartKeys = implode(",", $notAbsoluteUrlStartKeys);
throw new UnprocessableEntityHttpException(Yii::t('error', Yii::t('error', Yii::t('error', '202003'), ['not_absolute_url_start_keys' => $notAbsoluteUrlStartKeys])), 202003);
}
if (count($notExistsKeys) > 0) {
$notExistsKeys = implode(",", $notExistsKeys);
throw new NotFoundHttpException(Yii::t('error', Yii::t('error', Yii::t('error', '202004'), ['not_exists_keys' => $notExistsKeys])), 202004);
}
// 还原后:
if (!empty($notAbsoluteUrlStartKeys)) {
$notAbsoluteUrlStartKeys = implode(",", $notAbsoluteUrlStartKeys);
throw new UnprocessableEntityHttpException(Yii::t('error', Yii::t('error', Yii::t('error', '202003'), ['not_absolute_url_start_keys' => $notAbsoluteUrlStartKeys])), 202003);
}
if (!empty($notExistsKeys)) {
$notExistsKeys = implode(",", $notExistsKeys);
throw new NotFoundHttpException(Yii::t('error', Yii::t('error', Yii::t('error', '202004'), ['not_exists_keys' => $notExistsKeys])), 202004);
}

[root@04302a060834 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1032
[root@04302a060834 channel-pub-api]# cat /data/logs/yii-copy-asset-queue-worker-stdout.log
2020-08-26 13:24:04 [pid: 943] - Worker is started
2020-08-26 13:31:48 [1029] common\jobs\CopyAssetJob (attempt: 140, pid: 943) - Started
2020-08-26 13:31:49 [1029] common\jobs\CopyAssetJob (attempt: 140, pid: 943) - Done (0.228 s)
2020-08-26 13:33:47 [1031] common\jobs\CopyAssetJob (attempt: 136, pid: 943) - Started
2020-08-26 13:33:48 [1031] common\jobs\CopyAssetJob (attempt: 136, pid: 943) - Done (0.478 s)

[root@04302a060834 /]# cd /mcloud/www/channel-pub-api/
[root@04302a060834 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1032
[root@04302a060834 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 489
[root@04302a060834 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 1
- done: 1262
[root@04302a060834 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1903
[root@04302a060834 channel-pub-api]# cat /data/logs/yii-pub-article-queue-worker-stdout.log
2020-08-26 13:24:04 [pid: 940] - Worker is started
2020-08-26 13:32:06 [1263] common\jobs\PubArticleJob (attempt: 1, pid: 940) - Started
2020-08-26 13:32:08 [1263] common\jobs\PubArticleJob (attempt: 1, pid: 940) - Done (2.411 s)

'copyAssetQueue' => [ // 复制资源文件队列
'class' => 'yii\queue\redis\Queue',
'redis' => 'redis', // Redis 连接组件或它的配置
'channel' => 'cpa:queue:copy:asset', // 队列键前缀
'ttr' => 10 * 60, // 作业处理的最长时间,单位(秒)
'attempts' => 1, // 作业处理的最大尝试次数
'on afterExec' => ['common\components\queue\CopyAssetEventHandler', 'afterExec'], // 每次成功执行作业后
'on afterError' => ['common\components\queue\CopyAssetEventHandler', 'afterError'], // 在作业执行期间发生未捕获的异常时
'as log' => 'yii\queue\LogBehavior',
],
'uploadAssetQueue' => [ // 上传资源文件队列
'class' => 'yii\queue\redis\Queue',
'redis' => 'redis', // Redis 连接组件或它的配置
'channel' => 'cpa:queue:upload:asset', // 队列键前缀
'ttr' => 2 * 60 * 60, // 作业处理的最长时间,单位(秒)
'attempts' => 1, // 作业处理的最大尝试次数
'on afterExec' => ['common\components\queue\UploadAssetEventHandler', 'afterExec'], // 每次成功执行作业后
'on afterError' => ['common\components\queue\UploadAssetEventHandler', 'afterError'], // 在作业执行期间发生未捕获的异常时
'as log' => 'yii\queue\LogBehavior',
],
'pubArticleQueue' => [ // 发布文章队列
'class' => 'yii\queue\redis\Queue',
'redis' => 'redis', // Redis 连接组件或它的配置
'channel' => 'cpa:queue:pub:article', // 队列键前缀
'ttr' => 5 * 60, // 作业处理的最长时间,单位(秒)
'attempts' => 1, // 作业处理的最大尝试次数
'on afterExec' => ['common\components\queue\PubArticleEventHandler', 'afterExec'], // 每次成功执行作业后
'on afterError' => ['common\components\queue\PubArticleEventHandler', 'afterError'], // 在作业执行期间发生未捕获的异常时
'as log' => 'yii\queue\LogBehavior',
],
'sourceCallbackQueue' => [ // 来源回调队列
'class' => 'yii\queue\redis\Queue',
'redis' => 'redis', // Redis 连接组件或它的配置
'channel' => 'cpa:queue:source:callback', // 队列键前缀
'ttr' => 5 * 60, // 作业处理的最长时间,单位(秒)
'attempts' => 1, // 作业处理的最大尝试次数
'on afterExec' => ['common\components\queue\SourceCallbackEventHandler', 'afterExec'], // 每次成功执行作业后
'on afterError' => ['common\components\queue\SourceCallbackEventHandler', 'afterError'], // 在作业执行期间发生未捕获的异常时
'as log' => 'yii\queue\LogBehavior',
],
[root@04302a060834 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1032
[root@04302a060834 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 489
[root@04302a060834 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1264
[root@04302a060834 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 2
- done: 1903
[root@04302a060834 channel-pub-api]# cat /data/logs/yii-pub-article-queue-worker-stdout.log
2020-08-26 13:24:04 [pid: 940] - Worker is started
2020-08-26 13:32:06 [1263] common\jobs\PubArticleJob (attempt: 1, pid: 940) - Started
2020-08-26 13:32:08 [1263] common\jobs\PubArticleJob (attempt: 1, pid: 940) - Done (2.411 s)
2020-08-26 14:21:49 [pid: 941] - Worker is started
2020-08-26 15:11:49 [1262] common\jobs\PubArticleJob (attempt: 27, pid: 941) - Started
2020-08-26 15:11:52 [1262] common\jobs\PubArticleJob (attempt: 27, pid: 941) - Done (2.534 s)
2020-08-26 15:29:52 [1264] common\jobs\PubArticleJob (attempt: 1, pid: 941) - Started
2020-08-26 15:30:02 [1264] common\jobs\PubArticleJob (attempt: 1, pid: 941) - Error (10.575 s)
> yii\web\UnprocessableEntityHttpException: 图片文件超过1M限制

[root@6937bb8570bd channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1057
[root@6937bb8570bd channel-pub-api]# cat /data/logs/yii-copy-asset-queue-worker-stdout.log
2020-09-24 16:07:49 [pid: 943] - Worker is started
[root@6937bb8570bd channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 514
[root@6937bb8570bd channel-pub-api]# cat /data/logs/yii-upload-asset-queue-worker-stdout.log
2020-09-24 16:07:49 [pid: 941] - Worker is started
[root@6937bb8570bd channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1315
[root@6937bb8570bd channel-pub-api]# cat /data/logs/yii-pub-article-queue-worker-stdout.log
2020-09-24 16:07:49 [pid: 940] - Worker is started
2020-09-24 16:12:33 [1315] common\jobs\PubArticleJob (attempt: 17, pid: 940) - Started
2020-09-24 16:12:38 [1315] common\jobs\PubArticleJob (attempt: 17, pid: 940) - Done (4.206 s)
[root@6937bb8570bd channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 1
- done: 2019
[root@6937bb8570bd channel-pub-api]# cat /data/logs/yii-source-callback-queue-worker-stdout.log
2020-09-24 16:07:49 [pid: 957] - Worker is started
2020-09-24 16:18:15 [2020] common\jobs\SourceCallbackJob (attempt: 1, pid: 957) - Started
2020-09-24 16:18:15 [2020] common\jobs\SourceCallbackJob (attempt: 1, pid: 957) - Done (0.383 s)
[root@6937bb8570bd channel-pub-api]#
[program:yii-copy-asset-queue-worker]
process_name = %(program_name)s_%(process_num)02d
command = php /mcloud/www/channel-pub-api/yii copy-asset-queue/listen --verbose=1 --color=0
autostart = true
autorestart = true
startsecs = 0
stopwaitsecs = 10
numprocs = 2
redirect_stderr = true
stderr_logfile = /data/logs/yii-copy-asset-queue-worker-stderr.log
stdout_logfile = /data/logs/yii-copy-asset-queue-worker-stdout.log

2020/09/29 13:26
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 1
- done: 1070
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 516
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1356
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2060
[root@e560a4697114 channel-pub-api]#
2020/09/29 13:35
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1071
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 517
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1356
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2060
[root@e560a4697114 channel-pub-api]#
2020/09/29 13:38
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1071
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 517
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 1
- done: 1356
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2060
[root@e560a4697114 channel-pub-api]#
2020/09/29 13:42
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1071
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 517
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1357
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2060
[root@e560a4697114 channel-pub-api]#
2020/09/29 13:50
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1071
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 517
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1358
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2062
[root@e560a4697114 channel-pub-api]#
2020/09/30 15:38
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1076
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 520
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1362
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2066
[root@e560a4697114 channel-pub-api]#
2020/09/30 15:42
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1078
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 521
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1362
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2066
[root@e560a4697114 channel-pub-api]#
2020/09/30 15:43
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1078
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 521
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 1
- done: 1362
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2066
[root@e560a4697114 channel-pub-api]#
2020/09/30 15:48
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1078
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 521
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1363
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2068
[root@e560a4697114 channel-pub-api]#
2020/09/30 16:00
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 1
- done: 1079
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 521
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1363
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2068
[root@e560a4697114 channel-pub-api]#
2020/09/30 16:46
[root@e560a4697114 channel-pub-api]# ./yii copy-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1080
[root@e560a4697114 channel-pub-api]# ./yii upload-asset-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 522
[root@e560a4697114 channel-pub-api]# ./yii pub-article-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 1365
[root@e560a4697114 channel-pub-api]# ./yii source-callback-queue/info --color=0
Jobs
- waiting: 0
- delayed: 0
- reserved: 0
- done: 2069
PHP / Laravel / Yii2 老项目维护与长期技术支持
如果你的 PHP / Laravel / Yii2 项目已经上线,但遇到原开发离职、Bug 长期无人修复、接口不稳定、性能下降、代码难以接手等问题,可以联系我做一次远程技术排查。
适合以下情况:
✅ 老旧 PHP 系统无人维护
✅ Laravel / Yii2 项目 Bug 修复
✅ 后台管理系统小功能迭代
✅ RESTful API 接口排查
✅ MySQL / Redis / Nginx 性能问题
✅ 长期远程兼职维护
可先从一次小问题开始:
✅ 线上报错排查
✅ 接口异常分析
✅ 慢查询与性能瓶颈定位
✅ 代码结构初步评估
✅ 部署环境与日志检查
如需咨询,请联系我,并注明:PHP 维护咨询。
联系方式:
Telegram:@shuijingwan
微信:13980074657
邮箱:shuijingwanwq@gmail.com

发表回复