ConfigGroupService.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\ActionLogModel;
  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. */
  41. public function delete()
  42. {
  43. // 设置日志标题
  44. ActionLogModel::setRecord(session('userId'), ['type' => 1, 'title' => "删除配置分组信息", 'content' => json_encode(request()->post(), 256), 'module' => 'admin']);
  45. ActionLogModel::record();
  46. $this->model->where('mark', 0)->where('update_time', '<=', time() - 7 * 86400)->delete();
  47. return parent::delete();
  48. }
  49. }