web.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Web Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register web routes for your application. These
  8. | routes are loaded by the RouteServiceProvider within a group which
  9. | contains the "web" middleware group. Now create something great!
  10. |
  11. */
  12. $apiRoute = [
  13. /*
  14. * 画册路由
  15. */
  16. 'api/album/get-banner' => ['real' => 'Api/V1/Album/albumGetBanner','method'=>'get','auth'=>false],
  17. 'api/album/xyx_login' => ['real' => 'Api/V1/Album/albumXyxLogin','method'=>'post','auth'=>false],
  18. 'api/album/cat' => ['real' => 'Api/V1/Album/albumCat','method'=>'get','auth'=>false],
  19. 'api/album/setting' => ['real' => 'Api/V1/Album/albumSetting','method'=>'get','auth'=>false],
  20. 'api/album/customer-goods' => ['real' => 'Api/V1/Album/albumCustomerGoods','method'=>'post','auth'=>true],
  21. 'api/album/customer-goods-detail' => ['real' => 'Api/V1/Album/albumCustomerGoodsDetail','method'=>'post','auth'=>true],
  22. 'api/album/get-count-favorite' => ['real' => 'Api/V1/Album/albumGetCountOfFavorite','method'=>'post','auth'=>true],
  23. 'api/album_boss/get_top' => ['real' => 'Api/V1/AlbumBoss/getTop','method'=>'get','auth'=>true],
  24. 'api/album_boss/agent_customer' => ['real' => 'Api/V1/AlbumBoss/agentCustomer','method'=>'post','auth'=>true],
  25. 'api/album_boss/agent_statistical' => ['real' => 'Api/V1/AlbumBoss/agentStatistical','method'=>'post','auth'=>true],
  26. 'api/album_boss/agent_overview_active' => ['real' => 'Api/V1/AlbumBoss/albumOverviewActive','method'=>'post','auth'=>true],
  27. 'api/album_boss/agent_overview_left' => ['real' => 'Api/V1/AlbumBoss/albumOverviewLeft','method'=>'post','auth'=>true],
  28. 'api/album_boss/agent_overview_favorite' => ['real' => 'Api/V1/AlbumBoss/albumOverviewFavorite','method'=>'post','auth'=>true],
  29. 'api/album_boss/agent_overview_new' => ['real' => 'Api/V1/AlbumBoss/albumOverviewNew','method'=>'post','auth'=>true],
  30. 'api/album_boss/agent_analysis' => ['real' => 'Api/V1/AlbumBoss/agentAnalysis','method'=>'post','auth'=>true],
  31. 'api/album_boss/agent_overview_call' => ['real' => 'Api/V1/AlbumBoss/albumOverviewCall','method'=>'post','auth'=>true],
  32. 'api/album_boss/agent_overview_funnel' => ['real' => 'Api/V1/AlbumBoss/albumOverviewFunnel','method'=>'post','auth'=>true],
  33. 'api/album_boss/boss_interactive' => ['real' => 'Api/V1/AlbumBoss/BossInteractive','method'=>'get','auth'=>true],
  34. 'api/album/get_data_goods' => ['real' => 'Api/V1/Album/albumGetDataGoods','method'=>'post','auth'=>true],
  35. 'api/album_post/info' => ['real' => 'Api/V1/AlbumPoster/posterInfo','method'=>'post','auth'=>true],
  36. 'api/album_post/download' => ['real' => 'Api/V1/AlbumPoster/posterDownload','method'=>'post','auth'=>true],
  37. 'api/album/get-customer' => ['real' => 'Api/V1/Album/albumGetCustomer','method'=>'get','auth'=>true],
  38. 'api/album/set-customer' => ['real' => 'Api/V1/Album/albumSetCustomer','method'=>'post','auth'=>true],
  39. 'api/album/statistical' => ['real' => 'Api/V1/Album/albumStatistical','method'=>'post','auth'=>true],
  40. 'api/album/get_statistical' => ['real' => 'Api/V1/Album/albumGetStatistical','method'=>'post','auth'=>true],
  41. 'api/album/get_data_cat' => ['real' => 'Api/V1/Album/albumGetDataCat','method'=>'post','auth'=>true],
  42. 'api/album/get_data_cat_single' => ['real' => 'Api/V1/Album/albumGetDataCatSingle','method'=>'post','auth'=>true],
  43. 'api/album/favorite_list' => ['real' => 'Api/V1/Album/albumFavoriteList','method'=>'get','auth'=>true],
  44. 'api/album/favorite_del' => ['real' => 'Api/V1/Album/albumFavoriteDel','method'=>'get','auth'=>true],
  45. 'api/album/get_user_info' => ['real' => 'Api/V1/Album/albumGetUserInfo','method'=>'get','auth'=>true],
  46. 'api/album/goods' => ['real' => 'Api/V1/Album/albumGoods','method'=>'get','auth'=>true],
  47. 'api/album/goods-detail' => ['real' => 'Api/V1/Album/albumGoodsDetail','method'=>'get','auth'=>true],
  48. 'api/album/set-price' => ['real' => 'Api/V1/Album/albumSetPrice','method'=>'get','auth'=>true],
  49. 'api/album/agent_price_set' => ['real' => 'Api/V1/Album/albumAgentPriceSet','method'=>'post','auth'=>true],
  50. 'api/album/content_list' => ['real' => 'Api/V1/Album/albumContentList','method'=>'get','auth'=>true],
  51. 'api/album/content_detail' => ['real' => 'Api/V1/Album/albumContentDetail','method'=>'get','auth'=>true],
  52. 'api/album/set-phone' => ['real' => 'Api/V1/Album/albumSavePhone','method'=>'post','auth'=>true],
  53. 'api/album/add_agent' => ['real' => 'Api/V1/Album/albumAddAgent','method'=>'post','auth'=>true],
  54. 'api/album/get-cart-of-watch' => ['real' => 'Api/V1/Album/albumGetCartOfWatch','method'=>'post','auth'=>true],
  55. 'api/album/get-watch-recored' => ['real' => 'Api/V1/Album/albumGetWatchRecord','method'=>'post','auth'=>true],
  56. 'api/album/set-watch' => ['real' => 'Api/V1/Album/albumSetWatch','method'=>'post','auth'=>true],
  57. 'api/album/save_form_id' => ['real' => 'Api/V1/Album/albumSaveFormId','method'=>'post','auth'=>true],
  58. 'api/album/search_goods' => ['real' => 'Api/V1/Album/albumSearchGoods','method'=>'get','auth'=>true],
  59. 'api/album/add_favorite' => ['real' => 'Api/V1/Album/albumAddFavorite','method'=>'get','auth'=>true],
  60. 'api/album/get-agent-address' => ['real' => 'Api/V1/Album/albumGetAgentAdress','method'=>'get','auth'=>true],
  61. /*
  62. * 家具路由
  63. */
  64. 'api/attachment/upload' => ['real' => 'Api/V1/Attachment/upload','method'=>'post','auth'=>false],
  65. 'api/furniture/setting' => ['real' => 'Api/V1/Furniture/furnitureSetting','method'=>'get','auth'=>false],
  66. 'api/furniture/news_detail' => ['real' => 'Api/V1/Furniture/furnitureNewsDetail','method'=>'get','auth'=>false],
  67. 'api/furniture/news_list' => ['real' => 'Api/V1/Furniture/furnitureNewsList','method'=>'get','auth'=>false],
  68. 'api/furniture/goods_list' => ['real' => 'Api/V1/Furniture/furnitureGoodsList','method'=>'get','auth'=>false],
  69. 'api/furniture/service_login' => ['real' => 'Api/V1/Furniture/serviceLogin','method'=>'post','auth'=>false],
  70. 'api/furniture/getfurnitureads' => ['real' => 'Api/V1/Furniture/getFurnitureAds','method'=>'get','auth'=>false],
  71. 'api/furniture/newgoods_list' => ['real' => 'Api/V1/Furniture/newgoods_list','method'=>'get','auth'=>false],
  72. 'api/furniture/newgoods_index' => ['real' => 'Api/V1/Furniture/newgoods_index','method'=>'get','auth'=>false],
  73. 'api/furniture/getattr' => ['real' => 'Api/V1/Furniture/getAttr','method'=>'get','auth'=>true],
  74. 'api/furniture/add_comments' => ['real' => 'Api/V1/Furniture/furnitureAddComments','method'=>'any','auth'=>true],
  75. 'api/furniture/createorder' => ['real' => 'Api/V1/Furniture/createOrder','method'=>'post','auth'=>true],
  76. 'api/furniture/getorder' => ['real' => 'Api/V1/Furniture/getOrder','method'=>'get','auth'=>true],
  77. 'api/furniture/getorderdetail' => ['real' => 'Api/V1/Furniture/getOrderDetail','method'=>'get','auth'=>true],
  78. 'api/furniture/getprogress' => ['real' => 'Api/V1/Furniture/getProgress','method'=>'get','auth'=>true],
  79. 'api/furniture/getreviewcount' => ['real' => 'Api/V1/Furniture/getReviewCount','method'=>'get','auth'=>true],
  80. 'api/furniture/addreview' => ['real' => 'Api/V1/Furniture/addReview','method'=>'post','auth'=>true],
  81. 'api/furniture/updatestatus' => ['real' => 'Api/V1/Furniture/updateStatus','method'=>'post','auth'=>true],
  82. 'api/furniture/getphonenumber' => ['real' => 'Api/V1/Furniture/getPhoneNumber','method'=>'post','auth'=>true],
  83. 'api/furniture/getqrcode' => ['real' => 'Api/V1/Furniture/getQrcode','method'=>'get','auth'=>true],
  84. 'api/furniture/ordercount' => ['real' => 'Api/V1/Furniture/orderCount','method'=>'get','auth'=>true],
  85. 'api/furniture/searchlist' => ['real' => 'Api/V1/Furniture/searchList','method'=>'get','auth'=>true],
  86. 'api/furniture/printorder' => ['real' => 'Api/V1/Furniture/printOrder','method'=>'any','auth'=>true],
  87. 'api/furniture/saveformid' => ['real' => 'Api/V1/Furniture/saveFormId','method'=>'post','auth'=>true],
  88. 'api/furniture/getmorecomments' => ['real' => 'Api/V1/Furniture/getMoreComments','method'=>'get','auth'=>true],
  89. 'api/furniture/addtolike' => ['real' => 'Api/V1/Furniture/addToLike','method'=>'get','auth'=>true],
  90. 'api/furniture/newgoods_addcomment' => ['real' => 'Api/V1/Furniture/newgoods_addcomment','method'=>'post','auth'=>true],
  91. 'api/furniture/newgoods_addbooking' => ['real' => 'Api/V1/Furniture/newgoods_addbooking','method'=>'post','auth'=>true],
  92. ];
  93. /*$auth = [
  94. 'Api/V1/Album/albumGoods' => 'post',
  95. 'Api/V1/Album/albumCustomerGoods' => 'post',
  96. 'Api/V1/Album/albumCustomerGoodsDetail' => 'post',
  97. 'Api/V1/Album/albumGetCountOfFavorite' => 'post',
  98. 'Api/V1/AlbumBoss/getTop' => 'post',
  99. 'Api/V1/AlbumBoss/agentCustomer' => 'post',
  100. 'Api/V1/AlbumBoss/agentStatistical' => 'post',
  101. 'Api/V1/AlbumBoss/albumOverviewActive' => 'post',
  102. 'Api/V1/Album/albumGoods' => 'post',
  103. 'Api/V1/Album/albumGoods' => 'post',
  104. ];*/
  105. Route::get('/addons/online_album/public/', [
  106. 'as' => 'attachment.download',
  107. 'uses' => 'Web\AttachmentController@download',
  108. ]);
  109. Route::get('image/{md5}', [
  110. 'as' => 'attachment.image',
  111. 'uses' => 'Web\AttachmentController@image',
  112. ]);
  113. if (request()->input('route') == 'geetest') {
  114. Route::any('/', 'Germey\Geetest\GeetestController@getGeetest');
  115. }
  116. //后台
  117. if (strpos(request()->getRequestUri(), '/addons/') !== false) {
  118. //如未设置当前公众号则加到选择公众号列表
  119. if (strpos(request()->getRequestUri(), 'Admin/Auth/Login/wxLogin') !== false) {
  120. session_start();
  121. if (empty($_SESSION['store_id']) || empty($_SESSION['wUser'])) {
  122. return redirect('../../../web/index.php?c=wxapp&a=display');
  123. }
  124. session()->forget('wUser');
  125. session()->forget('store_id');
  126. session()->put('store_id', $_SESSION['store_id']);
  127. session()->put('wUser', $_SESSION['wUser']);
  128. session()->put('groupid', $_SESSION['wUser']['groupid']);
  129. };
  130. if (strpos(request()->getRequestUri(), 'api') !== false) {
  131. //$api = app('Dingo\Api\Routing\Router');
  132. /* $api->version('v1', ['namespace' => 'App\Http\Controllers'], function ($api) {
  133. $api->group(['middleware' => ['auth.api']], function ($api) {*/
  134. // Furniture::parseRoute();
  135. //$route_url = $_SESSION['route'];
  136. $route_url = request()->input('route');
  137. if (isset($apiRoute[$route_url])) {
  138. $route_url_r = $apiRoute[$route_url]['real'];
  139. $route_url_r = ucfirst($route_url_r);
  140. $route = $baseRoute = explode('/',$route_url_r);
  141. if (count($route) > 1) {
  142. unset($route[count($route) - 1]);
  143. $file = app_path() . '/Http/Controllers/' . implode("/", $route) . "Controller.php";
  144. if (file_exists($file)) {
  145. $controller = implode("\\", $route) . "Controller";
  146. $action = $controller . "@" . $baseRoute[count($route)];
  147. if ($apiRoute[$route_url]['auth'] == true) {
  148. Route::middleware(['auth.api'])->group(function () use ($action, $route, $apiRoute, $route_url) {
  149. switch ($apiRoute[$route_url]['method']) {
  150. case 'get':
  151. Route::get('/', ['as' => $route[0],
  152. 'uses' => $action]);
  153. break;
  154. case 'post':
  155. Route::post('/', ['as' => $route[0],
  156. 'uses' => $action]);
  157. break;
  158. case 'any':
  159. Route::any('/', ['as' => $route[0],
  160. 'uses' => $action]);
  161. break;
  162. }
  163. });
  164. } else {
  165. switch ($apiRoute[$route_url]['method']) {
  166. case 'get':
  167. Route::get('/', ['as' => $route[0],
  168. 'uses' => $action]);
  169. break;
  170. case 'post':
  171. Route::post('/', ['as' => $route[0],
  172. 'uses' => $action]);
  173. break;
  174. case 'any':
  175. Route::any('/', ['as' => $route[0],
  176. 'uses' => $action]);
  177. break;
  178. }
  179. }
  180. }
  181. }
  182. }
  183. /* });
  184. });*/
  185. } else if (strpos(request()->getRequestUri(), 'Admin') !== false || strpos(request()->getRequestUri(), 'admin') !== false) {
  186. $route_url = request()->input('route');
  187. $route_url = ucfirst($route_url);
  188. $route = $baseRoute = explode('/',$route_url);
  189. if (count($route) > 1) {
  190. unset($route[count($route) - 1]);
  191. $file = app_path() . '/Http/Controllers/' . implode("/", $route) . "Controller.php";
  192. if (file_exists($file)) {
  193. $controller = implode("\\", $route) . "Controller";
  194. $action = $controller . "@" . $baseRoute[count($route)];
  195. Route::any('/', ['as' => $route[0],
  196. 'uses' => $action]);
  197. }
  198. }
  199. }
  200. }