| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace App\Module\Mex\Service;
- use App\Module\Mex\Dto\MexPriceAdjustmentDto;
- use App\Module\Mex\Logic\MexPriceAdjustmentLogic;
- use App\Module\Mex\Models\MexPriceConfig;
- use Illuminate\Support\Collection;
- /**
- * 农贸市场价格调整记录服务层
- */
- class MexPriceAdjustmentService
- {
- /**
- * 记录价格配置调整
- */
- public static function recordPriceConfigAdjustment(
- MexPriceConfig $oldConfig,
- MexPriceConfig $newConfig,
- int $adminUserId,
- ?string $adjustmentReason = null,
- ?string $marketImpactNote = null
- ): MexPriceAdjustmentDto {
- $logic = new MexPriceAdjustmentLogic();
- return $logic->recordPriceConfigAdjustment(
- $oldConfig,
- $newConfig,
- $adminUserId,
- $adjustmentReason,
- $marketImpactNote
- );
- }
- /**
- * 获取商品的价格调整历史
- */
- public static function getItemAdjustmentHistory(int $itemId, int $limit = 50): Collection
- {
- $logic = new MexPriceAdjustmentLogic();
- return $logic->getItemAdjustmentHistory($itemId, $limit);
- }
- /**
- * 获取管理员的调整操作记录
- */
- public static function getAdminAdjustmentHistory(int $adminUserId, int $limit = 50): Collection
- {
- $logic = new MexPriceAdjustmentLogic();
- return $logic->getAdminAdjustmentHistory($adminUserId, $limit);
- }
- /**
- * 获取指定时间范围内的调整记录
- */
- public static function getAdjustmentsByDateRange(
- string $startDate,
- string $endDate,
- ?int $itemId = null,
- ?int $adminUserId = null
- ): Collection {
- $logic = new MexPriceAdjustmentLogic();
- return $logic->getAdjustmentsByDateRange($startDate, $endDate, $itemId, $adminUserId);
- }
- /**
- * 获取调整统计信息
- */
- public static function getAdjustmentStatistics(string $startDate, string $endDate): array
- {
- $logic = new MexPriceAdjustmentLogic();
- return $logic->getAdjustmentStatistics($startDate, $endDate);
- }
- }
|