安徽博创起重服务端程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
861 B

<?php
namespace app\shop\validate\order;
use app\common\basics\Validate;
use app\common\model\printer\Printer;
use app\common\model\printer\PrinterConfig;
class OrderPrintValidate extends Validate
{
protected $rule = [
'id' => 'require|checkPrint',
];
protected $message = [
'id.require' => '缺少ID字段',
];
protected function checkPrint($value, $rule, $data)
{
$config = PrinterConfig::where(['status' => 1, 'shop_id' => $data['shop_id']])->findOrEmpty();
if ($config->isEmpty()) {
return '请先到小票打印里面配置打印设置';
}
$printer = Printer::where(['config_id' => $config['id'], 'shop_id' => $data['shop_id']])->findOrEmpty();
if ($printer->isEmpty()) {
return '请先添加打印机';
}
return true;
}
}