feat : user

This commit is contained in:
2025-03-03 16:21:38 +08:00
parent e92a1cd8c0
commit d6f9f348da
12 changed files with 361 additions and 12 deletions

View File

@@ -0,0 +1,49 @@
<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Api\Order;
use App\Model\Order;
use App\Service\Api\BaseService;
use Hyperf\Di\Annotation\Inject;
class OrderListService extends BaseService
{
/**
* @var Order
*/
#[Inject]
protected Order $orderModel;
public function handle()
{
$limit = $this->request->input('limit', 20);
$orderList = $this->orderModel
->where('user_id', $this->userId)
->when($this->request->input('status'), function ($query) {
$query->where('status', $this->request->input('status'));
})
->orderByDesc('id')
->paginate($limit)
->toArray();
if (!empty($orderList['data'])) {
$this->buildData($orderList['data']);
}
}
private function buildData(array &$orderList)
{
// foreach ($orderList as &$order) {
//
// }
}
}