删除多余文件

This commit is contained in:
2026-01-29 15:57:29 +08:00
parent c7e5e8ae6b
commit f6e670269c
41 changed files with 0 additions and 1773 deletions
@@ -1,33 +0,0 @@
<?php
namespace app\common\service;
use app\common\validate\UserGroupMembersValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\UserGroupMembers;
use app\common\model\UserGroup;
use support\Request;
class UserGroupMembersService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = UserGroupMembers::class;
/**
* 验证器
*/
protected $validator = UserGroupMembersValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
}
-124
View File
@@ -1,124 +0,0 @@
<?php
namespace app\common\service;
use app\common\logic\UserGroupLogic;
use app\common\logic\UserGroupMembersLogic;
use app\common\validate\UserGroupValidate;
use app\common\traits\crud\CrudServiceTrait;
use app\common\model\UserGroup;
use support\Request;
class UserGroupService
{
use CrudServiceTrait;
/**
* 指定当前要操作的模型
*/
protected string $modelClass = UserGroup::class;
/**
* 验证器
*/
protected $validator = UserGroupValidate::class;
/**
* 获取验证器
*/
public function getValidator()
{
return new $this->validator;
}
protected function buildQueryConfig(Request $request, string $scene = 'default'): array
{
$p = $request->all();
$config = [];
$config['model'] = $this->modelClass;
switch ($scene) {
case 'default':
$config['where']['status'] = 1;
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
$config['with'] = ['groupMembers', 'groupMembers.user'];
break;
case 'index':
$config['where']['status'] = 1;
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
$config['with'] = ['groupMembers', 'groupMembers.user'];
break;
case 'show':
$config['where']['id'] = $p['id'];
$config['where']['status'] = 1;
break;
case 'store':
break;
case 'update':
$config['where']['id'] = $p['id'];
break;
case 'destroy':
$config['where']['id'] = $p['id'];
break;
case 'userGroup':
$config['where']['status'] = 1;
$config['order']['sort'] = 'desc';
$config['order']['id'] = 'desc';
$config['fields'] = ['id', 'title'];
break;
}
return $config;
}
public function serviceStore(Request $request, array $data = [], string $scene = 'store')
{
$data = $this->preProcess(ucfirst($scene), $data, $request);
$created = (new UserGroupLogic())->createGroup($data);
return $this->postProcess(ucfirst($scene), $created);
}
public function serviceUpdate(Request $request, array $data = [], string $scene = 'update')
{
$data = $this->preProcess(ucfirst($scene), $data, $request);
$config = $this->buildQueryConfig($request, $scene);
$userGroup = $this->logicShow($config);
$updated = (new UserGroupLogic())->updateGroup($userGroup, $data);
return $this->postProcess(ucfirst($scene), $updated);
}
public function serviceDestroy(Request $request, string $scene = 'destroy')
{
$config = $this->buildQueryConfig($request, $scene);
$deleted = $this->logicDeleteBy($config);
(new UserGroupMembersLogic())->deleteUserGroupMembers($config['where']['id']);
return $this->postProcess(ucfirst($scene), $deleted);
}
public function userGroup(Request $request, string $scene = 'userGroup')
{
$config = $this->buildQueryConfig($request, $scene);
$result = $this->logicListAll($config);
return $this->postProcess(ucfirst($scene), $result);
}
public function userGroupScene(Request $request, string $scene = 'userGroup')
{
$data = (new \app\common\service\SysDictService())->pluckKeyValueByCode('user_group_scene');
$result = [];
foreach($data as $key => $value) {
$result[] = [
'name' => $key,
'id' => $value,
];
}
return $this->postProcess(ucfirst($scene), $result);
}
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class ApprovalFlowsValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class ApprovalInstancesValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class ApprovalRecordsValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
-35
View File
@@ -1,35 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class CorpValidate extends Validate
{
protected $rule = [
'id' => 'require|number',
'name' => 'require|max:255',
'abbr' => 'require|in:hesu,xinyouhe,paika,simate,mbaf',
'tenant_key' => 'string',
'sort' => 'number',
'status' => 'require|in:0,1'
];
protected $message = [
'id.require' => 'ID不能为空',
'id.number' => 'ID必须是数字',
'name.require' => '企业名称不能为空',
'name.max' => '企业名称长度不能超过255个字符',
'abbr.require' => '企业缩写不能为空',
'abbr.in' => '企业缩写必须是 hesu,xinyouhe,paika,simate,mbaf 中的一个',
'tenant_key.string' => '飞书企业标识必须是字符串',
'sort.number' => '排序值必须是数字',
'status.require' => '状态不能为空',
'status.in' => '状态必须是0或1'
];
protected $scene = [
'store' => ['name', 'abbr', 'tenant_key', 'sort', 'status'],
'update' => ['id', 'name', 'abbr', 'tenant_key', 'sort', 'status']
];
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class CountryValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class FinPaymentApplyValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class FinReceiptHisValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,56 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class FinReceiptValidate extends Validate
{
// 规则
protected $rule = [
// 'payment_apply_id' => 'integer|gt:0',
// 'country_id' => 'require|integer|gt:0',
// 'remitter' => 'require',
// 'account_id' => 'require|integer|gt:0',
// 'currency_id' => 'require|integer|gt:0',
// 'amount' => 'require|gt:0',
// 'exchange_rate' => 'require|gt:0',
// 'arrived_at' => 'require',
// 'is_domestic_return' => 'require|integer',
];
// 提示
protected $message = [
// 'payment_apply_id.integer' => '付款申请ID必须是整数',
// 'payment_apply_id.gt' => '付款申请ID必须大于0',
// 'country_id.require' => '付款来源国家ID不能为空',
// 'country_id.integer' => '付款来源国家ID必须是整数',
// 'country_id.gt' => '付款来源国家ID必须大于0',
// 'remitter.require' => '汇款人不能为空',
// 'account_id.require' => '收款账号ID不能为空',
// 'account_id.integer' => '收款账号ID必须是整数',
// 'account_id.gt' => '收款账号ID必须大于0',
// 'currency_id.require' => '收款币种ID不能为空',
// 'currency_id.integer' => '收款币种ID必须是整数',
// 'currency_id.gt' => '收款币种ID必须大于0',
// 'amount.require' => '收款金额不能为空',
// 'amount.gt' => '收款金额必须大于0',
// 'exchange_rate.require' => '实际汇率不能为空',
// 'exchange_rate.gt' => '实际汇率必须大于0',
// 'arrived_at.require' => '到账时间不能为空',
// 'arrived_at.gt' => '到账时间必须大于0',
// 'is_domestic_return.require' => '是否回转内地不能为空',
// 'is_domestic_return.integer' => '是否回转内地必须是整数',
];
// 场景
protected $scene = [
'store' => [
// 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'exchange_rate', 'arrived_at'
],
'update' => [
// 'payment_apply_id'
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class FinanceReconDubaiFilesValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
-176
View File
@@ -1,176 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
use app\common\model\InquiryLog;
class InquiryLogValidate extends Validate
{
// 规则
protected $rule = [
'id' => 'require|integer|gt:0',
'order_no' => 'require|alphaDash|length:36',
'enter_user_id'=> 'integer|egt:0',
'recipient' => 'integer|egt:0',
'quality' => 'require|in:1,2,3',
'channel' => 'integer|between:0,99',
'email' => 'email|max:255|checkEmailContactUnique',
'tel' => 'max:255|checkTelContactUnique',
'whatsapp' => 'max:255|checkWhatsappContactUnique',
'country' => 'integer|egt:0|requireWith:contacts',
'contacts' => 'require|max:255|requireWithout:email,tel,whatsapp|checkContactUnique',
'content' => 'string',
'status' => 'in:0,1,2',
'r_time' => 'integer|egt:0',
't_time' => 'integer|egt:0'
];
// 提示
protected $message = [
'id.require' => 'ID不能为空',
'id.integer' => 'ID必须是整数',
'id.gt' => 'ID必须大于0',
'order_no.require' => '订单号不能为空',
'order_no.alphaDash'=> '订单号只能包含字母、数字和下划线',
'order_no.length' => '订单号长度必须为36位',
'enter_user_id.integer' => '录入人ID必须是整数',
'enter_user_id.egt' => '录入人ID不能为负数',
'recipient.integer' => '接单人ID必须是整数',
'recipient.egt' => '接单人ID不能为负数',
'quality.require' => '询单等级不能为空',
'quality.in' => '询单等级只能是1、2或3',
'channel.integer' => '渠道编号必须是整数',
'channel.between' => '渠道编号范围0-99',
'email.email' => '邮箱格式不正确',
'email.max' => '邮箱长度不能超过255个字符',
'tel.max' => '电话长度不能超过255个字符',
'whatsapp.max' => 'WhatsApp长度不能超过255个字符',
'country.integer' => '国家代码必须是整数',
'country.egt' => '国家代码不能为负数',
'contacts.require' => '联系人不能为空',
'contacts.max' => '联系人长度不能超过255个字符',
'content.string' => '询单内容必须是字符串',
'status.in' => '状态值只能是0、1或2',
'r_time.integer' => '发布时间必须是整数',
'r_time.egt' => '发布时间不能为负数',
't_time.integer' => '跟踪时间必须是整数',
't_time.egt' => '跟踪时间不能为负数',
'email.checkEmailContactUnique' => '邮箱联系方式已存在',
'tel.checkTelContactUnique' => '电话联系方式已存在',
'whatsapp.checkWhatsappContactUnique' => 'WhatsApp联系方式已存在',
'contacts.requireWithout' => '至少需要提供一种联系方式',
'contacts.checkContactUnique' => '联系人已存在',
'country.requireWith' => '国家必须与联系人一起提供'
];
// 场景
protected $scene = [
'store' => [
'enter_user_id', 'quality', 'channel', 'email', 'tel', 'whatsapp', 'country', 'contacts', 'content', 'recipient'
],
'update' => [
'quality', 'channel', 'email', 'tel', 'whatsapp', 'country', 'contacts', 'content', 'recipient'
],
'release' => [
'status', 'r_time'
],
'allocation' => [
'status', 't_time'
]
];
/**
* 验证联系方式唯一性
*/
protected function checkContactUnique($value, $rule, $data, $field, $title)
{
// 如果是更新操作且联系人未修改,跳过检查
if ($this->currentScene == 'update') {
$original = InquiryLog::find($data['id']);
if ($original && $original->contacts == $value && $original->country == ($data['country'] ?? 0)) {
return true;
}
}
if (empty($data['email']) && empty($data['tel']) && empty($data['whatsapp'])) {
$query = InquiryLog::where('contacts', trim($value))
->where('country', $data['country']);
if (!empty($data['id'])) {
$query->where('id', '<>', $data['id']);
}
return !$query->exists();
}
return true;
}
/**
* 验证邮箱联系方式唯一性
*/
protected function checkEmailContactUnique($value, $rule, $data, $field, $title)
{
if (empty($value)) return true;
// 如果是更新操作且邮箱未修改,跳过检查
if ($this->currentScene == 'update' && !empty($data['id'])) {
$original = InquiryLog::find($data['id']);
if ($original && $original->email == $value) {
return true;
}
}
$query = InquiryLog::where('email', trim($value));
if (!empty($data['id'])) {
$query->where('id', '<>', $data['id']);
}
return !$query->exists();
}
/**
* 验证电话联系方式唯一性
*/
protected function checkTelContactUnique($value, $rule, $data, $field, $title)
{
if (empty($value)) return true;
// 如果是更新操作且电话未修改,跳过检查
if ($this->currentScene == 'update' && !empty($data['id'])) {
$original = InquiryLog::find($data['id']);
if ($original && $original->tel == $value) {
return true;
}
}
$query = InquiryLog::where('tel', trim($value));
if (!empty($data['id'])) {
$query->where('id', '<>', $data['id']);
}
return !$query->exists();
}
/**
* 验证WhatsApp联系方式唯一性
*/
protected function checkWhatsappContactUnique($value, $rule, $data, $field, $title)
{
if (empty($value)) return true;
// 如果是更新操作且WhatsApp未修改,跳过检查
if ($this->currentScene == 'update' && !empty($data['id'])) {
$original = InquiryLog::find($data['id']);
if ($original && $original->whatsapp == $value) {
return true;
}
}
$query = InquiryLog::where('whatsapp', trim($value));
if (!empty($data['id'])) {
$query->where('id', '<>', $data['id']);
}
return !$query->exists();
}
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class InquiryTransmitConfigValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class InquiryTransmitValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class InvItemValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class InvRequisitionApproveValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class InvRequisitionAttachmentValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class InvRequisitionItemReturnAttachmentValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class InvRequisitionItemReturnValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class InvRequisitionItemValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,55 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class InvRequisitionValidate extends Validate
{
// 规则
protected $rule = [
'applicant_id' => 'number',
'borrow_reason' => 'require|max:255',
'use_start_date' => 'require|date',
'use_end_date' => 'date',
'items' => 'require|array',
'items.*.item_id' => 'require|number',
'items.*.request_qty' => 'require|number|gt:0',
];
// 提示
protected $message = [
'applicant_id.number' => '申请人格式错误',
'borrow_reason.require' => '领用事由不能为空',
'borrow_reason.max' => '领用事由最多不能超过255个字符',
'use_start_date.require' => '使用开始日期不能为空',
'use_start_date.date' => '使用开始日期格式错误',
'use_end_date.date' => '预计归还日期格式错误',
'items.require' => '申请物品明细不能为空',
'items.array' => '申请物品明细格式错误',
'items.*.item_id.require' => '物品ID不能为空',
'items.*.item_id.number' => '物品ID格式错误',
'items.*.request_qty.require' => '申请数量不能为空',
'items.*.request_qty.number' => '申请数量格式错误',
'items.*.request_qty.gt' => '申请数量必须大于0',
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
],
'apply' => [
'applicant_id',
'borrow_reason',
'use_start_date',
'use_end_date',
'items'
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class MessageNotificationsValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class MessageUserStatusValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class PurchaseOrderItemsValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class PurchaseOrdersValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class StockOrderAccountsValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class StockOrderItemOptionsValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class StockOrderItemsValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class StockOrdersFilesValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
-209
View File
@@ -1,209 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class StockOrdersValidate extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'id' => 'number|egt:0',
'order_no' => 'require|max:40|unique:stock_orders',
'pi_no' => 'require|max:64',
'biz_date' => 'require',
'salesperson_id' => 'number|egt:0',
'salesperson_snapshot' => 'max:64',
'clearance_country_id' => 'require|number|egt:0',
'clearance_country_snapshot' => 'require|max:64',
'customer_source_id' => 'require|number|egt:0',
'customer_source_snapshot' => 'require|max:64',
'customer_id' => 'require|number|egt:0',
'customer_snapshot' => 'require|max:128',
'customer_country_id' => 'require|number|egt:0',
'customer_country_snapshot' => 'require|max:64',
'declarant_name' => 'require|max:64',
'eta_ship_date' => 'number|egt:0',
'shipping_method_id' => 'require|number',
'shipping_method_snapshot' => 'require|max:32',
'cif_total_amount' => 'require|float|egt:0',
'domestic_port_id' => 'require|number|egt:0',
'domestic_port_snapshot' => 'require|max:64',
'trade_term_id' => 'require|number|egt:0',
'trade_term_snapshot' => 'require|max:64',
'clearance_port_id' => 'require|number|egt:0',
'clearance_port_snapshot' => 'require|max:64',
'latest_arrival_date' => 'number|egt:0',
'contract_exchange_rate' => 'require|float|egt:0',
'settlement_currency' => 'require|length:3|alpha',
'remark' => 'max:255',
'contract' => 'max:255',
'is_use' => 'in:0,1',
'object_id' => 'number|egt:0',
'is_final' => 'in:0,1',
'approval_status' => 'in:0,1,2,3',
'status' => 'in:0,1',
'file_url' => 'max:255',
'pick_up_date' => 'number|egt:0',
'collect_all_date' => 'number|egt:0',
'created_at' => 'number|egt:0',
'updated_at' => 'number|egt:0',
'deleted_at' => 'number|egt:0',
];
/**
* 错误提示信息
*/
protected $message = [
'order_no.require' => '备货单编号不能为空',
'order_no.max' => '备货单编号长度不能超过40个字符',
'order_no.unique' => '备货单编号已存在',
'pi_no.require' => 'PI号不能为空',
'pi_no.max' => 'PI号长度不能超过64个字符',
'biz_date.require' => '单据日期不能为空',
'clearance_country_id.require' => '清关目的国ID不能为空',
'clearance_country_snapshot.require' => '清关目的国名称不能为空',
'customer_source_id.require' => '客户来源ID不能为空',
'customer_source_snapshot.require' => '客户来源名称不能为空',
'customer_id.require' => '客户ID不能为空',
'customer_snapshot.require' => '客户名称不能为空',
'customer_country_id.require' => '客户所在国ID不能为空',
'customer_country_snapshot.require' => '客户所在国名称不能为空',
'declarant_name.require' => '清关人不能为空',
'shipping_method_id.require' => '出运方式ID不能为空',
'shipping_method_snapshot.require' => '出运方式不能为空',
'cif_total_amount.require' => '合计到岸价不能为空',
'cif_total_amount.float' => '合计到岸价必须为数字',
'cif_total_amount.egt' => '合计到岸价不能为负数',
'domestic_port_id.require' => '国内收货港ID不能为空',
'domestic_port_snapshot.require' => '国内收货港名称不能为空',
'trade_term_id.require' => '贸易条款ID不能为空',
'trade_term_snapshot.require' => '贸易条款名称不能为空',
'clearance_port_id.require' => '清关目的港ID不能为空',
'clearance_port_snapshot.require' => '清关目的港名称不能为空',
'contract_exchange_rate.require' => '合同汇率不能为空',
'contract_exchange_rate.float' => '合同汇率必须为数字',
'contract_exchange_rate.egt' => '合同汇率不能为负数',
'settlement_currency.require' => '结算币种不能为空',
'settlement_currency.length' => '结算币种必须为3个字符',
'settlement_currency.alpha' => '结算币种必须为字母',
'approval_status.in' => '审批状态值不正确',
'status.in' => '状态值不正确',
'is_final.in' => '是否终版值不正确',
'is_use.in' => '是否开过终版值不正确',
];
/**
* 验证场景
*/
protected $scene = [
// 创建场景
'store' => [
'pi_no', 'biz_date',
'clearance_country_id', 'clearance_country_snapshot', 'customer_source_id',
'customer_source_snapshot', 'customer_id', 'customer_snapshot',
'customer_country_id', 'customer_country_snapshot', 'declarant_name',
'shipping_method_id', 'shipping_method_snapshot',
'domestic_port_id', 'domestic_port_snapshot',
'trade_term_id', 'trade_term_snapshot', 'clearance_port_id',
'clearance_port_snapshot', 'contract_exchange_rate',
'settlement_currency'
],
// 更新场景
'update' => [
'pi_no', 'biz_date',
'clearance_country_id', 'clearance_country_snapshot', 'customer_source_id',
'customer_source_snapshot', 'customer_id', 'customer_snapshot',
'customer_country_id', 'customer_country_snapshot', 'declarant_name',
'shipping_method_id', 'shipping_method_snapshot',
'domestic_port_id', 'domestic_port_snapshot',
'trade_term_id', 'trade_term_snapshot', 'clearance_port_id',
'clearance_port_snapshot', 'contract_exchange_rate',
'settlement_currency'
],
// 提交审批场景
'submit' => [
'id' => 'require|number|egt:1',
'status' => 'require|in:1'
],
// 审批场景
'approve' => [
'id' => 'require|number|egt:1',
'approval_status' => 'require|in:1,2,3'
],
// 状态更新场景
'status' => [
'id' => 'require|number|egt:1',
'status' => 'require|in:0,1'
],
// 简略验证场景(用于快速验证)
'simple' => [
'order_no', 'biz_date', 'cif_total_amount', 'settlement_currency'
]
];
/**
* 自定义验证规则 - 验证时间戳是否合理
*/
protected function checkTimestamp($value, $rule, $data = [])
{
if ($value === 0 || $value === '0') {
return true;
}
// 时间戳应该在1970年到现在+1年的范围内
$minTimestamp = 0;
$maxTimestamp = time() + (365 * 24 * 60 * 60);
return $value >= $minTimestamp && $value <= $maxTimestamp;
}
/**
* 自定义验证规则 - 验证金额格式
*/
protected function checkMoney($value, $rule, $data = [])
{
if (!is_numeric($value)) {
return false;
}
// 验证小数点位数不超过2位
if (strpos($value, '.') !== false) {
$decimalPart = explode('.', $value)[1];
if (strlen($decimalPart) > 2) {
return false;
}
}
return true;
}
/**
* 场景验证前回调 - 添加自定义规则
*/
// protected function sceneBefore($scene)
// {
// // 为时间戳字段添加自定义验证
// $timestampFields = ['biz_date', 'eta_ship_date', 'latest_arrival_date', 'pick_up_date', 'collect_all_date', 'created_at', 'updated_at', 'deleted_at'];
// foreach ($timestampFields as $field) {
// if (isset($this->scene[$scene][$field])) {
// $this->rule[$field] .= '|checkTimestamp';
// }
// }
// // 为金额字段添加自定义验证
// $moneyFields = ['cif_total_amount', 'contract_exchange_rate'];
// foreach ($moneyFields as $field) {
// if (isset($this->scene[$scene][$field])) {
// $this->rule[$field] .= '|checkMoney';
// }
// }
// }
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class SysOpLogValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class SysUpdateLogValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class SystemsValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class UserGroupMembersValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class UserGroupValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class VehDictI18nValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class VehDictMappingValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class VehMoneyValueValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class VehVehicleListingValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}
@@ -1,128 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class VehVehicleSkuValidate extends Validate
{
/**
* 规则定义
*/
protected $rule = [
'sku_code' => 'max:40|alphaNum',
'fingerprint' => 'length:64|alphaNum',
'brand_code' => 'require|max:32',
'brand_name' => 'require|max:64',
'series_code' => 'max:64',
'series_name' => 'max:128',
'model_code' => 'max:64',
'model_name' => 'require|max:128',
'model_year' => 'require|number|between:1900,2100',
'trim_code' => 'max:64',
'trim_level_code' => 'max:64',
'edition_code' => 'max:64',
'trim' => 'max:128',
'trim_level' => 'max:64',
'edition_name' => 'max:64',
'body_type_code' => 'max:32',
'drive_type_code' => 'max:16',
'motor_layout_code' => 'max:32',
'fuel_type_code' => 'max:16',
'engine_disp_l' => 'float|between:0,99.9',
'engine_turbo' => 'in:0,1',
'engine_power_kw' => 'number|between:0,2000',
'battery_kwh' => 'float|between:0,999.99',
'transmission_code' => 'max:16',
'gears' => 'number|between:1,20',
'range_km' => 'number|between:0,2000',
'range_std_code' => 'max:16',
'doors' => 'number|between:2,10',
'seats' => 'number|between:1,20',
'weight_kg' => 'number|between:0,10000',
'dimensions_mm' => 'array',
'color_exterior_code'=> 'max:32',
'color_exterior_text'=> 'max:64',
'color_interior_code'=> 'max:32',
'color_interior_text'=> 'max:64',
'options_official' => 'array',
'features' => 'array',
'emission_std_code' => 'max:16',
'origin_country' => 'alpha|length:2',
'currency' => 'require|alpha|length:3',
'msrp' => 'float|between:0,9999999999.99',
'is_active' => 'in:0,1',
'corp_id' => 'require|number',
'remark' => 'max:255',
'created_by' => 'number',
'updated_by' => 'number',
'created_at' => 'require|number',
'updated_at' => 'require|number',
];
/**
* 字段别名
*/
protected $field = [
'sku_code' => 'SKU编码',
'fingerprint' => '规格指纹',
'brand_code' => '品牌代码',
'brand_name' => '品牌名称',
'series_code' => '车系代码',
'series_name' => '车系名称',
'model_code' => '车型代码',
'model_name' => '车型名称',
'model_year' => '年款',
'trim_code' => '版型代码',
'trim_level_code' => '配置等级代码',
'edition_code' => '特别版代码',
'trim' => '版型/细分配置',
'trim_level' => '配置等级',
'edition_name' => '特别版名称',
'body_type_code' => '车身类型',
'drive_type_code' => '驱动方式',
'motor_layout_code' => '电机布置',
'fuel_type_code' => '能源类型',
'engine_disp_l' => '排量(L)',
'engine_turbo' => '是否涡轮',
'engine_power_kw' => '最大功率(kW)',
'battery_kwh' => '电池容量(kWh)',
'transmission_code' => '变速箱代码',
'gears' => '挡位数',
'range_km' => '续航里程',
'range_std_code' => '续航标准',
'doors' => '门数',
'seats' => '座位数',
'weight_kg' => '整备质量',
'dimensions_mm' => '车身尺寸',
'color_exterior_code'=> '外观色代码',
'color_exterior_text'=> '外观色名称',
'color_interior_code'=> '内饰色代码',
'color_interior_text'=> '内饰色名称',
'options_official' => '官方选装',
'features' => '功能配置',
'emission_std_code' => '排放标准',
'origin_country' => '原产国',
'currency' => '币种',
'msrp' => '建议零售价',
'is_active' => '是否启用',
'corp_id' => '公司ID',
'remark' => '备注',
'created_by' => '创建人',
'updated_by' => '更新人',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
/**
* 场景定义
*/
protected $scene = [
'store' => [
'brand_code', 'brand_name', 'model_year','currency'
],
'update' => [
'id', 'brand_code','brand_name', 'model_year','currency'
],
];
}
@@ -1,29 +0,0 @@
<?php
namespace app\common\validate;
use think\Validate;
class VehVehicleUnitValidate extends Validate
{
// 规则
protected $rule = [
];
// 提示
protected $message = [
];
// 场景
protected $scene = [
'store' => [
],
'update' => [
]
];
}