49 lines
1.3 KiB
PHP
49 lines
1.3 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',
|
|
'amount' => 'require|float',
|
|
'status' => 'require|in:1,2,3,4',
|
|
'payment_method' => 'in:alipay,wechat,wechat_work',
|
|
'remark' => 'string|max:500',
|
|
'order_no' => 'string|max:50',
|
|
'is_supplement' => 'in:0,1',
|
|
];
|
|
|
|
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'],
|
|
];
|
|
}
|