IntervalModel.class.php 804 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Admin\Model;
  3. use Think\Model;
  4. /**
  5. * 时段模型
  6. * @author Devil
  7. * @blog http://gong.gg/
  8. * @version 0.0.1
  9. * @datetime 2016-12-01T21:51:08+0800
  10. */
  11. class IntervalModel extends CommonModel
  12. {
  13. // 数据自动校验
  14. protected $_validate = array(
  15. // 添加,编辑
  16. array('name', 'CheckName', '{%interval_name_format}', 1, 'callback', 3),
  17. array('is_enable', array(0,1), '{%common_enable_tips}', 1, 'in', 3),
  18. array('sort', 'CheckSort', '{%common_sort_error}', 1, 'function', 3),
  19. );
  20. /**
  21. * [CheckName 时段名称格式校验]
  22. * @author Devil
  23. * @blog http://gong.gg/
  24. * @version 0.0.1
  25. * @datetime 2016-12-13T15:12:32+0800
  26. */
  27. public function CheckName()
  28. {
  29. return (preg_match('/'.L('common_regex_interval').'/', I('name')) == 1) ? true : false;
  30. }
  31. }
  32. ?>