feat : rank
This commit is contained in:
@@ -15,9 +15,11 @@ use App\Constants\Common\GoodCode;
|
||||
use App\Constants\Common\OrderCode;
|
||||
use App\Model\Order;
|
||||
use App\Model\OrderGood;
|
||||
use App\Model\PickupCode;
|
||||
use App\Model\Sku;
|
||||
use App\Service\Api\BaseService;
|
||||
use App\Service\ServiceTrait\Common\OssTrait;
|
||||
use App\Service\ServiceTrait\Common\PickupCodeTrait;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@@ -26,13 +28,14 @@ class OrderListService extends BaseService
|
||||
{
|
||||
|
||||
use OssTrait;
|
||||
use PickupCodeTrait;
|
||||
|
||||
/**
|
||||
* @var int 当前订单/历史订单
|
||||
*/
|
||||
CONST CURRENT_ORDER = 1;
|
||||
CONST int CURRENT_ORDER = 1;
|
||||
|
||||
CONST HISTORY_ORDER = 2;
|
||||
CONST int HISTORY_ORDER = 2;
|
||||
|
||||
/**
|
||||
* @var Order
|
||||
@@ -102,6 +105,13 @@ class OrderListService extends BaseService
|
||||
return $this->return->success('success', ['list' => $orderList]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @var PickupCode
|
||||
*/
|
||||
#[Inject]
|
||||
protected PickupCode $pickupCodeModel;
|
||||
|
||||
|
||||
/**
|
||||
* 构建订单列表数据
|
||||
* @param array $orderList
|
||||
@@ -139,6 +149,13 @@ class OrderListService extends BaseService
|
||||
$imageIds = array_unique(explode(',',implode(',',$imageIdArr)));
|
||||
$imageList = $this->getOssObjects($imageIds);
|
||||
|
||||
$pickupCodeList = $this->pickupCodeModel
|
||||
->whereIn('order_id',$orderIds)
|
||||
->get(['pickup_code', 'order_id', 'copies', 'heapsort', 'id'])
|
||||
->toArray();
|
||||
|
||||
$pickupCodeArrList = $this->buildPickupCodeListData($pickupCodeList);
|
||||
|
||||
foreach ($orderList as &$order) {
|
||||
$orderCopiesList = [];
|
||||
$addStapleFood = [];
|
||||
@@ -146,7 +163,7 @@ class OrderListService extends BaseService
|
||||
$addStapleFood = [
|
||||
'total_price' => '0.00',
|
||||
'total_quantity' => 0,
|
||||
'take_food_code' => '', //这个没有取餐码
|
||||
'pickup_code' => '', //这个没有取餐码
|
||||
'image_list' => [],
|
||||
'is_add_staple_food' => GoodCode::IS_ADD_STAPLE_FOOD,
|
||||
];
|
||||
@@ -158,7 +175,7 @@ class OrderListService extends BaseService
|
||||
'total_price' => '0.00',
|
||||
'total_quantity' => 0,
|
||||
'image_list' => [],
|
||||
'take_food_code' => '', //todo 取餐码
|
||||
'pickup_code' => $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? '', // 取餐码
|
||||
'is_add_staple_food' => GoodCode::IS_NOT_ADD_STAPLE_FOOD,
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user