55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\adminapi\validate\order;
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
/**
|
|
* 订单验证
|
|
* Class OrderValidate
|
|
* @package app\adminapi\validate\order
|
|
*/
|
|
class OrderValidate extends BaseValidate
|
|
{
|
|
protected $rule = [
|
|
'id' => 'require|integer',
|
|
'patient_id' => 'require|integer',
|
|
'patient_id_optional' => 'integer',
|
|
'order_type' => 'require|in:1,2,3,4,5,6,7,8',
|
|
'amount' => 'require|float',
|
|
'status' => 'require|in:1,2,3,4',
|
|
'payment_method' => 'in:alipay,wechat,wechat_work,fubei,manual',
|
|
'remark' => 'string|max:500',
|
|
'order_no' => 'string|max:50',
|
|
'is_supplement' => 'in:0,1',
|
|
'order_ids' => 'require|array',
|
|
'assistant_id' => 'require|integer|gt:0',
|
|
'amounts' => 'require|array',
|
|
'order_types' => 'require|array',
|
|
];
|
|
|
|
protected $message = [
|
|
'patient_id.require' => '患者ID必填',
|
|
'order_type.require' => '订单类型必填',
|
|
'order_type.in' => '订单类型不正确',
|
|
'amount.require' => '订单金额必填',
|
|
'status.require' => '订单状态必填',
|
|
'status.in' => '订单状态不正确',
|
|
'payment_method.in' => '支付方式不正确',
|
|
];
|
|
|
|
protected $scene = [
|
|
'create' => ['patient_id', 'order_type', 'amount'],
|
|
'edit' => ['id'],
|
|
'detail' => ['id'],
|
|
'pay' => ['payment_method'],
|
|
'cancel' => ['id'],
|
|
'refund' => ['id'],
|
|
'delete' => ['id'],
|
|
'assign_assistant' => ['order_ids', 'assistant_id'],
|
|
'split' => ['id', 'amounts', 'order_types'],
|
|
];
|
|
}
|