feat : spu
This commit is contained in:
@@ -172,4 +172,17 @@ class CateringController
|
|||||||
{
|
{
|
||||||
return (new CompletePrintService)->handle();
|
return (new CompletePrintService)->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消打印
|
||||||
|
* @return array
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
#[RequestMapping(path: "option/cancel_print", methods: "GET")]
|
||||||
|
#[Scene(scene: "option_cancel_print")]
|
||||||
|
public function cancelPrint()
|
||||||
|
{
|
||||||
|
return (new PrintService)->cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use App\Constants\Admin\CateringCode;
|
|||||||
use App\Exception\ErrException;
|
use App\Exception\ErrException;
|
||||||
use App\Model\OrderOptionCateringLog;
|
use App\Model\OrderOptionCateringLog;
|
||||||
use App\Service\Admin\Catering\CateringBaseService;
|
use App\Service\Admin\Catering\CateringBaseService;
|
||||||
|
use App\Service\Admin\Catering\Print\PrintOrderFactory;
|
||||||
use App\Service\ServiceTrait\Admin\Catering\PrintTrait;
|
use App\Service\ServiceTrait\Admin\Catering\PrintTrait;
|
||||||
use Hyperf\Di\Annotation\Inject;
|
use Hyperf\Di\Annotation\Inject;
|
||||||
use Psr\Container\ContainerExceptionInterface;
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
@@ -77,4 +78,25 @@ class PrintService extends CateringBaseService
|
|||||||
|
|
||||||
return $this->return->success('success', ['status' => $res]);
|
return $this->return->success('success', ['status' => $res]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PrintOrderFactory
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected PrintOrderFactory $printOrderFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function cancel(): array
|
||||||
|
{
|
||||||
|
$service = $this->printOrderFactory->handle($this->request->input('type'));
|
||||||
|
$service->printId = (int)$this->request->input('print_id');
|
||||||
|
$service->handle();
|
||||||
|
$service->printCancel();
|
||||||
|
|
||||||
|
return $this->return->success('success');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ class YlyPrintService implements PrintOrderInterface
|
|||||||
*/
|
*/
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
//todo 加入打印机验证 orderOptionCateringLogModel
|
//加入打印机验证 orderOptionCateringLogModel
|
||||||
$printInfo = $this->printerModel->where('id',$this->printId)->first();
|
$printInfo = $this->printerModel->where('id',$this->printId)->first();
|
||||||
|
|
||||||
if (empty($printInfo)) throw new ErrException('打印机不存在-1');
|
if (empty($printInfo)) throw new ErrException('打印机不存在-1');
|
||||||
|
|||||||
Reference in New Issue
Block a user