DiyTheme.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\validate\diy;
  12. use app\service\admin\diy\DiyService;
  13. use think\Validate;
  14. /**
  15. * 自定义主题配色验证器
  16. * Class DiyTheme
  17. * @package app\validate\diy
  18. */
  19. class DiyTheme extends Validate
  20. {
  21. protected $rule = [
  22. 'title' => 'require|checkDiyThemeTitleUnique',
  23. 'theme' => 'require',
  24. ];
  25. protected $message = [];
  26. protected $scene = [
  27. "add" => ['title', 'theme'],
  28. "edit" => ['title', 'theme'],
  29. ];
  30. public function checkDiyThemeTitleUnique($value, $rule, $data)
  31. {
  32. return ( new DiyService() )->checkDiyThemeTitleUnique($data) ? get_lang("validate_diy.theme_title_unique") : true;
  33. }
  34. }