MenuModel.class.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Seller\Model;
  15. class MenuModel{
  16. /**
  17. * 获取 全部菜单带路由
  18. * @param bool $full 是否返回长URL
  19. * @return array
  20. */
  21. public function getMenu($full = false)
  22. {
  23. $return_menu = array();
  24. $return_submenu = array();
  25. $action_name = ACTION_NAME;
  26. if( !empty($action_name) )
  27. {
  28. $route = strtolower(CONTROLLER_NAME).'.'.ACTION_NAME;
  29. }else{
  30. $route = strtolower(CONTROLLER_NAME);
  31. }
  32. $routes = explode('.', $route);
  33. $top = (empty($routes[0]) ? 'shop' : $routes[0]);
  34. $allmenus = $this->shopMenu();
  35. if ($routes[0] == 'system') {
  36. $top = $routes[1];
  37. }
  38. if( in_array(strtolower(CONTROLLER_NAME) , array('weprogram','configpay','express','logistics','shipping','configindex','copyright') ))
  39. {
  40. $top = 'config';
  41. }
  42. if (!empty($allmenus)) {
  43. $submenu = $allmenus[$top];
  44. foreach ($allmenus as $key => $val) {
  45. $menu_item = array('route' => empty($val['route']) ? $key : $val['route'], 'text' => $val['title'], 'subtitle' => $val['subtitle']);
  46. if ($routes[0] == 'system') {
  47. //$menu_item['route'] = 'system.' . $menu_item['route'];
  48. }
  49. if( isset($val['items']) )
  50. {
  51. $menu_item['items'] = $val['items'];
  52. }
  53. if (!empty($val['index'])) {
  54. $menu_item['index'] = $val['index'];
  55. }
  56. if (!empty($val['param'])) {
  57. $menu_item['param'] = $val['param'];
  58. }
  59. if (!empty($val['icon'])) {
  60. $menu_item['icon'] = $val['icon'];
  61. if (!empty($val['iconcolor'])) {
  62. $menu_item['iconcolor'] = $val['iconcolor'];
  63. }
  64. }
  65. if ($this->verifyParam($val) ) {
  66. $menu_item['active'] = 1;
  67. }
  68. if ($full) {
  69. //$menu_item['url'] = U($menu_item['route'], !empty($menu_item['param']) && is_array($menu_item['param']) ? $menu_item['param'] : array());
  70. }
  71. $return_menu[] = $menu_item;
  72. }
  73. unset($key);
  74. unset($val);
  75. if (!empty($submenu)) {
  76. $return_submenu['subtitle'] = $submenu['subtitle'];
  77. if ($submenu['main']) {
  78. $return_submenu['route'] = $top;
  79. if (is_string($submenu['main'])) {
  80. //$return_submenu['route'] .= '.' . $submenu['main'];
  81. }
  82. }
  83. if (!empty($submenu['index'])) {
  84. //$return_submenu['route'] = $top . '.' . $submenu['index'];
  85. }
  86. if (!empty($submenu['items'])) {
  87. //var_dump($submenu['items']);die();
  88. foreach ($submenu['items'] as $i => $child) {
  89. if (!empty($child['top'])) {
  90. $top = '';
  91. }
  92. if (empty($child['items'])) {
  93. $return_submenu_default = $top . '';
  94. $route_second = $top;
  95. if (!empty($child['route'])) {
  96. if (!empty($top)) {
  97. $route_second .= '.';
  98. }
  99. $route_second .= $child['route'];
  100. }
  101. $return_menu_child = array('title' => $child['title'], 'route' => $child['route']);
  102. if (!empty($child['param'])) {
  103. $return_menu_child['param'] = $child['param'];
  104. }
  105. if (!empty($child['perm'])) {
  106. $return_menu_child['perm'] = $child['perm'];
  107. }
  108. if (!empty($child['permmust'])) {
  109. $return_menu_child['permmust'] = $child['permmust'];
  110. }
  111. if ($routes[0] == 'system') {
  112. //$return_menu_child['route'] = 'system.' . $return_menu_child['route'];
  113. }
  114. $addedit = false;
  115. if (!$child['route_must']) {
  116. if ((($return_menu_child['route'] . '.add') == $route) || (($return_menu_child['route'] . '.edit') == $route)) {
  117. $addedit = true;
  118. }
  119. }
  120. $extend = false;
  121. if (!empty($child['extend'])) {
  122. if ((($child['extend'] . '.add') == $route) || (($child['extend'] . '.edit') == $route) || ($child['extend'] == $route)) {
  123. $extend = true;
  124. }
  125. }
  126. else {
  127. if (!empty($child['extends']) && is_array($child['extends'])) {
  128. if (in_array($route, $child['extends']) || in_array($route . '.add', $child['extends']) || in_array($route . '.edit', $child['extends'])) {
  129. $extend = true;
  130. }
  131. }
  132. }
  133. if ($this->verifyParam($return_menu_child, false) ) {
  134. $return_menu_child['active'] = 1;
  135. }
  136. if ($full) {
  137. //$return_menu_child['url'] = U($return_menu_child['route'], !empty($return_menu_child['param']) && is_array($return_menu_child['param']) ? $return_menu_child['param'] : array());
  138. }
  139. //if (!empty($return_menu_child['permmust']) && !$this->cv($return_menu_child['permmust'])) {
  140. // continue;
  141. //}
  142. //if (!$this->cv($return_menu_child['route'])) {
  143. // if (empty($return_menu_child['perm']) || !$this->cv($return_menu_child['perm'])) {
  144. // continue;
  145. // }
  146. //}
  147. $return_submenu['items'][] = $return_menu_child;
  148. unset($return_submenu_default);
  149. unset($route_second);
  150. }
  151. else {
  152. $return_menu_child = array(
  153. 'title' => $child['title'],
  154. 'items' => array()
  155. );
  156. foreach ($child['items'] as $ii => $three) {
  157. $return_submenu_default = $top . '';
  158. $route_second = 'main';
  159. if (!empty($child['route'])) {
  160. $return_submenu_default = $top . '.' . $child['route'];
  161. $route_second = $child['route'];
  162. }
  163. $return_submenu_three = array('title' => $three['title']);
  164. $return_submenu_three['route'] = $three['route'];
  165. if ($this->verifyParam($three,false) ) {
  166. $return_submenu_three['active'] = 1;
  167. }
  168. if (!empty($three['route'])) {
  169. if (!empty($child['route'])) {
  170. if (!empty($three['route_ns'])) {
  171. //$return_submenu_three['route'] = $top . '.' . $three['route'];
  172. }
  173. else {
  174. // $return_submenu_three['route'] = $top . '.' . $child['route'] . '.' . $three['route'];
  175. }
  176. }
  177. else {
  178. if (!empty($three['top'])) {
  179. //$return_submenu_three['route'] = $three['route'];
  180. }
  181. else {
  182. //$return_submenu_three['route'] = $top . '.' . $three['route'];
  183. }
  184. $route_second = $three['route'];
  185. }
  186. }
  187. else {
  188. //$return_submenu_three['route'] = $return_submenu_default;
  189. }
  190. if (!empty($three['param'])) {
  191. $return_submenu_three['param'] = $three['param'];
  192. }
  193. if (!empty($three['perm'])) {
  194. $return_submenu_three['perm'] = $three['perm'];
  195. }
  196. if (!empty($three['permmust'])) {
  197. $return_submenu_three['permmust'] = $three['permmust'];
  198. }
  199. if ($routes[0] == 'system') {
  200. ///$return_submenu_three['route'] = 'system.' . $return_submenu_three['route'];
  201. }
  202. $addedit = false;
  203. if (!$three['route_must']) {
  204. if ((($return_submenu_three['route'] . '.add') == $route) || (($return_submenu_three['route'] . '.edit') == $route)) {
  205. $addedit = true;
  206. }
  207. }
  208. $extend = false;
  209. if (!empty($three['extend'])) {
  210. if ((($three['extend'] . '.add') == $route) || (($three['extend'] . '.edit') == $route) || ($three['extend'] == $route)) {
  211. $extend = true;
  212. }
  213. }
  214. else {
  215. if (!empty($three['extends']) && is_array($three['extends'])) {
  216. if (in_array($route, $three['extends']) || in_array($route . '.add', $three['extends']) || in_array($route . '.edit', $three['extends'])) {
  217. $extend = true;
  218. }
  219. }
  220. }
  221. if ($three['route_in'] && strexists($route, $return_submenu_three['route'])) {
  222. $return_menu_child['active'] = 1;
  223. $return_submenu_three['active'] = 1;
  224. }
  225. else {
  226. if (($return_submenu_three['route'] == $route) || $addedit || $extend) {
  227. //if ($this->verifyParam($three)) {
  228. $return_menu_child['active'] = 1;
  229. $return_submenu_three['active'] = 1;
  230. //}
  231. }
  232. }
  233. if (!empty($child['extend'])) {
  234. if ($child['extend'] == $route) {
  235. $return_menu_child['active'] = 1;
  236. }
  237. }
  238. else {
  239. if (is_array($child['extends'])) {
  240. if (in_array($route, $child['extends'])) {
  241. $return_menu_child['active'] = 1;
  242. }
  243. }
  244. }
  245. if ($full) {
  246. //$return_submenu_three['url'] = U($return_submenu_three['route'], !empty($return_submenu_three['param']) && is_array($return_submenu_three['param']) ? $return_submenu_three['param'] : array());
  247. }
  248. // if (!empty($return_submenu_three['permmust']) && !$this->cv($return_submenu_three['permmust'])) {
  249. // continue;
  250. // }
  251. // if (!$this->cv($return_submenu_three['route'])) {
  252. // if (empty($return_submenu_three['perm']) || !$this->cv($return_submenu_three['perm'])) {
  253. // continue;
  254. // }
  255. //}
  256. $return_menu_child['items'][] = $return_submenu_three;
  257. }
  258. if (!empty($child['items']) && empty($return_menu_child['items'])) {
  259. continue;
  260. }
  261. $return_menu_child['is_show_list'] = $child['is_hide_child'];
  262. $return_submenu['items'][] = $return_menu_child;
  263. unset($ii);
  264. unset($three);
  265. unset($route_second);
  266. }
  267. }
  268. }
  269. }
  270. }
  271. return array('menu' => $return_menu, 'submenu' => $return_submenu, 'shopmenu' => array());
  272. }
  273. protected function verifyParam($item = array(),$is_first = true)
  274. {
  275. $action_name = ACTION_NAME;
  276. if( !empty($action_name) )
  277. {
  278. $route = strtolower(CONTROLLER_NAME).'/'.ACTION_NAME;
  279. }else{
  280. $route = strtolower(CONTROLLER_NAME);
  281. }
  282. $return = false;
  283. $item_controller_action = $item['route'];
  284. $item_controller_action_arr = explode('/', $item_controller_action);
  285. if($is_first)
  286. {
  287. //weprogram
  288. //weprogram array('weprogram','configpay','configindex','copyright')
  289. //特殊菜单
  290. if( in_array(strtolower(CONTROLLER_NAME) , array('weprogram','configpay','configindex','copyright') ))
  291. {
  292. if($item_controller_action_arr[0] == 'config')
  293. {
  294. $return = true;
  295. }
  296. }
  297. //一级菜单
  298. if($item_controller_action_arr[0] == strtolower(CONTROLLER_NAME))
  299. {
  300. $return = true;
  301. }
  302. //var_dump($item_controller_action_arr[0] , strtolower(CONTROLLER_NAME) );die();
  303. }else{
  304. if($item_controller_action == $route)
  305. {
  306. $return = true;
  307. }
  308. }
  309. /**
  310. array(5) { ["title"]=> string(6) "概况" ["icon"]=> string(5) "index"
  311. ["subtitle"]=> string(12) "概况信息" ["route"]=> string(5) "index"
  312. ["items"]=> array(1) { [0]=> array(2) { ["title"]=> string(6) "统计" ["route"]=> string(5) "index" } } }
  313. **/
  314. return $return;
  315. }
  316. /**
  317. * 定义 商城 菜单
  318. * @return array
  319. */
  320. public function shopMenu()
  321. {
  322. $shopmenu_2 = array(
  323. 'index' => array(
  324. 'title' => '概况',
  325. 'icon' => 'index',
  326. 'subtitle' => '概况信息',
  327. 'route' => 'index/analys',
  328. 'items' => array(
  329. array('title' => '统计', 'route' => 'index/analys'),
  330. )
  331. ),
  332. 'goods' => array(
  333. 'title' => '商品',
  334. 'subtitle' => '商品管理',
  335. 'icon' => 'goods',
  336. 'route' => 'goods/index',
  337. 'items' => array(
  338. array('title' => '商品列表', 'route' => 'goods/index'),
  339. array('title' => '商品分类', 'route' => 'goods/goodscategory'),
  340. array('title' => '商品规格', 'route' => 'goods/goodsspec'),
  341. array('title' => '商品标签', 'route' => 'goods/goodstag'),
  342. //array('title' => '虚拟评价', 'route' => 'goods/goodsvircomment'),
  343. //array('title' => '商品设置', 'route' => 'goods/config'),
  344. array(
  345. 'title' => '商品设置',
  346. 'route' => 'goods/config',
  347. 'items' => array(
  348. array('title' => '基本设置', 'route' => 'goods/config', 'desc' => ''),
  349. array('title' => '统一时间', 'route' => 'goods/settime', 'desc' => ''),
  350. array('title' => '工商资质', 'route' => 'goods/industrial', 'desc' => '')
  351. ),
  352. ),
  353. )
  354. ),
  355. 'order' => array(
  356. 'title' => '订单',
  357. 'subtitle' => '订单管理',
  358. 'icon' => 'order',
  359. 'route' => 'order/index',
  360. 'items' => array(
  361. array('title' => '订单列表', 'route' => 'order/index', 'desc' => ''),
  362. array('title' => '批量发货', 'route' => 'order/ordersendall', 'desc' => ''),
  363. array(
  364. 'title' => '配送管理',
  365. 'route' => 'orderdistribution/index',
  366. 'items' => array(
  367. array('title' => '配送员管理', 'route' => 'orderdistribution/index', 'desc' => ''),
  368. //array('title' => '配送订单管理', 'route' => 'orderdistribution/orderlist', 'desc' => ''),
  369. array('title' => '配送设置', 'route' => 'orderdistribution/distributionconfig', 'desc' => ''),
  370. ),
  371. ),
  372. array(
  373. 'title' => '提现管理',
  374. 'route' => 'orderdistribution/withdrawallist',
  375. 'items' => array(
  376. array('title' => '提现列表', 'route' => 'orderdistribution/withdrawallist', 'desc' => ''),
  377. array('title' => '提现设置', 'route' => 'orderdistribution/withdrawalconfig', 'desc' => ''),
  378. ),
  379. ),
  380. array(
  381. 'title' => '售后管理',
  382. 'route' => 'order/orderaftersales',
  383. 'items' => array(
  384. array('title' => '售后订单', 'route' => 'order/orderaftersales', 'desc' => ''),
  385. )
  386. ),
  387. array(
  388. 'title' => '评价管理',
  389. 'route' => 'order/ordercomment',
  390. 'items' => array(
  391. array('title' => '评价列表', 'route' => 'order/ordercomment', 'desc' => ''),
  392. array('title' => '评价有礼', 'route' => 'order/ordercomment_gift', 'desc' => ''),
  393. array('title' => '评价设置', 'route' => 'order/ordercomment_config', 'desc' => '')
  394. ),
  395. ),
  396. array('title' => '订单设置', 'route' => 'order/config', 'desc' => ''),
  397. array(
  398. 'title' => '打印机设置',
  399. 'route' => 'printer/index',
  400. 'items' => array(
  401. array('title' => '打印机列表', 'route' => 'printer/index', 'desc' => ''),
  402. array('title' => '打印机设置', 'route' => 'printer/config', 'desc' => '')
  403. ),
  404. ),
  405. ),
  406. ),
  407. 'user' => array(
  408. 'title' => '会员',
  409. 'subtitle' => '会员管理',
  410. 'icon' => 'user',
  411. 'route' => 'user/index',
  412. 'items' => array(
  413. array('title' => '会员列表', 'route' => 'user/index', 'desc' => ''),
  414. array('title' => '虚拟会员', 'route' => 'user/userjia', 'desc' => ''),
  415. array('title' => '会员设置', 'route' => 'user/config', 'desc' => ''),
  416. array('title' => '会员分组', 'route' => 'user/usergroup', 'desc' => ''),
  417. array('title' => '会员等级', 'route' => 'user/userlevel', 'desc' => ''),
  418. array(
  419. 'title' => '会员分销',
  420. 'route' => 'distribution/distribution',
  421. 'items' => array(
  422. array('title' => '分销列表', 'route' => 'distribution/distribution', 'desc' => ''),
  423. array('title' => '订单管理', 'route' => 'distribution/distributionorder', 'desc' => ''),
  424. array('title' => '分销设置', 'route' => 'distribution/config', 'desc' => ''),
  425. array('title' => '海报设置', 'route' => 'distribution/qrcodeconfig', 'desc' => ''),
  426. array('title' => '提现列表', 'route' => 'distribution/withdrawallist', 'desc' => ''),
  427. array('title' => '提现设置', 'route' => 'distribution/withdraw_config', 'desc' => ''),
  428. )
  429. ),
  430. )
  431. ),
  432. 'communityhead' => array(
  433. 'title' => '团长',
  434. 'subtitle' => '团长管理',
  435. 'icon' => 'communityhead',
  436. 'route' => 'communityhead/index',
  437. 'items' => array(
  438. array('title' => '团长列表', 'route' => 'communityhead/index', 'desc' => ''),
  439. array('title' => '团长分组', 'route' => 'communityhead/usergroup', 'desc' => ''),
  440. array('title' => '团长等级', 'route' => 'communityhead/headlevel', 'desc' => ''),
  441. array('title' => '团长设置', 'route' => 'communityhead/config', 'desc' => ''),
  442. array(
  443. 'title' => '提现管理',
  444. 'route' => 'communityhead/distribulist',
  445. 'items' => array(
  446. array('title' => '提现列表', 'route' => 'communityhead/distribulist', 'desc' => ''),
  447. array('title' => '提现设置', 'route' => 'communityhead/distributionpostal', 'desc' => ''),
  448. )
  449. ),
  450. ),
  451. ),
  452. 'salesroom' => array(
  453. 'title' => '门店',
  454. 'subtitle' => '门店管理',
  455. 'icon' => 'supply',
  456. 'route' => 'salesroom/index',
  457. 'items' => array(
  458. array('title' => '门店列表', 'route' => 'salesroom/index', 'desc' => ''),
  459. array('title' => '核销人员', 'route' => 'salesroom_member/index', 'desc' => ''),
  460. array('title' => '核销订单记录', 'route' => 'salesroom_order/index', 'desc' => ''),
  461. ),
  462. ),
  463. 'supply' => array(
  464. 'title' => '供应商',
  465. 'subtitle' => '供应商管理',
  466. 'icon' => 'supply',
  467. 'route' => 'supply/index',
  468. 'items' => array(
  469. array('title' => '供应商列表', 'route' => 'supply/index', 'desc' => ''),
  470. array('title' => '提现申请', 'route' => 'supply/admintixianlist', 'desc' => ''),
  471. array('title' => '提现设置', 'route' => 'supply/distributionpostal', 'desc' => ''),
  472. //array('title' => '供应商设置', 'route' => 'supply/config', 'desc' => ''),
  473. array(
  474. 'title' => '供应商设置',
  475. 'route' => 'supply/baseconfig',
  476. 'items' => array(
  477. array('title' => '基本设置', 'route' => 'supply/baseconfig', 'desc' => ''),
  478. array('title' => '申请页面内容', 'route' => 'supply/config', 'desc' => ''),
  479. array('title' => '供应商权限设置', 'route' => 'supply/authority', 'desc' => '')
  480. ),
  481. ),
  482. ),
  483. ),
  484. 'group' => array(
  485. 'title' => '拼团',
  486. 'subtitle' => '拼团管理',
  487. 'icon' => 'pin',
  488. 'route' => 'group/goods',
  489. 'items' => array(
  490. array('title' => '商品管理', 'route' => 'group/goods', 'desc' => ''),
  491. array('title' => '商品分类', 'route' => 'group/goodscategory', 'desc' => ''),
  492. array('title' => '商品规格', 'route' => 'group/goodsspec', 'desc' => ''),
  493. array('title' => '商品标签', 'route' => 'group/goodstag', 'desc' => ''),
  494. array('title' => '虚拟评价', 'route' => 'group/goodsvircomment', 'desc' => ''),
  495. array('title' => '拼团管理', 'route' => 'group/pintuan', 'desc' => ''),
  496. array('title' => '订单管理', 'route' => 'group/orderlist', 'desc' => ''),
  497. array('title' => '批量发货', 'route' => 'group/ordersendall', 'desc' => ''),
  498. array('title' => '售后管理', 'route' => 'group/orderaftersales', 'desc' => ''),
  499. array('title' => '幻灯片', 'route' => 'group/slider', 'desc' => ''),
  500. array('title' => '拼团设置', 'route' => 'group/config', 'desc' => ''),
  501. array('title' => '拼团佣金', 'route' => 'group/pincommiss', 'desc' => ''),
  502. array('title' => '提现列表', 'route' => 'group/withdrawallist', 'desc' => ''),
  503. array('title' => '提现设置', 'route' => 'group/withdraw_config', 'desc' => ''),
  504. )
  505. ),
  506. 'generalmall' => array(
  507. 'title' => '仅快递',
  508. 'subtitle' => '仅快递管理',
  509. 'icon' => 'store',
  510. 'route' => 'generalmall/slider',
  511. 'items' => array(
  512. array('title' => '幻灯片', 'route' => 'generalmall/slider', 'desc' => ''),
  513. array('title' => '导航图标', 'route' => 'generalmall/navigat', 'desc' => ''),
  514. ),
  515. ),
  516. 'article' => array(
  517. 'title' => '文章',
  518. 'subtitle' => '文章管理',
  519. 'icon' => 'discovery',
  520. 'route' => 'article/index',
  521. 'items' => array(
  522. array('title' => '文章列表', 'route' => 'article/index', 'desc' => ''),
  523. )
  524. ),
  525. 'marketing' => array(
  526. 'title' => '营销',
  527. 'subtitle' => '营销活动',
  528. 'icon' => 'marketing',
  529. 'route' => 'marketing/coupon',
  530. 'items' => array(
  531. array(
  532. 'title' => '优惠券管理',
  533. 'route' => 'marketing/coupon',
  534. 'items' => array(
  535. array('title' => '优惠券', 'route' => 'marketing/coupon', 'desc' => ''),
  536. array('title' => '优惠券分类', 'route' => 'marketing/category', 'desc' => ''),
  537. array('title' => '手动发送', 'route' => 'marketing/send', 'desc' => ''),
  538. )
  539. ),
  540. array('title' => '满减', 'route' => 'marketing/fullreduction', 'desc' => ''),
  541. array(
  542. 'title' => '积分',
  543. 'route' => 'marketing/signinreward',
  544. 'items' => array(
  545. array('title' => '积分签到', 'route' => 'marketing/signinreward', 'desc' => ''),
  546. array('title' => '积分商品', 'route' => 'points/goods', 'desc' => ''),
  547. array('title' => '兑换订单', 'route' => 'points/order', 'desc' => ''),
  548. array('title' => '积分设置', 'route' => 'marketing/points', 'desc' => ''),
  549. )
  550. ),
  551. array('title' => '弹窗广告', 'route' => 'popadv/index', 'desc' => ''),
  552. array('title' => '广告图片', 'route' => 'advimg/add', 'desc' => ''),
  553. array('title' => '整点秒杀', 'route' => 'marketing/seckill', 'desc' => ''),
  554. array(
  555. 'title' => '菜谱',
  556. 'route' => 'recipe/index',
  557. 'items' => array(
  558. array('title' => '菜谱管理', 'route' => 'recipe/index', 'desc' => ''),
  559. array('title' => '菜谱分类', 'route' => 'recipe/category', 'desc' => ''),
  560. array('title' => '幻灯片', 'route' => 'recipe/slider', 'desc' => ''),
  561. array('title' => '菜谱设置', 'route' => 'recipe/config', 'desc' => ''),
  562. )
  563. ),
  564. array(
  565. 'title' => '群接龙',
  566. 'route' => 'solitaire/index',
  567. 'items' => array(
  568. array('title' => '活动管理', 'route' => 'solitaire/index', 'desc' => ''),
  569. array('title' => '活动设置', 'route' => 'solitaire/config', 'desc' => ''),
  570. )
  571. ),
  572. array(
  573. 'title' => '充值',
  574. 'route' => 'marketing/recharge',
  575. 'items' => array(
  576. array('title' => '充值设置', 'route' => 'marketing/recharge_config', 'desc' => ''),
  577. array('title' => '充值说明', 'route' => 'marketing/explain', 'desc' => ''),
  578. array('title' => '充值流水', 'route' => 'marketing/recharge_diary', 'desc' => ''),
  579. )
  580. ),
  581. array('title' => '主题活动', 'route' => 'marketing/special', 'desc' => ''),
  582. array(
  583. 'title' => '付费会员卡',
  584. 'route' => 'vipcard/index',
  585. 'items' => array(
  586. array('title' => '会员卡', 'route' => 'vipcard/index', 'desc' => ''),
  587. array('title' => '会员权益', 'route' => 'vipcard/equity', 'desc' => ''),
  588. array('title' => '购买记录', 'route' => 'vipcard/order', 'desc' => ''),
  589. array('title' => '会员卡设置', 'route' => 'vipcard/config', 'desc' => ''),
  590. )
  591. ),
  592. array(
  593. 'title' => '预售活动',
  594. 'route' => 'presale/index',
  595. 'items' => array(
  596. array('title' => '商品管理', 'route' => 'presale/index', 'desc' => ''),
  597. array('title' => '幻灯片', 'route' => 'presale/slider', 'desc' => ''),
  598. array('title' => '预售订单', 'route' => 'presale/order', 'desc' => ''),
  599. array('title' => '预售统计', 'route' => 'presale/statistics', 'desc' => ''),
  600. array('title' => '活动设置', 'route' => 'presale/config', 'desc' => ''),
  601. )
  602. ),
  603. array(
  604. 'title' => '店铺装修',
  605. 'route' => 'shopdiy/index',
  606. 'items' => array(
  607. array('title' => '首页装修', 'route' => 'shopdiy/index', 'desc' => ''),
  608. //array('title' => '模板选择', 'route' => 'shopdiy/templateChoose', 'desc' => '')
  609. )
  610. ),
  611. array(
  612. 'title' => '邀新有礼',
  613. 'route' => 'invitegift/config',
  614. 'items' => array(
  615. array('title' => '邀新有礼', 'route' => 'invitegift/config', 'desc' => ''),
  616. array('title' => '邀新记录', 'route' => 'invitegift/record', 'desc' => ''),
  617. array('title' => '邀新海报', 'route' => 'invitegift/poster_background', 'desc' => '')
  618. )
  619. ),
  620. array(
  621. 'title' => '礼品卡',
  622. 'route' => 'virtualcard/index',
  623. 'items' => array(
  624. array('title' => '礼品卡管理', 'route' => 'virtualcard/index', 'desc' => ''),
  625. array('title' => '兑换码管理', 'route' => 'virtualcard/exchange_code', 'desc' => ''),
  626. array('title' => '线下兑换码', 'route' => 'virtualcard/exchange_offline', 'desc' => ''),
  627. array('title' => '订单管理', 'route' => 'virtualcard/orderlist', 'desc' => ''),
  628. array('title' => '兑换记录', 'route' => 'virtualcard/exchangerecord', 'desc' => ''),
  629. array('title' => '活动设置', 'route' => 'virtualcard/config', 'desc' => ''),
  630. )
  631. ),
  632. )
  633. ),
  634. 'application' => array(
  635. 'title' => '应用',
  636. 'subtitle' => '应用管理',
  637. 'icon' => 'application',
  638. 'route' => 'application/index',
  639. 'items' => array(
  640. array('title' => '应用管理', 'route' => 'application/index', 'desc' => ''),
  641. ),
  642. ),
  643. 'delivery' => array(
  644. 'title' => '配送',
  645. 'subtitle' => '配送单管理',
  646. 'icon' => 'delivery2',
  647. 'route' => 'delivery/delivery',
  648. 'items' => array(
  649. array('title' => '配送单管理', 'route' => 'delivery/index', 'desc' => ''),
  650. array('title' => '生成配送单', 'route' => 'delivery/get_list', 'desc' => ''),
  651. array('title' => '配送路线', 'route' => 'delivery/line', 'desc' => ''),
  652. array('title' => '配送司机', 'route' => 'delivery/clerk', 'desc' => ''),
  653. array('title' => '设置', 'route' => 'delivery/config', 'desc' => ''),
  654. ),
  655. ),
  656. 'reports' => array(
  657. 'title' => '数据',
  658. 'subtitle' => '数据统计',
  659. 'icon' => 'reports',
  660. 'route' => 'reports/index',
  661. 'items' => array(
  662. array('title' => '营业数据', 'route' => 'reports/index', 'desc' => ''),
  663. array('title' => '数据统计', 'route' => 'reports/datastatics', 'desc' => ''),
  664. array('title' => '毛利统计', 'route' => 'reports/goodstatics', 'desc' => ''),
  665. array('title' => '团长统计', 'route' => 'reports/communitystatics', 'desc' => ''),
  666. )
  667. ),
  668. 'perm' => array(
  669. 'title' => '权限',
  670. 'subtitle' => '权限管理',
  671. 'icon' => 'perm',
  672. 'route' => 'perm/index',
  673. 'items' => array(
  674. array('title' => '角色管理', 'route' => 'perm/index', 'desc' => ''),
  675. array('title' => '用户管理', 'route' => 'perm/user', 'desc' => ''),
  676. ),
  677. ),
  678. 'attachment' => array(
  679. 'title' => '附件',
  680. 'subtitle' => '附件管理',
  681. 'icon' => 'attachment',
  682. 'route' => 'attachment/index',
  683. 'items' => array(
  684. array('title' => '附件设置', 'route' => 'attachment/index', 'desc' => ''),
  685. ),
  686. ),
  687. 'config' => array(
  688. 'title' => '设置',
  689. 'subtitle' => '设置',
  690. 'icon' => 'setup',
  691. 'route' => 'config/index',
  692. 'items' => array(
  693. array('title' => '基本设置', 'route' => 'config/index', 'desc' => ''),
  694. array('title' => '图片设置', 'route' => 'config/picture', 'desc' => ''),
  695. array(
  696. 'title' => '小程序设置',
  697. 'route' => 'weprogram/index',
  698. 'items' => array(
  699. array('title' => '参数设置', 'route' => 'weprogram/index', 'desc' => ''),
  700. array('title' => '模板消息', 'route' => 'weprogram/templateconfig', 'desc' => ''),
  701. array('title' => '订阅消息', 'route' => 'weprogram/subscribetemplateconfig', 'desc' => ''),
  702. array('title' => '底部菜单', 'route' => 'weprogram/tabbar', 'desc' => ''),
  703. )
  704. ),
  705. // array('title' => '证书设置', 'route' => 'configpay/index', 'desc' => ''),
  706. array(
  707. 'title' => '首页设置',
  708. 'route' => 'configindex/slider',
  709. 'items' => array(
  710. array('title' => '幻灯片', 'route' => 'configindex/slider', 'desc' => ''),
  711. array('title' => '分类广告', 'route' => 'configindex/category', 'desc' => ''),
  712. array('title' => '公告', 'route' => 'configindex/notice', 'desc' => ''),
  713. array('title' => '导航图标', 'route' => 'configindex/navigat', 'desc' => ''),
  714. array('title' => '公告设置', 'route' => 'configindex/noticesetting', 'desc' => ''),
  715. array('title' => '抢购切换', 'route' => 'configindex/qgtab', 'desc' => ''),
  716. array('title' => '图片魔方', 'route' => 'configindex/cube', 'desc' => ''),
  717. array('title' => '视频', 'route' => 'configindex/video', 'desc' => ''),
  718. )
  719. ),
  720. array('title' => '小程序路径', 'route' => 'config/links', 'desc' => ''),
  721. array(
  722. 'title' => '物流设置',
  723. 'route' => 'shipping/templates',
  724. 'items' => array(
  725. array('title' => '运费模板', 'route' => 'shipping/templates', 'desc' => ''),
  726. array('title' => '物流接口', 'route' => 'logistics/inface', 'desc' => ''),
  727. //array('title' => '地区管理', 'route' => 'config/logistics.area', 'desc' => ''),
  728. array('title' => '快递方式', 'route' => 'express/config', 'desc' => ''),
  729. array('title' => '同城配送', 'route' => 'express/localtownconfig', 'desc' => ''),
  730. array('title' => '订单推送', 'route' => 'express/ordersendconfig', 'desc' => ''),
  731. array('title' => '配送方式', 'route' => 'express/deconfig', 'desc' => ''),
  732. )
  733. ),
  734. array(
  735. 'title' => '电子面单',
  736. 'route' => 'logistics/index',
  737. 'items' => array(
  738. array('title' => '面单列表', 'route' => 'logistics/index', 'desc' => ''),
  739. array('title' => '面单设置', 'route' => 'logistics/inface', 'desc' => ''),
  740. )
  741. ),
  742. array(
  743. 'title' => '个人中心',
  744. 'route' => 'copyright/index',
  745. 'is_hide_child' => 2,
  746. 'items' => array(
  747. array('title' => '版权说明', 'route' => 'copyright/index', 'desc' => ''),
  748. array('title' => '关于我们', 'route' => 'copyright/about', 'desc' => ''),
  749. array('title' => '图标设置', 'route' => 'copyright/icon', 'desc' => ''),
  750. )
  751. ),
  752. array(
  753. 'title' => '小程序直播',
  754. 'route' => 'wxlive/index',
  755. 'is_hide_child' => 2,
  756. 'items' => array(
  757. array('title' => '直播间管理', 'route' => 'wxlive/index', 'desc' => ''),
  758. array('title' => '设置', 'route' => 'wxlive/setting', 'desc' => ''),
  759. )
  760. ),
  761. //array('title' => '后台账户', 'route' => 'copyright/account', 'desc' => ''),
  762. array('title' => '系统日志', 'route' => 'operatelog/index', 'desc' => ''),
  763. )
  764. ),
  765. );
  766. if(SELLERUID != 1)
  767. {
  768. $seller_info = M('seller')->field('s_role_id')->where( array('s_id' => SELLERUID ) )->find();
  769. $perm_role = M('lionfish_comshop_perm_role')->where( array('id' => $seller_info['s_role_id']) )->find();
  770. //marketing,marketing.marketing.recharge_diary,marketing.vipcard.order
  771. $perms_str = $perm_role['perms2'];
  772. // marketing.explain
  773. $shopmenu3 = array();
  774. foreach($shopmenu_2 as $key => $val)
  775. {
  776. $j = 0;
  777. $is_in =false;
  778. $new_val = $val;
  779. $get_items = array();
  780. $first_route = '';
  781. foreach($val['items'] as $kk => $vv)
  782. {
  783. //route
  784. $new_rt = str_replace('/','.', $vv['route']);
  785. $is_in_child = false;
  786. if( isset($vv['items']) && !empty($vv['items']) )
  787. {
  788. $ij =0;
  789. $tp_items = array();
  790. foreach( $vv['items'] as $tk => $tv )
  791. {
  792. $new_rt_tk = str_replace('/','.', $tv['route']);
  793. if( strpos($perms_str, '.'.$new_rt_tk) !== false )
  794. {
  795. $tp_items[$tk] = $tv;
  796. $is_in_child = true;
  797. if( $ij == 0 )
  798. {
  799. $first_route = $tv['route'];
  800. }
  801. $ij++;
  802. }
  803. }
  804. if( !empty($tp_items) )
  805. {
  806. $vv['route'] = $first_route;
  807. $vv['items'] = $tp_items;
  808. }
  809. }
  810. if( strpos($perms_str, '.'.$new_rt) !== false )
  811. {
  812. $get_items[$kk] = $vv;
  813. $is_in = true;
  814. }else{
  815. if(isset($vv['items']) && !empty($vv['items']) && $is_in_child)
  816. {
  817. $get_items[$kk] = $vv;
  818. $is_in = true;
  819. }
  820. continue;
  821. }
  822. if( $j == 0 )
  823. {
  824. $first_route = $vv['route'];
  825. }
  826. $j++;
  827. }
  828. if( $is_in )
  829. {
  830. $new_val['route'] = $first_route;
  831. $new_val['items'] = $get_items;
  832. $shopmenu3[$key] = $new_val;
  833. }
  834. }
  835. $shopmenu_2 = $shopmenu3;
  836. }
  837. if (defined('ROLE') && ROLE == 'agenter' ) {
  838. $supper_info = get_agent_logininfo();
  839. $shopmenu_2 = array();
  840. $shopmenu_2['index'] = array(
  841. 'title' => '概况',
  842. 'icon' => 'index',
  843. 'subtitle' => '概况信息',
  844. 'route' => 'index/analys',
  845. 'items' => array(
  846. array('title' => '统计', 'route' => 'index/analys')
  847. )
  848. );
  849. $shopmenu_2['goods'] = array(
  850. 'title' => '商品',
  851. 'subtitle' => '商品管理',
  852. 'icon' => 'goods',
  853. 'route' => 'goods/index',
  854. 'items' => array(
  855. array('title' => '商品列表', 'route' => 'goods/index'),
  856. array(
  857. 'title' => '商品设置',
  858. 'route' => '',
  859. 'items' => array(
  860. array('title' => '统一时间', 'route' => 'goods/settime', 'desc' => '')
  861. ),
  862. ),
  863. )
  864. );
  865. if($supper_info['type'] == 1)
  866. {
  867. $is_open_supply_print= D('Home/Front')->get_config_by_name('is_open_supply_print' );
  868. if(!empty($is_open_supply_print)){
  869. $shopmenu_2['order'] = array(
  870. 'title' => '订单',
  871. 'subtitle' => '订单管理',
  872. 'icon' => 'order',
  873. 'route' => 'order/index',
  874. 'items' => array(
  875. array('title' => '订单列表', 'route' => 'order/index', 'desc' => ''),
  876. array('title' => '批量发货', 'route' => 'order/ordersendall', 'desc' => ''),
  877. array(
  878. 'title' => '售后管理',
  879. 'route' => '',
  880. 'items' => array(
  881. array('title' => '售后订单', 'route' => 'order/orderaftersales', 'desc' => ''),
  882. )
  883. ),
  884. array('title' => '打印机设置', 'route' => 'order/printconfig', 'desc' => ''),
  885. )
  886. );
  887. }else{
  888. $shopmenu_2['order'] = array(
  889. 'title' => '订单',
  890. 'subtitle' => '订单管理',
  891. 'icon' => 'order',
  892. 'route' => 'order/index',
  893. 'items' => array(
  894. array('title' => '订单列表', 'route' => 'order/index', 'desc' => ''),
  895. array('title' => '批量发货', 'route' => 'order/ordersendall', 'desc' => ''),
  896. array(
  897. 'title' => '售后管理',
  898. 'route' => '',
  899. 'items' => array(
  900. array('title' => '售后订单', 'route' => 'order/orderaftersales', 'desc' => ''),
  901. )
  902. ),
  903. )
  904. );
  905. }
  906. }else{
  907. $shopmenu_2['order'] = array(
  908. 'title' => '订单',
  909. 'subtitle' => '订单管理',
  910. 'route' => 'order/index',
  911. 'icon' => 'order',
  912. 'items' => array(
  913. array('title' => '订单列表', 'route' => 'order/index', 'desc' => ''),
  914. )
  915. );
  916. }
  917. $shopmenu_2['salesroom'] = array(
  918. 'title' => '门店',
  919. 'subtitle' => '门店管理',
  920. 'icon' => 'supply',
  921. 'route' => 'salesroom/index',
  922. 'items' => array(
  923. array('title' => '门店列表', 'route' => 'salesroom/index', 'desc' => ''),
  924. array('title' => '核销人员', 'route' => 'salesroom_member/index', 'desc' => ''),
  925. array('title' => '核销订单记录', 'route' => 'salesroom_order/index', 'desc' => ''),
  926. ),
  927. );
  928. $shopmenu_2['supply'] = array(
  929. 'title' => '财务',
  930. 'subtitle' => '资金流水',
  931. 'icon' => 'supply',
  932. 'route' => 'supply/floworder',
  933. 'items' => array(
  934. array('title' => '资金流水', 'route' => 'supply/floworder', 'desc' => ''),
  935. array('title' => '提现管理', 'route' => 'supply/tixianlist', 'desc' => ''),
  936. ),
  937. );
  938. $supply_is_open_localtown_distribution = D('Home/Front')->get_config_by_name('supply_is_open_localtown_distribution' );
  939. $isopen_localtown_delivery = D('Home/Front')->get_config_by_name('isopen_localtown_delivery' );
  940. if(!empty($supply_is_open_localtown_distribution) && !empty($isopen_localtown_delivery)){
  941. $shopmenu_2['modifypassword'] = array(
  942. 'title' => '设置',
  943. 'subtitle' => '登录信息',
  944. 'icon' => 'supply',
  945. 'route' => 'supply/modifypassword',
  946. 'items' => array(
  947. array('title' => '修改密码', 'route' => 'supply/modifypassword', 'desc' => ''),
  948. array('title' => '同城配送', 'route' => 'express/localtownconfig', 'desc' => '')
  949. ),
  950. );
  951. $shopmenu_2['order']['items'][] = array(
  952. 'title' => '配送管理',
  953. 'route' => 'orderdistribution/index',
  954. 'items' => array(
  955. array('title' => '配送员管理', 'route' => 'orderdistribution/index', 'desc' => ''),
  956. array('title' => '配送设置', 'route' => 'orderdistribution/distributionconfig', 'desc' => ''),
  957. )
  958. );
  959. $shopmenu_2['order']['items'][] = array(
  960. 'title' => '提现管理',
  961. 'route' => 'orderdistribution/withdrawallist',
  962. 'items' => array(
  963. array('title' => '提现列表', 'route' => 'orderdistribution/withdrawallist', 'desc' => ''),
  964. array('title' => '提现设置', 'route' => 'orderdistribution/withdrawalconfig', 'desc' => ''),
  965. )
  966. );
  967. }else{
  968. $shopmenu_2['modifypassword'] = array(
  969. 'title' => '设置',
  970. 'subtitle' => '登录信息',
  971. 'icon' => 'supply',
  972. 'route' => 'supply/modifypassword',
  973. 'items' => array(
  974. array('title' => '修改密码', 'route' => 'supply/modifypassword', 'desc' => '')
  975. ),
  976. );
  977. }
  978. }
  979. return $shopmenu_2;
  980. }
  981. public function check_seller_perm($route)
  982. {
  983. if(SELLERUID != 1)
  984. {
  985. $seller_info = M('seller')->field('s_role_id')->where( array('s_id' => SELLERUID ) )->find();
  986. $perm_role = M('lionfish_comshop_perm_role')->where( array('id' => $seller_info['s_role_id']) )->find();
  987. $perms_str = $perm_role['perms2'];
  988. $new_route = str_replace('/','.', $route);
  989. if( strpos($perms_str, $new_route) !== false )
  990. {
  991. return true;
  992. }else{
  993. return false;
  994. }
  995. }else{
  996. return true;
  997. }
  998. }
  999. }
  1000. ?>