| 1234567891011121314151617181920212223 |
- <?php
- declare(strict_types=1);
- namespace app\miniapi\service\driver;
- use app\miniapi\exception\ApiException;
- use plugin\saiadmin\app\model\water\WaterDelivery;
- /** Template method: every on-site action shares the same state precondition. */
- abstract class InTransitAction implements TaskAction
- {
- final public function execute(WaterDelivery $task, array $input, int $user): array
- {
- if ($task->status !== 'transit') {
- throw new ApiException(40902, '仅配送中的任务允许此操作', 409);
- }
- return $this->handle($task, $input, $user);
- }
- abstract protected function handle(WaterDelivery $task, array $input, int $user): array;
- }
|