Browse Source

修改短视频BUG

半月无霜 4 years ago
parent
commit
12a04656f0

+ 1 - 1
mpwechatApp/mpwechatApp.iml

@@ -196,7 +196,7 @@
     <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.0.10.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.0.10.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.microsoft.sqlserver:mssql-jdbc:6.4.0.jre8" level="project" />
-    <orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter:5.7.0-M1" level="project" />
+    <orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter:5.7.0" level="project" />
     <orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.1.1" level="project" />
     <orderEntry type="library" name="Maven: org.apiguardian:apiguardian-api:1.0.0" level="project" />
     <orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.0.0" level="project" />

+ 46 - 46
ymall/src/main/java/com/liangjian11/ymall/utils/MongoDBUtil.java

@@ -14,13 +14,13 @@ import java.util.Date;
 import java.util.UUID;
 
 public class MongoDBUtil {
-  private static final String host="192.168.50.41";
-  private static final Integer port=27018;
-  private static final String username="admin";
-  private static final String database="B2BMall";
-  private static final String password="360lj.ocm";
-
-  public static MongoDatabase mongoDatabase(){
+	private static final String host="192.168.50.41";
+	private static final Integer port=27018;
+	private static final String username="admin";
+	private static final String database="B2BMall";
+	private static final String password="360lj.ocm";
+	
+	public static MongoDatabase mongoDatabase(){
 //    List<ServerAddress> adds = new ArrayList<ServerAddress>();
 //    ServerAddress serverAddress = new ServerAddress(host, port);
 //    adds.add(serverAddress);
@@ -29,43 +29,43 @@ public class MongoDBUtil {
 //    credentials.add(mongoCredential);
 //    MongoClient mongoClient = new MongoClient(adds, credentials);
 //    MongoDatabase mongoDatabase = mongoClient.getDatabase(database);
-    MongoClient mongoClient = new MongoClient("192.168.50.41", 27018);
-    MongoDatabase mongoDatabase = mongoClient.getDatabase(database);
-    return mongoDatabase;
-  }
-
-  public static void insertVLoginToken(Date expirationDate,String accountId,String token,Integer type){
-    MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
-    Document document = new Document("_id", UUID.randomUUID().toString())
-      .append("_time",new Date())
-      .append("Token", token)
-      .append("ExpirationDate", expirationDate)
-      .append("AccountId",accountId)
-      .append("AccountType",type);
-    collection.insertOne(document);
-  }
-
-  public static Document queryVLoginToken(String accountId){
-    MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
-    Bson filter = Filters.eq("AccountId", accountId);
-    FindIterable findIterable = collection.find(filter);
-    MongoCursor cursor = findIterable.iterator();
-    return (Document) findIterable.first();
-  }
-
-
-  public static Document queryVLoginTokenByToken(String token){
-    MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
-    Bson filter = Filters.eq("Token", token);
-    FindIterable findIterable = collection.find(filter);
-    MongoCursor cursor = findIterable.iterator();
-    return (Document) findIterable.first();
-  }
-
-  public static void updateVLoginTOken(Date expirationDate,String accountId,String token){
-    MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
-    Bson filter = Filters.eq("AccountId", accountId);
-    Document document = new Document("$set", new Document("Token", token).append("ExpirationDate",expirationDate));
-    collection.updateOne(filter, document);
-  }
+		MongoClient mongoClient = new MongoClient("192.168.50.41", 27018);
+		MongoDatabase mongoDatabase = mongoClient.getDatabase(database);
+		return mongoDatabase;
+	}
+	
+	public static void insertVLoginToken(Date expirationDate,String accountId,String token,Integer type){
+		MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
+		Document document = new Document("_id", UUID.randomUUID().toString())
+				.append("_time",new Date())
+				.append("Token", token)
+				.append("ExpirationDate", expirationDate)
+				.append("AccountId",accountId)
+				.append("AccountType",type);
+		collection.insertOne(document);
+	}
+	
+	public static Document queryVLoginToken(String accountId){
+		MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
+		Bson filter = Filters.eq("AccountId", accountId);
+		FindIterable findIterable = collection.find(filter);
+		MongoCursor cursor = findIterable.iterator();
+		return (Document) findIterable.first();
+	}
+	
+	
+	public static Document queryVLoginTokenByToken(String token){
+		MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
+		Bson filter = Filters.eq("Token", token);
+		FindIterable findIterable = collection.find(filter);
+		MongoCursor cursor = findIterable.iterator();
+		return (Document) findIterable.first();
+	}
+	
+	public static void updateVLoginTOken(Date expirationDate,String accountId,String token){
+		MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
+		Bson filter = Filters.eq("AccountId", accountId);
+		Document document = new Document("$set", new Document("Token", token).append("ExpirationDate",expirationDate));
+		collection.updateOne(filter, document);
+	}
 }

+ 0 - 71
ymall/src/main/java/com/liangjian11/ymall/utils/MongoDbUtil.java

@@ -1,71 +0,0 @@
-package com.liangjian11.ymall.utils;
-
-
-import com.mongodb.MongoClient;
-import com.mongodb.client.FindIterable;
-import com.mongodb.client.MongoCollection;
-import com.mongodb.client.MongoCursor;
-import com.mongodb.client.MongoDatabase;
-import com.mongodb.client.model.Filters;
-import org.bson.Document;
-import org.bson.conversions.Bson;
-
-import java.util.Date;
-import java.util.UUID;
-
-public class MongoDBUtil {
-  private static final String host="192.168.50.41";
-  private static final Integer port=27018;
-  private static final String username="admin";
-  private static final String database="B2BMall";
-  private static final String password="360lj.ocm";
-
-  public static MongoDatabase mongoDatabase(){
-//    List<ServerAddress> adds = new ArrayList<ServerAddress>();
-//    ServerAddress serverAddress = new ServerAddress(host, port);
-//    adds.add(serverAddress);
-//    List<MongoCredential> credentials = new ArrayList<>();
-//    MongoCredential mongoCredential = MongoCredential.createScramSha1Credential(username, database, password.toCharArray());
-//    credentials.add(mongoCredential);
-//    MongoClient mongoClient = new MongoClient(adds, credentials);
-//    MongoDatabase mongoDatabase = mongoClient.getDatabase(database);
-    MongoClient mongoClient = new MongoClient("192.168.50.41", 27018);
-    MongoDatabase mongoDatabase = mongoClient.getDatabase(database);
-    return mongoDatabase;
-  }
-
-  public static void insertVLoginToken(Date expirationDate,String accountId,String token,Integer type){
-    MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
-    Document document = new Document("_id", UUID.randomUUID().toString())
-      .append("_time",new Date())
-      .append("Token", token)
-      .append("ExpirationDate", expirationDate)
-      .append("AccountId",accountId)
-      .append("AccountType",type);
-    collection.insertOne(document);
-  }
-
-  public static Document queryVLoginToken(String accountId){
-    MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
-    Bson filter = Filters.eq("AccountId", accountId);
-    FindIterable findIterable = collection.find(filter);
-    MongoCursor cursor = findIterable.iterator();
-    return (Document) findIterable.first();
-  }
-
-
-  public static Document queryVLoginTokenByToken(String token){
-    MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
-    Bson filter = Filters.eq("Token", token);
-    FindIterable findIterable = collection.find(filter);
-    MongoCursor cursor = findIterable.iterator();
-    return (Document) findIterable.first();
-  }
-
-  public static void updateVLoginTOken(Date expirationDate,String accountId,String token){
-    MongoCollection<Document> collection = mongoDatabase().getCollection("VLoginToken");
-    Bson filter = Filters.eq("AccountId", accountId);
-    Document document = new Document("$set", new Document("Token", token).append("ExpirationDate",expirationDate));
-    collection.updateOne(filter, document);
-  }
-}