Skip to content

Commit

Permalink
2021-01-09:优化提交成功和失败后都会下发通知,已提交和没有问卷则不通知
Browse files Browse the repository at this point in the history
  • Loading branch information
meethigher committed Jan 8, 2021
1 parent 2b46b1e commit c226bde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/auto_cookie/CpDaily.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public static boolean isSelected(String name) {
public static String submit(String[] fields, String schoolTaskWid, String address) {
String formFields = getFields(fields);
String param = new Form(fields[3], address, fields[2], schoolTaskWid, formFields).toString();
System.out.println("请求内容:" + param);
String result = HttpUtil.sendPost(Data.submitForm, param, Data.getSubHeaders());
return JSONObject.fromObject(result).get("message").toString();
}
Expand Down
10 changes: 6 additions & 4 deletions src/auto_cookie/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class Main {
private static int eh;
static {
System.out.println("读取配置文件..");
System.out.println("学号:"+Data.id);
System.out.println("地址:"+Data.address);
System.out.println("当前时间:"+new Date().toLocaleString());
System.out.println("学号:" + Data.id);
System.out.println("地址:" + Data.address);
System.out.println("当前时间:" + new Date().toLocaleString());
Scanner scanner = new Scanner(System.in);
System.out.print("请输入您的MOD_AUTH_CAS:");
Data.modAuthCas = scanner.nextLine();
Expand Down Expand Up @@ -48,6 +48,8 @@ public static String submit() {
return "success";
} else {
System.out.println("今日表单提交失败,失败报告->" + message);
System.out.println(SendMail.send(new String[] { "问卷提交失败通知", "时间:" + new Date().toLocaleString()
+ "\n" + "失败:" + message }));
return "error";
}
}
Expand All @@ -62,7 +64,7 @@ public static String submit() {
*/
public static int getDelay(String result, Calendar c) {
int delay;
if ("success".equals(result) || "submited".equals(result) || "error".equals(result)) {
if ("success".equals(result) || "error".equals(result)) {
delay = 1000 * 60 * 60 * 24 - 1000 * 1;
} else if ("noform".equals(result)) {
delay = 1000 * 60 * 30;
Expand Down

0 comments on commit c226bde

Please sign in to comment.