在redis隊列中處理業(yè)務(wù) 不一定是redis隊列問題 這個報錯像是mysql數(shù)據(jù)庫出現(xiàn)的問題
隊列中的業(yè)務(wù) 也不復(fù)雜 查詢aippt生成狀態(tài)
$info = AiPptXfyun::where('id', $data['id'])->first();
try {
if ($info && in_array($info->morphAippt->status, [1, 2])) {
$aiPpt = new AiPpt();
$apiRes = $aiPpt->setSid($info['sid'])->progress();
if (isset($apiRes['flag']) && $apiRes['flag']) {
$info->pptStatus = $apiRes['data']['pptStatus'];
$info->aiImageStatus = $apiRes['data']['aiImageStatus'];
$info->cardNoteStatus = $apiRes['data']['cardNoteStatus'];
$info->pptUrl = $apiRes['data']['pptUrl'];
if ($apiRes['data']['totalPages']) $info->totalPages = $apiRes['data']['totalPages'];
if ($apiRes['data']['donePages']) $info->donePages = $apiRes['data']['donePages'];
$info->save();
if ($apiRes['data']['aiImageStatus'] === 'done' && $apiRes['data']['cardNoteStatus'] === 'done'
&& $apiRes['data']['pptStatus'] === 'done') {
if ($apiRes['data']['totalPages']) $info->morphAippt->total_pages = $apiRes['data']['totalPages'];
if ($apiRes['data']['donePages']) $info->morphAippt->done_pages = $apiRes['data']['donePages'];
$info->morphAippt->status = 3;
$info->morphAippt->ppt_url = $apiRes['data']['pptUrl'];
$info->morphAippt->save();
} else {
$info->morphAippt->status = 2;
if ($apiRes['data']['totalPages']) $info->morphAippt->total_pages = $apiRes['data']['totalPages'];
if ($apiRes['data']['donePages']) $info->morphAippt->done_pages = $apiRes['data']['donePages'];
$info->morphAippt->save();
Redis::send('ApiAiPptBuildStatus', $data, 4);
}
} else {
throw new BusinessException($apiRes['desc'] ?? '未知錯誤[open-queue-Xfyun]');
}
}
} catch (\Throwable $e) {
$info->errMsg = $e->getMessage();
$info->save();
$info->morphAippt->status = -1;
$info->morphAippt->err_msg = $e->getMessage();
$info->morphAippt->save();
Log::error('[aippt]隊列狀態(tài)查詢失敗', [
'__METHOD__' => __METHOD__,
'data' => $data,
'error_msg' => $e->getMessage(),
]);
try {
/** @var BillingContext $BillingContext */
$BillingContext = new BillingContext(new UserIdentity($data['uid']), new AiPptProduce($data['produce_price_key']));
$BillingContext->refundFee(abs($data['calculate_log_point']), $data['calculate_log_id']);
} catch (\Throwable $e) {
Log::error('[apppt]隊列退款失敗', [
'__METHOD__' => __METHOD__,
'data' => $data,
'error_msg' => $e->getMessage(),
]);
}
}
default.ERROR: [ApiAiPptBuildStatus]Call to a member function getBitwiseOperators() on null
aliyuncs/oss-sdk-php v2.7.2 Aliyun OSS SDK for PHP
brick/math 0.12.3 Arbitrary-precision arithmetic library
carbonphp/carbon-doctrine-types 2.1.0 Types to use Carbon in Doctrine
doctrine/inflector 2.0.10 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
guzzlehttp/guzzle 7.9.2 Guzzle is a PHP HTTP client library
guzzlehttp/promises 2.0.4 Guzzle promises library
guzzlehttp/psr7 2.7.0 PSR-7 message implementation that also provides common utility methods
illuminate/bus v10.48.28 The Illuminate Bus package.
illuminate/collections v10.48.28 The Illuminate Collections package.
illuminate/conditionable v10.48.28 The Illuminate Conditionable package.
illuminate/container v10.48.28 The Illuminate Container package.
illuminate/contracts v10.48.28 The Illuminate Contracts package.
illuminate/database v10.48.28 The Illuminate Database package.
illuminate/events v10.48.28 The Illuminate Events package.
illuminate/macroable v10.48.28 The Illuminate Macroable package.
illuminate/pagination v10.48.28 The Illuminate Pagination package.
illuminate/pipeline v10.48.28 The Illuminate Pipeline package.
illuminate/redis v10.48.28 The Illuminate Redis package.
illuminate/support v10.48.28 The Illuminate Support package.
intervention/image 2.7.2 Image handling and manipulation library with support for Laravel integration
laravel/serializable-closure v1.3.7 Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.
monolog/monolog 2.10.0 Sends your logs to files, sockets, inboxes, databases and various web services
nesbot/carbon 2.73.0 An API extension for DateTime that supports 281 different languages.
nikic/fast-route v1.3.0 Fast request router for PHP
psr/clock 1.0.0 Common interface for reading the clock.
psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11)
psr/http-client 1.0.3 Common interface for HTTP clients
psr/http-factory 1.1.0 PSR-17: Common interfaces for PSR-7 HTTP message factories
psr/http-message 2.0 Common interface for HTTP messages
psr/log 3.0.2 Common interface for logging libraries
psr/simple-cache 3.0.0 Common interfaces for simple caching
ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
swoole/ide-helper 5.0.3 IDE help files for Swoole.
symfony/deprecation-contracts v3.5.1 A generic function and convention to trigger deprecation notices
symfony/polyfill-mbstring v1.31.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php80 v1.31.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/translation v6.4.19 Provides tools to internationalize your application
symfony/translation-contracts v3.5.1 Generic abstractions related to translation
topthink/think-container v3.0.1 PHP Container & Facade Manager
topthink/think-helper v3.1.10 The ThinkPHP6 Helper Package
topthink/think-validate v3.0.3 think validate
voku/portable-ascii 2.0.3 Portable ASCII library - performance optimized (ascii) string functions for php.
webman/admin v2.1.2 Webman Admin
webman/captcha v1.0.5 Captcha generator
webman/database v2.1.5 Webman database
webman/event v1.0.5 Webman event plugin
webman/log v2.1.2 Webman plugin webman/log
webman/redis v2.1.1 Webman redis
webman/redis-queue v2.1.0 Redis message queue plugin for webman.
workerman/coroutine v1.1.3 Workerman coroutine
workerman/redis v2.0.3
workerman/redis-queue v1.2.1 Message queue system written in PHP based on workerman and backed by Redis.
workerman/webman-framework v2.1.2 High performance HTTP Service Framework.
workerman/workerman v5.1.0 An asynchronous event driven PHP framework for easily building fast, scalable network applications.