예제 #1
0
 /** 初始化店铺本地存储插件数据 */
 private void initStoragePlugin(Store store) {
   PluginConfig pluginConfig = new PluginConfig();
   pluginConfig.setPluginId(filePlugin.getId());
   pluginConfig.setIsEnabled(true);
   pluginConfig.setStore(store);
   pluginConfigService.save(pluginConfig);
 }
예제 #2
0
 /** 安装 */
 @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;
 }
예제 #3
0
 /** 更新 */
 @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";
 }
예제 #4
0
 /**
  * 初始化支付宝信息 - 公司的支付宝
  *
  * @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);
 }
예제 #5
0
 /**
  * 获取排序
  *
  * @return 排序
  */
 public Integer getOrder() {
   PluginConfig pluginConfig = getPluginConfig();
   return pluginConfig != null ? pluginConfig.getOrder() : null;
 }
예제 #6
0
 /**
  * 获取属性值
  *
  * @param name 属性名称
  * @return 属性值
  */
 public String getAttribute(String name) {
   PluginConfig pluginConfig = getPluginConfig();
   return pluginConfig != null ? pluginConfig.getAttribute(name) : null;
 }
예제 #7
0
 /**
  * 获取是否已启用
  *
  * @return 是否已启用
  */
 public boolean getIsEnabled() {
   PluginConfig pluginConfig = getPluginConfig();
   return pluginConfig != null ? pluginConfig.getIsEnabled() : false;
 }