修改插件
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
yiqiu
2025-11-21 00:01:45 +08:00
parent 7bc68457e9
commit cbd6250967
224 changed files with 61713 additions and 18 deletions

View File

@@ -0,0 +1,71 @@
<?php
namespace addon\idcsmart_ticket\validate;
use addon\idcsmart_ticket\model\IdcsmartTicketTypeModel;
use app\common\model\ProductModel;
use think\Validate;
/**
* @title 工单类型验证
* @description 接口说明:工单类型验证
*/
class TicketDeliveryValidate extends Validate
{
protected $rule = [
'id' => 'require',
'ticket_type_id' => 'require|checkTicketTypeId:thinkphp',
'product_ids' => 'require|array|checkProductIds:thinkphp',
'product_id' => 'require|checkProductId:thinkphp',
];
protected $message = [
];
protected $scene = [
'create' => ['ticket_type_id','product_ids'],
'update' => ['id','ticket_type_id','product_id'],
];
protected function checkTicketTypeId($value)
{
$IdcsmartTicketTypeModel = new IdcsmartTicketTypeModel();
$exist = $IdcsmartTicketTypeModel->find($value);
if (empty($exist)){
return 'ticket_type_is_not_exist';
}
return true;
}
protected function checkProductIds($value)
{
$ProductModel = new ProductModel();
foreach ($value as $item){
$product = $ProductModel->find($item);
if (empty($product)){
return 'product_is_not_exist';
}
}
return true;
}
protected function checkProductId($value)
{
$ProductModel = new ProductModel();
$product = $ProductModel->find($value);
if (empty($product)){
return 'product_is_not_exist';
}
return true;
}
}