UserGroup.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\admin\user;
  12. use app\common\AdminBaseController;
  13. use app\Request;
  14. use app\services\user\UserGroupServices;
  15. use think\exception\ValidateException;
  16. /**
  17. * 会员设置
  18. * Class UserLevel
  19. * @package app\controller\admin\v1\user
  20. */
  21. class UserGroup extends AdminBaseController
  22. {
  23. /**
  24. * user constructor.
  25. * @param Request $request
  26. * @param UserGroupServices $services
  27. */
  28. public function __construct(Request $request, UserGroupServices $services)
  29. {
  30. parent::__construct($request);
  31. $this->service = $services;
  32. $this->createParams = [
  33. ['group_name', '', '', '', function ($value) {
  34. if (!$value) throw new ValidateException('请输入分组名称');
  35. }],
  36. ];
  37. $this->saveDeal = $this->updateDeal = function (&$data) {
  38. if (!$data['group_name']) throw new ValidateException('请输入分组名称');
  39. };
  40. }
  41. }