index.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?php
  2. session_start();
  3. // 错误显示
  4. /*
  5. ini_set("display_errors","on");
  6. error_reporting(E_ALL|E_STRICT);
  7. */
  8. // 自动加载 composer
  9. require 'vendor/autoload.php';
  10. use AnkePano\conf\DBinfo;
  11. use AnkePano\model\Model;
  12. use AnkePano\model\GlobalModel;
  13. use AnkePano\control\Control;
  14. use AnkePano\control\UserControl;
  15. use AnkePano\control\HomeControl;
  16. use AnkePano\control\PanoControl;
  17. use AnkePano\control\UploadControl;
  18. use AnkePano\control\UrlControl;
  19. // 实例化Model,调用方法 Flight::Model();
  20. \Flight::register('model', 'AnkePano\model\Model');
  21. // 首页
  22. \Flight::route('GET /', function() {
  23. $c = new HomeControl();
  24. $c->index();
  25. });
  26. \Flight::route('GET /panoxml', function() {
  27. $c = new PanoControl();
  28. $c->panoxml();
  29. });
  30. \Flight::route('POST /pano/get_next_node', function() {
  31. $c = new PanoControl();
  32. $c->getCurrentPanoid();
  33. });
  34. // 热点
  35. \Flight::route('GET /pano/hotspot', function() {
  36. $c = new PanoControl();
  37. $c->getHotSpot();
  38. });
  39. // 图片服务介绍分享
  40. \Flight::route('GET /pano/img(/@src)', function($src="baoweichu.jpg") {
  41. $c = new PanoControl();
  42. $c->getserverimg($src);
  43. });
  44. // 全部分享
  45. \Flight::route('GET /pano/getallshare(/@page)', function($page=1) {
  46. $c = new PanoControl();
  47. if ($page == NULL) {
  48. $page = 1;
  49. }
  50. $c->getAllImageShare($page);
  51. });
  52. // 当前节点分享
  53. \Flight::route('GET /pano/get_cur_share(/@page)', function($page=1) {
  54. $c = new PanoControl();
  55. if ($page == NULL) {
  56. $page = 1;
  57. }
  58. if (@$_GET['curid']) {
  59. $curid = $_GET['curid'];
  60. }else{
  61. $curid = 11111;
  62. }
  63. $c->get_cur_share($page,intval($curid));
  64. });
  65. \Flight::route('GET /pano/getshare', function() {
  66. $c = new PanoControl();
  67. $c->panoShare();
  68. });
  69. // 显示图片详细信息
  70. \Flight::route('POST /pano/getImgInfo',function() {
  71. $pid = $_POST['pid'];
  72. $c = new PanoControl();
  73. $c->getImgInfo($pid);
  74. });
  75. // 显示服务
  76. \Flight::route('GET /pano/getserver',function() {
  77. $c = new PanoControl();
  78. $c->getServer();
  79. });
  80. // 首页
  81. \Flight::route('GET /pano', function() {
  82. $c = new PanoControl();
  83. $c->index();
  84. });
  85. // 晒图片 (上传)
  86. \Flight::route('POST /upload', function() {
  87. $c = new UploadControl();
  88. $c->upload();
  89. });
  90. // 晒照片 (数据库处理)
  91. \Flight::route('POST /share', function() {
  92. $c = new UploadControl();
  93. $c->share();
  94. });
  95. // 图书馆采集
  96. \Flight::route('GET /book/getbook', function() {
  97. $c = new UrlControl();
  98. $c->bookList();
  99. });
  100. \Flight::route('GET /book/detail/@no', function($no) {
  101. $c = new UrlControl();
  102. $c->bookDetail($no);
  103. });
  104. // 用户首页
  105. \Flight::route('GET /user/index',function() {
  106. $c = new UserControl();
  107. $c->index();
  108. });
  109. // 注销用户
  110. \Flight::route('GET /user/logout',function() {
  111. $c = new UserControl();
  112. $c->logout();
  113. });
  114. // 注册
  115. \Flight::route('POST /user/reg',function() {
  116. $username = $_POST['username'];
  117. $password = $_POST['password'];
  118. $c = new UserControl();
  119. $c->reg($username, $password);
  120. });
  121. // 登入验证
  122. \Flight::route('POST /user/login',function() {
  123. $username = $_POST['username'];
  124. $password = $_POST['password'];
  125. $c = new UserControl();
  126. $c->login($username, $password);
  127. });
  128. // 添加收藏
  129. \Flight::route('POST /user/like',function() {
  130. $pid = $_POST['pid'];
  131. $c = new UserControl();
  132. $c->like($pid);
  133. });
  134. // 添加关注
  135. \Flight::route('POST /user/addfocus',function() {
  136. $pid = $_POST['node'];
  137. $c = new UserControl();
  138. $c->addfocus($pid);
  139. });
  140. // 个人收藏
  141. \Flight::route('GET /user/collect',function() {
  142. $c = new UserControl();
  143. $c->usercollect();
  144. });
  145. \Flight::route('GET /user/focus',function() {
  146. $c = new UserControl();
  147. $c->userfocus();
  148. });
  149. \Flight::route('GET /user/schedule',function() {
  150. $c = new UserControl();
  151. $c->getschedule();
  152. });
  153. // 错误处理
  154. try {
  155. \Flight::start();
  156. } catch (Exception $e) {
  157. echo $e;
  158. }