ConfigGroupService.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Services\Common;
  12. use App\Models\ConfigGroupModel;
  13. use App\Models\ConfigModel;
  14. use App\Services\BaseService;
  15. /**
  16. * 配置分组-服务类
  17. * @author laravel开发员
  18. * @since 2020/11/11
  19. * Class ConfigGroupService
  20. * @package App\Services\Common
  21. */
  22. class ConfigGroupService extends BaseService
  23. {
  24. /**
  25. * 构造函数
  26. * @author laravel开发员
  27. * @since 2020/11/11
  28. * ConfigGroupService constructor.
  29. */
  30. public function __construct()
  31. {
  32. $this->model = new ConfigGroupModel();
  33. }
  34. public function getList()
  35. {
  36. return parent::getList([],[['sort','desc']]); // TODO: Change the autogenerated stub
  37. }
  38. /**
  39. * 删除
  40. * @return array
  41. */
  42. public function delete()
  43. {
  44. $id = request()->get('id',0);
  45. $this->model->where(['mark'=>0])->delete();
  46. $result = parent::delete(); // TODO: Change the autogenerated stub
  47. $success = isset($result['success'])?$result['success']:false;
  48. if($id && $success){
  49. ConfigModel::where(['config_group_id'=>$id])->delete();
  50. }
  51. return $result;
  52. }
  53. }