request->get('route',''); $list = StoreMenu::lists(['where'=>[['is_addon' => StatusEnum::DISABLED, 'status'=>StatusEnum::ENABLED]]]); $menus = StoreMenu::getTreeMenu($list,0,$route,$this->mall['mall_sign']); if($this->store_id){ $menus = StoreMenu::getFreezeMenu($menus,$this->store_id); } if (MallAddons::isInstall($this->mall_id, AddonsEnum::ADDONS_NAME_RESERVATION_SERVICE)){ $customText = BackendService::getCustomText($this->mall_id); foreach($menus as &$val){ if ($val['url'] === 'store/client/reserve-data/index') { foreach ($val['children'] as &$child) { if($child['url'] === 'store/client/reserve-staff/index'){ $child['label'] = BackendService::replaceTextToCustomText($child['label'], $customText); $child['title'] = BackendService::replaceTextToCustomText($child['title'], $customText); break; } } unset($child); break; } } unset($val); } if (MallAddons::isInstall($this->mall_id, 'ReservationService') == 0){ foreach($menus as $key => $val){ //门店股东判断商城是否安装 预约服务插件 if($val['url'] == 'store/client/reserve-data/index'){ unset($menus[$key]); } } } if (MallAddons::isInstall($this->mall_id, 'StoreBoss') == 0){ foreach($menus as $key => $val){ //门店股东判断商城是否安装 门店股东插件 if($val['url'] == 'store/client/store-boss/index'){ unset($menus[$key]); } } } if (MallAddons::isInstall($this->mall_id, AddonsEnum::ADDONS_NAME_HI_GO) == 0){ foreach($menus as $key => $val){ //门店股东判断商城是否安装 海购插件 if($val['url'] == 'store/client/merchant/profit-setting'){ unset($menus[$key]); } } } $menus = array_values($menus);// 重新排序防止数组在前端变成对象 return $this->success('ok',compact('menus')); } /** * 获取插件的菜单 * @Author:lun * @Date:2023-12-19 15:50 * @Copyright:copyright(c)2023 广东七件事集团 * @return mixed|null */ public function actionAddonsMenu(){ $route = Yii::$app->request->get('route',''); $addons_name = Yii::$app->request->get('addons_name',''); if (empty($addons_name)) return $this->error('应用标识不能为空'); $where[] = ['=', 'addons_name', $addons_name]; $where[] = ['=', 'is_addon', StatusEnum::ENABLED]; $where[] = ['=', 'status', StatusEnum::ENABLED]; $list = StoreMenu::lists(['where'=>$where]); $menus = StoreMenu::getTreeMenu($list,0,$route); return $this->success('ok',compact('menus')); } }