routes.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. //新版代理分享链接路由控制 2018-12-08 anton liu
  3. if (isset($_GET['invita']) && !empty($_GET['invita'])) {
  4. \Biz\Account\Invite::init()->setInvitaId($_GET['invita']);
  5. if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
  6. $uri = 'https://'.$_SERVER['HTTP_HOST'];
  7. } else {
  8. $uri = 'http://'.$_SERVER['HTTP_HOST'];
  9. }
  10. if(is_mobile()){ //手机
  11. $link = lm('setinfo', 'commons')->select('infocontent')->where('infotype', 2005)->first();
  12. if(strpos($link->infocontent,'http') !== false || strpos($link->infocontent,'https') !== false)
  13. {
  14. $uri = $link->infocontent;
  15. header("Location:".$uri."?invita=".$_GET['invita']);
  16. exit();
  17. }else{
  18. if($link->infocontent){
  19. header("Location:".$uri.$link->infocontent."?invita=".$_GET['invita']);
  20. exit();
  21. }else{
  22. header("Location:".$uri."/m/#/shareReg?invita=".$_GET['invita']);
  23. exit();
  24. }
  25. }
  26. }else{
  27. //pc版
  28. //获取是否开启分享推广页面
  29. $data = lm('setinfo', 'commons')->select('status')->where('infotype', 1024)->first();
  30. if($data->status == 1){
  31. header("Location:".$uri."/Home-Register/Share"); //分享
  32. exit();
  33. }elseif($data->status == 0){
  34. header("Location:".$uri."/Home-Register/Index"); //注册
  35. exit();
  36. }else{
  37. header("Location:".$uri."/Home-Index/Index"); // 首页
  38. exit();
  39. }
  40. }
  41. }
  42. if(isset($_GET['invite_id']) && intval($_GET['invite_id'])>0){
  43. \Biz\Account\Invite::init()->setInviteId(intval($_GET['invite_id']));
  44. }
  45. if (isset($_GET['invite']) && intval($_GET['invite']) > 0) {
  46. \Biz\Account\Invite::init()->setInviteId(intval($_GET['invite']));
  47. }
  48. // toDomain();
  49. Route::any("/close", function () {
  50. return appExec("api", "close", "CloseWeb");
  51. });
  52. Route::any("/login", function () {
  53. return appExec("Sports","Login","login");
  54. });
  55. Route::any("/rollingball", function () {
  56. return appExec("Sports","RollingBall","getrollingball");
  57. });
  58. Route::any("/time", function () {
  59. return appExec("api", "common", "getTime");
  60. });
  61. Route::any("/", function () {
  62. checkClose();
  63. header('location:/home-index/index');
  64. // dd(123);
  65. // header("Location:/web/index"); // 首页
  66. });
  67. Route::any("/pay", function () {
  68. return appExec("Payment", "Pay", "Index");
  69. });
  70. Route::any("/pay-(:any)", function ($method) {
  71. //toLog($_REQUEST);
  72. return appExec("Payment", "Pay", $method, 1);
  73. });
  74. Route::any("/prize", function () {
  75. return appExec("api", "prize", "prize");
  76. });
  77. //邀请路由
  78. Route::any("/invite/(:any)", function ($id) {
  79. //toLog($_REQUEST);
  80. \Biz\Account\Invite::init()->setInviteId(intval($id));
  81. if(is_mobile()){
  82. return appExec("Mobile", "Recommend", 'Index');
  83. }
  84. return appExec("Home", "Recommend", 'Index');
  85. });
  86. Route::any("/recommend/(:any)", function ($id) {
  87. //toLog($_REQUEST);
  88. \Biz\Account\Invite::init()->setInviteId(intval($id));
  89. if(is_mobile()){
  90. return appExec("Mobile", "Register", 'Index');
  91. }
  92. return appExec("Home", "Register", 'Index');
  93. });
  94. Route::any("/inprize", function () {
  95. return appExec("api", "prize", "pull");
  96. });
  97. Route::any("/open", function () {
  98. return appExec("api", "prize", "open");
  99. });
  100. Route::any("/dataSeeds", "App\Home\Controller\DataSeeds@Index");
  101. Route::any("/(:any)-(:any)/(:any)\.(:any)", function ($proj, $controller, $method, $format) {
  102. checkClose();
  103. S('CUR_RETURN_FORMAT', $format);
  104. return appExec($proj, $controller, $method);
  105. });
  106. Route::any("/(:any)-(:any)/(:any)", function ($proj, $controller, $method) {
  107. checkClose();
  108. return appExec($proj, $controller, $method);
  109. });
  110. Route::any("/(:any)/(:any)/(:any)\.(:any)", function ($proj, $controller, $method, $format) {
  111. checkClose();
  112. S('CUR_RETURN_FORMAT', $format);
  113. return appExec($proj, $controller, $method);
  114. });
  115. Route::any("/(:any)/(:any)/(:any)", function ($proj, $controller, $method) {
  116. checkClose();
  117. return appExec($proj, $controller, $method);
  118. });
  119. Route::any("/(:any)/(:any)/(:any)/", function ($proj, $controller, $method) {
  120. checkClose();
  121. return appExec($proj, $controller, $method);
  122. });
  123. //支付回调地址
  124. // Route::any("/(:any)/notify\.php", function ($paymentName) {
  125. // S('CUR_PAYMENT_NAME', $paymentName);
  126. // return appExec("Payment", "Pay", 'Notify');
  127. // });
  128. // Route::any("/(:any)/redirect\.php", function ($paymentName) {
  129. // S('CUR_PAYMENT_NAME', $paymentName);
  130. // return appExec("Payment", "Pay", 'Redirect');
  131. // });
  132. // Route::dispatch();