| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?php
- namespace App\Module\Mex\Services;
- use App\Module\Mex\Logic\MexMatchLogic;
- /**
- * 农贸市场撮合服务
- *
- * 提供撮合相关的对外服务接口
- */
- class MexMatchService
- {
- /**
- * 执行用户买入物品撮合任务
- *
- * @param int|null $itemId 指定商品ID,null表示处理所有商品
- * @param int $batchSize 批处理大小
- * @return array 撮合结果
- */
- public static function executeUserBuyItemMatch(?int $itemId = null, int $batchSize = 100): array
- {
- return MexMatchLogic::executeUserBuyItemMatch($itemId, $batchSize);
- }
- /**
- * 执行用户卖出物品撮合任务
- *
- * @param int|null $itemId 指定商品ID,null表示处理所有商品
- * @param int $batchSize 批处理大小
- * @return array 撮合结果
- */
- public static function executeUserSellItemMatch(?int $itemId = null, int $batchSize = 100): array
- {
- return MexMatchLogic::executeUserSellItemMatch($itemId, $batchSize);
- }
- /**
- * 执行单个商品的用户买入物品撮合
- *
- * @param int $itemId 商品ID
- * @param int $batchSize 批处理大小
- * @return array 撮合结果
- */
- public static function executeUserBuyItemMatchForItem(int $itemId, int $batchSize = 100): array
- {
- return MexMatchLogic::executeUserBuyItemMatchForItem($itemId, $batchSize);
- }
- /**
- * 执行单个商品的用户卖出物品撮合
- *
- * @param int $itemId 商品ID
- * @param int $batchSize 批处理大小
- * @return array 撮合结果
- */
- public static function executeUserSellItemMatchForItem(int $itemId, int $batchSize = 100): array
- {
- return MexMatchLogic::executeUserSellItemMatchForItem($itemId, $batchSize);
- }
- /**
- * 获取用户买入物品撮合统计信息
- *
- * @return array 统计信息
- */
- public static function getUserBuyItemMatchStats(): array
- {
- return MexMatchLogic::getUserBuyItemMatchStats();
- }
- /**
- * 获取用户卖出物品撮合统计信息
- *
- * @return array 统计信息
- */
- public static function getUserSellItemMatchStats(): array
- {
- return MexMatchLogic::getUserSellItemMatchStats();
- }
- /**
- * 检查用户买入物品撮合条件
- *
- * @param int $itemId 商品ID
- * @return array 检查结果
- */
- public static function checkUserBuyItemMatchConditions(int $itemId): array
- {
- return MexMatchLogic::checkUserBuyItemMatchConditions($itemId);
- }
- /**
- * 检查用户卖出物品撮合条件
- *
- * @param int $itemId 商品ID
- * @return array 检查结果
- */
- public static function checkUserSellItemMatchConditions(int $itemId): array
- {
- return MexMatchLogic::checkUserSellItemMatchConditions($itemId);
- }
- // 保留旧方法以兼容现有代码
- /**
- * 执行撮合任务(已废弃,请使用executeUserBuyItemMatch)
- *
- * @deprecated 请使用executeUserBuyItemMatch或executeUserSellItemMatch
- * @param int|null $itemId 指定商品ID,null表示处理所有商品
- * @param int $batchSize 批处理大小
- * @return array 撮合结果
- */
- public static function executeMatch(?int $itemId = null, int $batchSize = 100): array
- {
- return self::executeUserBuyItemMatch($itemId, $batchSize);
- }
- /**
- * 执行单个商品的撮合(已废弃,请使用executeUserBuyItemMatchForItem)
- *
- * @deprecated 请使用executeUserBuyItemMatchForItem或executeUserSellItemMatchForItem
- * @param int $itemId 商品ID
- * @param int $batchSize 批处理大小
- * @return array 撮合结果
- */
- public static function executeItemMatch(int $itemId, int $batchSize = 100): array
- {
- return self::executeUserBuyItemMatchForItem($itemId, $batchSize);
- }
- /**
- * 获取撮合统计信息(已废弃,请使用getUserBuyItemMatchStats)
- *
- * @deprecated 请使用getUserBuyItemMatchStats或getUserSellItemMatchStats
- * @return array 统计信息
- */
- public static function getMatchStats(): array
- {
- return self::getUserBuyItemMatchStats();
- }
- /**
- * 检查撮合条件(已废弃,请使用checkUserBuyItemMatchConditions)
- *
- * @deprecated 请使用checkUserBuyItemMatchConditions或checkUserSellItemMatchConditions
- * @param int $itemId 商品ID
- * @return array 检查结果
- */
- public static function checkMatchConditions(int $itemId): array
- {
- return self::checkUserBuyItemMatchConditions($itemId);
- }
- }
|