Index.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace app\home\controller;
  3. use think\Lang;
  4. use think\Cache;
  5. use think\Request;
  6. use think\Controller;
  7. use think\Validate;
  8. use app\admin\model\IncInfo as IncInfoModel;
  9. /**
  10. * 主页管理类
  11. */
  12. class Index extends Common
  13. {
  14. /**
  15. * 构造函数
  16. *
  17. * @access public
  18. */
  19. public function __construct()
  20. {
  21. parent::__construct();
  22. }// end__construct()
  23. /**
  24. * 主页管理
  25. *
  26. * @access public
  27. * @return array JsonString
  28. */
  29. public function index()
  30. {
  31. $getHomeInformation = model('homeinformation')->getHomeInformation();
  32. $incData = IncInfoModel::get(1);
  33. $this->assign('information', $getHomeInformation);
  34. $this->assign('incData', $incData);
  35. $location = json_decode($incData->inc_location);
  36. $this->assign('lng', $location->lng);
  37. $this->assign('lat', $location->lat);
  38. return $this->fetch();
  39. }
  40. public function isLogin()
  41. {
  42. $userId = session('user_id');
  43. if ($userId) {
  44. return ["success"=>true];
  45. } else {
  46. return ["success"=>false];
  47. }
  48. }//end index()
  49. }