/** 安装 */ @RequestMapping(value = "/install", method = RequestMethod.POST) public @ResponseBody Message install() { if (!qqLoginPlugin.getIsInstalled()) { PluginConfig pluginConfig = new PluginConfig(); pluginConfig.setPluginId(qqLoginPlugin.getId()); pluginConfig.setIsEnabled(false); pluginConfig.setAttributes(null); pluginConfigService.save(pluginConfig); } return SUCCESS_MESSAGE; }
/** 更新 */ @RequestMapping(value = "/update", method = RequestMethod.POST) public String update( String loginMethodName, String oauthKey, String oauthSecret, String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order, RedirectAttributes redirectAttributes) { PluginConfig pluginConfig = qqLoginPlugin.getPluginConfig(); Map<String, String> attributes = new HashMap<String, String>(); attributes.put(LoginPlugin.LOGIN_METHOD_NAME_ATTRIBUTE_NAME, loginMethodName); attributes.put("oauthKey", oauthKey); attributes.put("oauthSecret", oauthSecret); attributes.put(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo); attributes.put(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description); pluginConfig.setAttributes(attributes); pluginConfig.setIsEnabled(isEnabled); pluginConfig.setOrder(order); pluginConfigService.update(pluginConfig); addFlashMessage(redirectAttributes, SUCCESS_MESSAGE); return "redirect:/admin/login_plugin/list.jhtml"; }