/** 卸载 */ @RequestMapping(value = "/uninstall", method = RequestMethod.POST) public @ResponseBody Message uninstall() { if (yeepayPlugin.getIsInstalled()) { PluginConfig pluginConfig = yeepayPlugin.getPluginConfig(); pluginConfigService.delete(pluginConfig); } return SUCCESS_MESSAGE; }
/** 安装 */ @RequestMapping(value = "/install", method = RequestMethod.POST) public @ResponseBody Message install() { if (!yeepayPlugin.getIsInstalled()) { PluginConfig pluginConfig = new PluginConfig(); pluginConfig.setPluginId(yeepayPlugin.getId()); pluginConfig.setIsEnabled(false); pluginConfigService.save(pluginConfig); } return SUCCESS_MESSAGE; }
/** 更新 */ @RequestMapping(value = "/update", method = RequestMethod.POST) public String update( String paymentName, String partner, String key, FeeType feeType, BigDecimal fee, String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order, RedirectAttributes redirectAttributes) { PluginConfig pluginConfig = yeepayPlugin.getPluginConfig(); pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName); pluginConfig.setAttribute("partner", partner); pluginConfig.setAttribute("key", key); pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString()); pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString()); pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo); pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description); pluginConfig.setIsEnabled(isEnabled); pluginConfig.setOrder(order); pluginConfigService.update(pluginConfig); addFlashMessage(redirectAttributes, SUCCESS_MESSAGE); return "redirect:/console/payment_plugin/list.ct"; }
/** 设置 */ @RequestMapping(value = "/setting", method = RequestMethod.GET) public String setting(ModelMap model) { PluginConfig pluginConfig = yeepayPlugin.getPluginConfig(); model.addAttribute("feeTypes", FeeType.values()); model.addAttribute("pluginConfig", pluginConfig); return "/com/sammyun/plugin/yeepay/setting"; }