|
@@ -4,6 +4,7 @@ import edu.nju.entities.Task;
|
|
|
import edu.nju.util.HTTP;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.mongodb.core.MongoOperations;
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
import org.springframework.data.mongodb.core.query.Query;
|
|
@@ -17,6 +18,9 @@ public class TaskDao {
|
|
|
@Autowired
|
|
|
private MongoOperations mongoOperations;
|
|
|
|
|
|
+ @Value("${main.site}")
|
|
|
+ private String mainSiteUrl;
|
|
|
+
|
|
|
public Task save(Task task) {
|
|
|
mongoOperations.save(task);
|
|
|
return task;
|
|
@@ -33,7 +37,7 @@ public class TaskDao {
|
|
|
}
|
|
|
|
|
|
private Task getAndSaveTaskInfo(String id){
|
|
|
- String result = HTTP.sendGet("http://www.mooctest.net/api/exam/" + id + "/info", "");
|
|
|
+ String result = HTTP.sendGet(mainSiteUrl + "/api/exam/" + id + "/info", "");
|
|
|
if (!"".equals(result)) {
|
|
|
JSONObject json = new JSONObject(result);
|
|
|
long beginTime = json.getLong("beginTime");
|