/** 卸载 */ @RequestMapping(value = "/uninstall", method = RequestMethod.POST) public @ResponseBody Message uninstall() { if (qqLoginPlugin.getIsInstalled()) { pluginConfigService.deleteByPluginId(qqLoginPlugin.getId()); } return SUCCESS_MESSAGE; }
/** 初始化店铺本地存储插件数据 */ private void initStoragePlugin(Store store) { PluginConfig pluginConfig = new PluginConfig(); pluginConfig.setPluginId(filePlugin.getId()); pluginConfig.setIsEnabled(true); pluginConfig.setStore(store); pluginConfigService.save(pluginConfig); }
/** 安装 */ @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; }
/** * 初始化支付宝信息 - 公司的支付宝 * * @param store */ private void initAlipayDirect(Store store) { PluginConfig pluginConfig = new PluginConfig(); pluginConfig.setPluginId(alipayDirectPlugin.getId()); pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, "支付宝"); pluginConfig.setAttribute("partner", "2088211535838965"); pluginConfig.setAttribute("key", "14hqtaakskwm11j8bc7rniui8wf7hpcd"); pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, FeeType.fixed.toString()); pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, "0"); pluginConfig.setAttribute( PaymentPlugin.LOGO_ATTRIBUTE_NAME, "http://storage.shopxx.net/demo-image/3.0/payment_plugin/alipay.gif"); pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, ""); pluginConfig.setIsEnabled(true); pluginConfig.setOrder(1); pluginConfig.setStore(store); pluginConfigService.save(pluginConfig); }
/** 更新 */ @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"; }
/** * 获取插件配置 * * @return 插件配置 */ public PluginConfig getPluginConfig() { return pluginConfigService.findByPluginId(getId()); }
/** * 获取是否已安装 * * @return 是否已安装 */ public boolean getIsInstalled() { return pluginConfigService.pluginIdExists(getId()); }