SensitiveChapterController.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Http\Controllers\Manage\BadInfo;
  3. use App\Http\Controllers\Controller;
  4. use App\Http\Controllers\Manage\BadInfo\Transformers\SensitiveChapterTransformer;
  5. use App\Modules\BadInfo\Services\SensitiveChapterService;
  6. use App\Modules\BadInfo\Services\BookSensitiveStatService;
  7. use App\Modules\Book\Services\ChapterService;
  8. use Illuminate\Http\Request;
  9. class SensitiveChapterController extends Controller
  10. {
  11. /**
  12. * 不良章节
  13. * @param Request $request
  14. * @return mixed
  15. */
  16. public function index(Request $request)
  17. {
  18. $bid = $request->has('bid') ? $request->input('bid') : null;
  19. $time = BookSensitiveStatService::getMaxTime();
  20. if(!$bid) return response()->error('PARAM_ERROR');
  21. $chapters = SensitiveChapterService::getListObj(compact('bid','time'))->paginate();
  22. foreach ($chapters as $chapter)
  23. {
  24. $chapter->content = ChapterService::getChapterById($chapter->cid)->content;
  25. }
  26. return response()->pagination(new SensitiveChapterTransformer(), $chapters);
  27. }
  28. }