@Override
  public boolean save(String type, Long open_id, Long uid) {
    if (StringKit.isNotBlank(type) && null != open_id && null != uid) {
      try {

        Long count =
            AR.find(
                    "select count(1) from t_openid where open_id = ? and type = ? and uid = ?",
                    open_id,
                    type,
                    uid)
                .first(Long.class);
        if (count == 0) {
          AR.update(
                  "insert into t_openid(type, open_id, uid, create_time) values(?, ?, ?, ?)",
                  type,
                  open_id,
                  uid,
                  DateKit.getCurrentUnixTime())
              .executeUpdate();
        }
        return true;
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return false;
  }
 @Override
 public boolean delete(String type, Long open_id) {
   if (null != open_id && StringKit.isNotBlank(type)) {
     AR.update("delete from t_openid where type = ? and open_id = ?", type, open_id)
         .executeUpdate();
     return true;
   }
   return false;
 }
Example #3
0
  public void run() {

    if (null != configMap && configMap.size() > 0) {

      bladeConfig.setConfigMap(configMap);

      String route = configMap.get(BLADE_ROUTE);
      String interceptor = configMap.get(BLADE_INTERCEPTOR);
      String ioc = configMap.get(BLADE_IOC);
      String prefix = configMap.get(BLADE_PREFIX);
      String suffix = configMap.get(BLADE_SUFFIX);
      String filter_folder = configMap.get(BLADE_FILTER_FOLDER);
      String encoding = configMap.get(BLADE_ENCODING);
      String view404 = configMap.get(BLADE_VIEW_404);
      String view500 = configMap.get(BLADE_VIEW_500);
      String debug = configMap.get(BLADE_DEBUG);
      String xss = configMap.get(BLADE_ENABLEXSS);

      if (StringKit.isNotBlank(route)) {
        String[] blade_routes = StringKit.split(route, ",");
        bladeConfig.setRoutePackages(blade_routes);
      }

      if (StringKit.isNotBlank(filter_folder)) {
        String[] blade_filter_folders = StringKit.split(filter_folder, ",");
        bladeConfig.setStaticFolders(blade_filter_folders);
      }

      if (StringKit.isNotBlank(interceptor)) {
        bladeConfig.setInterceptorPackage(interceptor);
      }

      if (StringKit.isNotBlank(ioc)) {
        String[] blade_iocs = StringKit.split(ioc, ",");
        bladeConfig.setIocPackages(blade_iocs);
      }

      if (StringKit.isNotBlank(prefix)) {
        bladeConfig.setViewPrefix(prefix);
      }

      if (StringKit.isNotBlank(suffix)) {
        bladeConfig.setViewSuffix(suffix);
      }

      if (StringKit.isNotBlank(encoding)) {
        bladeConfig.setEncoding(encoding);
      }

      if (StringKit.isNotBlank(view404)) {
        bladeConfig.setView404(view404);
      }

      if (StringKit.isNotBlank(view500)) {
        bladeConfig.setView500(view500);
      }

      if (StringKit.isNotBlank(debug)) {
        Boolean debugBool = Boolean.valueOf(debug);
        bladeConfig.setDebug(debugBool);
      }

      if (StringKit.isNotBlank(xss)) {
        Boolean enableXssBool = Boolean.valueOf(xss);
        bladeConfig.setEnableXSS(enableXssBool);
      }
    }
  }