RecuperateApplyService.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Services\Recuperate;
  3. use App\Repositories\RecuperateApplyRepository;
  4. class RecuperateApplyService
  5. {
  6. protected $recuperateApplyRepository;
  7. public function __construct(RecuperateApplyRepository $recuperateApplyRepository)
  8. {
  9. $this->recuperateApplyRepository = $recuperateApplyRepository;
  10. }
  11. /**
  12. * 前台获取列表
  13. */
  14. public function list($status = null, $year=null,$page = '', $with = [])
  15. {
  16. //搜索条件
  17. $where = [];
  18. $where[] = ['uid', '=', auth('web-member')->id()];
  19. if (isset($status)) {
  20. $where[] = ['status', '=', $status];
  21. }
  22. if (isset($year)) {
  23. $where[] = ['recuperate_time_id', '=', $year];
  24. }
  25. //获取列表
  26. $list = $this->recuperateApplyRepository->getRecuperate($where, $page, $with);
  27. return $list;
  28. }
  29. /**
  30. * 获取前台显示信息
  31. */
  32. public function getRecuperateInfo($id)
  33. {
  34. $where = ['id' => $id];
  35. $article_info = $this->recuperateApplyRepository->firstWhere($where);
  36. return $article_info;
  37. }
  38. /**
  39. * 添加数据
  40. */
  41. public function create($attr)
  42. {
  43. return $this->recuperateApplyRepository->createApply($attr);
  44. }
  45. }