feat : user

This commit is contained in:
2025-03-03 17:45:04 +08:00
parent d6f9f348da
commit cf6ceba60e

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace App\Service\Api\Order; namespace App\Service\Api\Order;
use App\Model\Order; use App\Model\Order;
use App\Model\OrderGood;
use App\Service\Api\BaseService; use App\Service\Api\BaseService;
use Hyperf\Di\Annotation\Inject; use Hyperf\Di\Annotation\Inject;
@@ -22,6 +23,12 @@ class OrderListService extends BaseService
#[Inject] #[Inject]
protected Order $orderModel; protected Order $orderModel;
/**
* @var OrderGood
*/
#[Inject]
protected OrderGood $orderGoodModel;
public function handle() public function handle()
{ {
$limit = $this->request->input('limit', 20); $limit = $this->request->input('limit', 20);
@@ -38,10 +45,16 @@ class OrderListService extends BaseService
if (!empty($orderList['data'])) { if (!empty($orderList['data'])) {
$this->buildData($orderList['data']); $this->buildData($orderList['data']);
} }
return $this->return->success('success', ['list' => $orderList]);
} }
private function buildData(array &$orderList) private function buildData(array &$orderList)
{ {
$orderIds = array_column($orderList, 'id');
$skuId = $this->orderGoodModel->whereIn('order_id', $orderIds)->pluck('sku_id')->toArray();
// foreach ($orderList as &$order) { // foreach ($orderList as &$order) {
// //
// } // }