feat : order info

This commit is contained in:
2025-03-24 10:06:29 +08:00
parent 9860f3eab8
commit 3c91ac4077
4 changed files with 21 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Amqp\Consumer\Statement; namespace App\Amqp\Consumer\Statement;
use Hyperf\Amqp\Message\Type;
use Hyperf\Amqp\Result; use Hyperf\Amqp\Result;
use Hyperf\Amqp\Annotation\Consumer; use Hyperf\Amqp\Annotation\Consumer;
use Hyperf\Amqp\Message\ConsumerMessage; use Hyperf\Amqp\Message\ConsumerMessage;
@@ -12,6 +13,11 @@ use PhpAmqpLib\Message\AMQPMessage;
#[Consumer(exchange: 'hyperf', routingKey: 'hyperf', queue: 'hyperf', name: "ChefConsumer", nums: 1)] #[Consumer(exchange: 'hyperf', routingKey: 'hyperf', queue: 'hyperf', name: "ChefConsumer", nums: 1)]
class ChefConsumer extends ConsumerMessage class ChefConsumer extends ConsumerMessage
{ {
/**
* @var Type|string 消息类型
*/
protected Type|string $type = Type::DIRECT;
public function consumeMessage($data, AMQPMessage $message): Result public function consumeMessage($data, AMQPMessage $message): Result
{ {
return Result::ACK; return Result::ACK;

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Amqp\Consumer\Statement; namespace App\Amqp\Consumer\Statement;
use Hyperf\Amqp\Message\Type;
use Hyperf\Amqp\Result; use Hyperf\Amqp\Result;
use Hyperf\Amqp\Annotation\Consumer; use Hyperf\Amqp\Annotation\Consumer;
use Hyperf\Amqp\Message\ConsumerMessage; use Hyperf\Amqp\Message\ConsumerMessage;
@@ -12,6 +13,11 @@ use PhpAmqpLib\Message\AMQPMessage;
#[Consumer(exchange: 'hyperf', routingKey: 'hyperf', queue: 'hyperf', name: "DriverConsumer", nums: 1)] #[Consumer(exchange: 'hyperf', routingKey: 'hyperf', queue: 'hyperf', name: "DriverConsumer", nums: 1)]
class DriverConsumer extends ConsumerMessage class DriverConsumer extends ConsumerMessage
{ {
/**
* @var Type|string 消息类型
*/
protected Type|string $type = Type::DIRECT;
public function consumeMessage($data, AMQPMessage $message): Result public function consumeMessage($data, AMQPMessage $message): Result
{ {
return Result::ACK; return Result::ACK;

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Amqp\Consumer\Statement; namespace App\Amqp\Consumer\Statement;
use Hyperf\Amqp\Message\Type;
use Hyperf\Amqp\Result; use Hyperf\Amqp\Result;
use Hyperf\Amqp\Annotation\Consumer; use Hyperf\Amqp\Annotation\Consumer;
use Hyperf\Amqp\Message\ConsumerMessage; use Hyperf\Amqp\Message\ConsumerMessage;
@@ -12,6 +13,11 @@ use PhpAmqpLib\Message\AMQPMessage;
#[Consumer(exchange: 'hyperf', routingKey: 'hyperf', queue: 'hyperf', name: "SiteConsumer", nums: 1)] #[Consumer(exchange: 'hyperf', routingKey: 'hyperf', queue: 'hyperf', name: "SiteConsumer", nums: 1)]
class SiteConsumer extends ConsumerMessage class SiteConsumer extends ConsumerMessage
{ {
/**
* @var Type|string 消息类型
*/
protected Type|string $type = Type::DIRECT;
public function consumeMessage($data, AMQPMessage $message): Result public function consumeMessage($data, AMQPMessage $message): Result
{ {
return Result::ACK; return Result::ACK;

View File

@@ -135,8 +135,8 @@ class OrderInfoService extends BaseService
$skuInfo = $skuList[$item['sku_id']] ?? []; $skuInfo = $skuList[$item['sku_id']] ?? [];
$imageId = !empty($skuInfo) && !empty(explode(',',$skuInfo['image_ids'])[0]) ? explode(',',$skuInfo['image_ids'])[0] : []; $imageId = !empty($skuInfo) && !empty(explode(',',$skuInfo['image_ids'])[0]) ? explode(',',$skuInfo['image_ids'])[0] : [];
$skuInfo['url'] = $imageList[$imageId]['url'] ?? ''; // $skuInfo['url'] = $imageList[$imageId]['url'] ?? '';
$oneCopiesInfo['image_list'][] = $imageList[$imageId] ?? []; // $oneCopiesInfo['image_list'][] = $imageList[$imageId] ?? [];
$oneCopiesInfo['sku_list'][] = [ $oneCopiesInfo['sku_list'][] = [
'url' => $imageList[$imageId]['url'] ?? '', 'url' => $imageList[$imageId]['url'] ?? '',
@@ -144,7 +144,7 @@ class OrderInfoService extends BaseService
'unit_price' => $item['unit_price'], 'unit_price' => $item['unit_price'],
'quantity' => $item['quantity'], 'quantity' => $item['quantity'],
'price' => bcmul((string)$item['unit_price'], (string)$item['quantity'], 2), 'price' => bcmul((string)$item['unit_price'], (string)$item['quantity'], 2),
'chef_name' => $chefList[$spuList[$skuList[$item['sku_id']['spu_id']]['chef_id']]]['chinese_name'] ?? '', 'chef_name' => $chefList[$spuList[$skuList[$item['sku_id']]['spu_id']]['chef_id']]['chinese_name'] ?? '',
]; ];
$oneCopiesInfo['total_price'] = bcadd((string)$oneCopiesInfo['total_price'], bcmul((string)$item['unit_price'],(string)$item['quantity'],2), 2); $oneCopiesInfo['total_price'] = bcadd((string)$oneCopiesInfo['total_price'], bcmul((string)$item['unit_price'],(string)$item['quantity'],2), 2);
$oneCopiesInfo['total_quantity'] += $item['quantity']; $oneCopiesInfo['total_quantity'] += $item['quantity'];