Compare commits

...

8 Commits

Author SHA1 Message Date
44a500df9f fix : date 2025-08-06 17:24:43 +08:00
1a962ecb39 fix : date 2025-08-06 17:22:10 +08:00
24a911d63a fix : user default address 2025-08-06 17:18:36 +08:00
a6bdfa3e4c fix : order pick code box num 2025-08-06 17:10:28 +08:00
5cc59bb505 fix : stat 2025-08-06 16:02:42 +08:00
a3a079edd4 fix : stat 2025-08-06 16:00:58 +08:00
26f58eee32 fix : stat 2025-08-06 15:59:02 +08:00
00aa36c574 fix : stat 2025-08-06 15:38:48 +08:00
5 changed files with 47 additions and 8 deletions

View File

@@ -91,6 +91,6 @@ class UserSite extends Model
*/
public function getUserDefaultInfoByUserId(int $userId)
{
return $this->where('user_id', $userId)->where('is_default',SiteCode::USER_NO_DEFAULT)->first();
return $this->where('user_id', $userId)->where('is_default',SiteCode::USER_DEFAULT)->first();
}
}

View File

@@ -87,11 +87,17 @@ class ChefService extends BaseService
$skuIds = array_column($list['data'], 'sku_id');
$chefIds = array_column($list['data'], 'chef_id');
$skuList = $this->skuModel->whereIn('id', $skuIds)->pluck('title', 'id')->toArray();
$chefList = $this->adminUserModel->whereIn('id',$chefIds)->pluck('chinese_name','id')->toArray();
$skuList = $this->skuModel->whereIn('id', $skuIds)->select('price','title','id')->get();
if ($skuList->isNotEmpty()) {
$skuList = array_column($skuList->toArray(), null,'id');
}
$chefList = $this->adminUserModel->getChefNameByIds($chefIds);
foreach ($list['data'] as &$v) {
$v['sku_title'] = $skuList[$v['sku_id']] ?? '';
$v['chef_name'] = $chefList[$v['chef_id']] ?? '';
$v['sku_title'] = $skuList[$v['sku_id']]['title'] ?? '';
$v['sku_price'] = $skuList[$v['sku_id']]['price'] ?? '0.00';
$v['total_price'] = bcmul($skuList[$v['sku_id']]['price'],(string)$v['sale'],2);
$v['chef_name'] = $chefList[$v['chef_id']]['chinese_name'] ?? '';
}
return $this->return->success('success', ['list' => $list]);

View File

@@ -47,7 +47,7 @@ class FinancesService extends BaseService
->when($searchKitchenId, function ($query) use ($searchKitchenId) {
$query->where('kitchen_id', $searchKitchenId);
})
->groupBy('cycle_id')
->groupBy('cycle_id','date')
->orderByDesc('cycle_id')
->select(
'date',

View File

@@ -11,8 +11,10 @@ declare(strict_types=1);
namespace App\Service\Api\Order;
use App\Cache\Redis\Api\SiteCache;
use App\Cache\Redis\Common\ConfigCache;
use App\Constants\Common\GoodCode;
use App\Constants\Common\OrderCode;
use App\Constants\ConfigCode;
use App\Exception\ErrException;
use App\Model\AdminUser;
use App\Model\Chef;
@@ -69,6 +71,12 @@ class OrderInfoService extends BaseService
#[Inject]
protected SiteCache $siteCache;
/**
* @var ConfigCache
*/
#[Inject]
protected ConfigCache $configCache;
/**
* @return array
* @throws ContainerExceptionInterface
@@ -147,11 +155,20 @@ class OrderInfoService extends BaseService
}
for ($i = 1; $i <= (count($newOrderSkuList) ?? 0); $i++) {
$pickupCodeOneCopies = $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? null;
$boxNum = 0;
if (!empty($pickupCodeOneCopies)) {
$pickupCodeOneCopiesArr = explode('-', $pickupCodeOneCopies);
$boxNum = ceil(end($pickupCodeOneCopiesArr) ?? 0 / (int)$this->configCache->getConfigValueByKey(ConfigCode::MAXIMUM_VALUE_IN_FULL_BOX));
}
$oneCopiesInfo = [
'total_price' => '0.00',
'total_quantity' => 0,
'sku_list' => [],
'pickup_code' => $pickupCodeList[$i] ?? '', //取餐码
'pickup_code' => $pickupCodeOneCopies ?? '', // 取餐码
'box_num' => $boxNum,
'is_add_staple_food' => GoodCode::IS_NOT_ADD_STAPLE_FOOD,
];

View File

@@ -11,8 +11,10 @@ declare(strict_types=1);
namespace App\Service\Api\Order;
use App\Cache\Redis\Api\SiteCache;
use App\Cache\Redis\Common\ConfigCache;
use App\Constants\Common\GoodCode;
use App\Constants\Common\OrderCode;
use App\Constants\ConfigCode;
use App\Model\Order;
use App\Model\OrderGood;
use App\Model\PickupCode;
@@ -61,6 +63,12 @@ class OrderListService extends BaseService
#[Inject]
protected SiteCache $siteCache;
/**
* @var ConfigCache
*/
#[Inject]
protected ConfigCache $configCache;
/**
* @return array
* @throws ContainerExceptionInterface
@@ -164,6 +172,7 @@ class OrderListService extends BaseService
'total_price' => '0.00',
'total_quantity' => 0,
'pickup_code' => '', //这个没有取餐码
'box_num' => 0,
'image_list' => [],
'is_add_staple_food' => GoodCode::IS_ADD_STAPLE_FOOD,
];
@@ -171,11 +180,18 @@ class OrderListService extends BaseService
for ($i = 1; $i <= (count($newOrderSkuList[$order['id']]) ?? 0); $i++) {
$breakFlag = 0;
$pickupCodeOneCopies = $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? null;
$boxNum = 0;
if (!empty($pickupCodeOneCopies)) {
$pickupCodeOneCopiesArr = explode('-', $pickupCodeOneCopies);
$boxNum = ceil(end($pickupCodeOneCopiesArr) ?? 0 / (int)$this->configCache->getConfigValueByKey(ConfigCode::MAXIMUM_VALUE_IN_FULL_BOX));
}
$oneCopiesInfo = [
'total_price' => '0.00',
'total_quantity' => 0,
'image_list' => [],
'pickup_code' => $pickupCodeArrList[$order['id']][$i]['pickup_code'] ?? '', // 取餐码
'pickup_code' => $pickupCodeOneCopies ?? '', // 取餐码
'box_num' => $boxNum,
'is_add_staple_food' => GoodCode::IS_NOT_ADD_STAPLE_FOOD,
];