BuyhouseController.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace App\Http\Controllers\Web\Content;
  3. use App\Http\Controllers\Web\WebBaseController;
  4. use App\Services\Content\ArticleService;
  5. use App\Services\Content\ArticleCategoryService;
  6. use App\Services\Content\AdService;
  7. use App\Services\Content\NavigationService;
  8. use Illuminate\Http\Request;
  9. use Illuminate\Support\Facades\Cache;
  10. use Illuminate\Support\Collection;
  11. class BuyhouseController extends WebBaseController
  12. {
  13. private $street = [
  14. '青阳街道', '梅岭街道', '西园街道', '罗山街道', '灵源街道', '新塘街道', '陈埭镇', '池店镇', '安海镇', '磁灶镇', '内坑镇', '紫帽镇', '东石镇', '永和镇', '英林镇', '金井镇', '龙湖镇', '深沪镇', '西滨镇',
  15. ];
  16. protected $articleService;
  17. protected $articleCategoryService;
  18. protected $adService;
  19. protected $navigationService;
  20. /**
  21. * ArticleController constructor.
  22. * @param $articleService
  23. * @param $articleCategoryService
  24. */
  25. public function __construct(ArticleService $articleService, ArticleCategoryService $articleCategoryService, AdService $adService, NavigationService $navigationService)
  26. {
  27. $this->articleService = $articleService;
  28. $this->articleCategoryService = $articleCategoryService;
  29. $this->adService = $adService;
  30. $this->navigationService = $navigationService;
  31. }
  32. public function list(Request $request)
  33. {
  34. $list = [
  35. [
  36. 'id' => 1,
  37. 'status' => '进行中',
  38. 'project' => '永隆江滨城',
  39. 'declare_time' => '2021-01-05 至 2021-02-01',
  40. 'address' => '晋新路与拥军路交汇处往北500米',
  41. 'apply_time' => '2021-01-05 至 2021-02-01',
  42. 'describe' => '这是项目的描述',
  43. ]
  44. ];
  45. $return_data = [
  46. 'list' => json_encode($list),
  47. 'street' => json_encode($this->street),
  48. ];
  49. return view('app.content.buyhouse.list', $return_data);
  50. }
  51. public function click($id)
  52. {
  53. $rst = $this->articleService->incrementData(['id' => $id], 1, 'click');
  54. $data = ['status' => 0];
  55. if ($rst) {
  56. $data = ['status' => 1];
  57. }
  58. return response()->json($data);
  59. }
  60. }