MenuModel.class.php 39 KB

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