1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace app\admin\validate\medical;
- use think\Validate;
- class DoctorValidate extends Validate
- {
- //定义规则
- protected $rule = [
- 'doctor_name' => 'require',
- 'doctor_position' => 'require',
- 'doctor_head' => 'require',
- 'doctor_mobile' => 'require',
- 'doctor_visit' => 'require|in:0,1',
- 'doctor_work' => 'require',
- 'doctor_money' => 'require',
- 'doctor_type' => 'require|in:0,1,2',
- 'doctor_shop_id' => 'require',
- 'doctor_subject_id' => 'require',
- 'doctor_address' => 'require',
- 'doctor_id' => 'require',
- 'work_time' => 'require',
- // 'morning_start' => 'require',
- // 'morning_end' => 'require',
- // 'afternoon_start' => 'require',
- // 'afternoon_end' => 'require',
- 'appointment_sum' => 'require'
- ];
- //定义描述
- protected $message = [
- 'doctor_name.require' => '医生姓名不能为空',
- 'doctor_position.require' => '医生职位不能为空',
- 'doctor_head.require' => '医生头像不能为空',
- 'doctor_mobile.require' => '医生手机号不能为空',
- 'doctor_visit.require' => '请选择是否支持出诊',
- 'doctor_visit.in' => '出诊类型错误',
- 'doctor_work.require' => '请设置医生上班时间',
- 'doctor_money.require' => '请设置医生收费标准',
- 'doctor_type.require' => '请选择医生类型',
- 'doctor_type.in' => '医生类型错误',
- 'doctor_shop_id' => '请选择医生归属医院或商家',
- 'doctor_subject_id.require' => '请选择医生科目',
- 'doctor_address.require' => '请填写科室位置',
- 'doctor_id.require' => '医生编号不能为空',
- 'work_time.require' => '医生工作时间不能为空',
- // 'morning_start.require' => '上午开始时间不能为空',
- // 'morning_end.require' => '上午结束时间不能为空',
- // 'afternoon_start.require' => '下午开始时间不能为空',
- // 'afternoon_end.require' => '下午结束时间不能为空',
- 'appointment_sum.require' => '每个时间段预约人数不能为空',
- ];
- //定义场景
- protected $scene = [
- 'add' => ['doctor_name', 'doctor_position', 'doctor_head', 'doctor_mobile', 'doctor_visit', 'doctor_work', 'doctor_money', 'doctor_type', 'doctor_shop_id', 'doctor_subject_id', 'doctor_address'],
- 'update' => ['doctor_name', 'doctor_position', 'doctor_head', 'doctor_mobile', 'doctor_visit', 'doctor_work', 'doctor_money', 'doctor_type', 'doctor_shop_id', 'doctor_subject_id', 'doctor_address', 'doctor_id'],
- 'del' => ['doctor_id'],
- 'info' => ['doctor_id'],
- 'set' => ['doctor_id', 'work_time', 'appointment_sum'],
- ];
- }
|