Skip to content

Commit

Permalink
2020-10-22一日一签到版本
Browse files Browse the repository at this point in the history
  • Loading branch information
meethigher committed Oct 22, 2020
1 parent 26a29f8 commit fccaff8
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 57 deletions.
51 changes: 35 additions & 16 deletions cpdaily/Cpdaily.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cpdaily;

import java.util.Random;
import java.util.function.Consumer;

import net.sf.json.JSONArray;
Expand All @@ -17,6 +18,7 @@ public class Cpdaily {
public static void prepData() {
items=getItemId();
signInstanceWid = JSONObject.fromObject(getSignId()).get("signInstanceWid").toString();
System.out.println("已经预加载数据");
}

/**
Expand All @@ -25,14 +27,16 @@ public static void prepData() {
* @return json字符串
*/
public static String submitSign() {
//如果使用预加载,可以不用下面这两行代码
// String[] items = getItemId();
// String signInstanceWid = JSONObject.fromObject(getSignId()).get("signInstanceWid").toString();
String param = "{\"abnormalReason\":\"\",\"position\":\"" + Data.poi + "\",\"longitude\":" + Data.log
+ ",\"isNeedExtra\":1,\"latitude\":" + Data.lat
+ ",\"isMalposition\":0,\"extraFieldItems\":[{\"extraFieldItemWid\":" + items[0]
+ ",\"extraFieldItemValue\":\"37.3度以下\"},{\"extraFieldItemWid\":" + items[1]
+ ",\"extraFieldItemValue\":\"健康\"}],\"signInstanceWid\":\"" + signInstanceWid
+ "\",\"signPhotoUrl\":\"\"}";
String param = "{\"abnormalReason\":\"\",\"position\":\""+Data.poi+"\""
+ ",\"longitude\":"+Data.log+",\""
+ "isNeedExtra\":1,\"latitude\":"+Data.lat+","
+ "\"isMalposition\":0,\"extraFieldItems\":[{\"extraFieldItemWid\":"+items[0]+""
+ ",\"extraFieldItemValue\":\"37.3度以下\"},{\"extraFieldItemWid\":"+items[1]+""
+ ",\"extraFieldItemValue\":\"37.3度以下\"},{\"extraFieldItemWid\":"+items[2]+""
+ ",\"extraFieldItemValue\":\"37.3度以下\"},{\"extraFieldItemWid\":"+items[3]+",\"extraFieldItemValue\":\"健康\"}],\"signInstanceWid\":\""+signInstanceWid+"\",\"signPhotoUrl\":\""+randomPhoto()+"\"}";
return HttpUtil.sendPost(Data.submitSign, param, Data.getSubHeaders());
}

Expand Down Expand Up @@ -71,17 +75,35 @@ public static String getSignId() {
return "{\"signWid\":" + jsonObject.getInt("signWid") + ",\"signInstanceWid\":"
+ jsonObject.getInt("signInstanceWid") + "}";
}

/**
* 返回随机照片
*
* @return
*/
public static String randomPhoto() {
String[] photos = Data.photoUrls.split(",");
int pieces = photos.length;
int index = new Random().nextInt(pieces);
return photos[index];
}

/**
* 获取表单中选项的id
*
* @return 数组 0为体温37度以下id,1为身体健康id
* @return 数组
* 下标0 早体温 37度下
* 下标1 午体温 37度下
* 下标2 晚体温 37度下
* 下标3 身体健康状况 健康
*/
public static String[] getItemId() {
JSONArray jsonArray = JSONObject.fromObject(getDetailSign()).getJSONObject("datas").getJSONArray("extraField");
String[] items = new String[2];
String[] items = new String[4];
items[0] = jsonArray.getJSONObject(0).getJSONArray("extraFieldItems").getJSONObject(0).getString("wid");
items[1] = jsonArray.getJSONObject(1).getJSONArray("extraFieldItems").getJSONObject(0).getString("wid");
items[2] = jsonArray.getJSONObject(2).getJSONArray("extraFieldItems").getJSONObject(0).getString("wid");
items[3] = jsonArray.getJSONObject(3).getJSONArray("extraFieldItems").getJSONObject(0).getString("wid");
return items;
}

Expand Down Expand Up @@ -124,17 +146,17 @@ public static String getRank() {


/**
* 刷赞,嗨皮,gogogo
* 刷赞
*
* @return
*/
public static void goGoGo() {
int i=520;
int i = Data.likeNum;
String param="{\"stuSignWid\":\""+stuSignWid+"\",\"hasLiked\":0}";
System.out.println("开始刷赞...");
while(i>0) {
while (i > 0) {
i--;
HttpUtil.sendPost(Data.test, param, Data.getHeaders());
// HttpUtil.sendPost(Data.giveLike, param, Data.getHeaders());
HttpUtil.sendPost(Data.giveLike, param, Data.getHeaders());
try {
Thread.sleep(1);
} catch (InterruptedException e) {
Expand All @@ -143,7 +165,4 @@ public static void goGoGo() {
}
System.out.println("刷赞结束");
}
public static void main(String[] args) {
System.out.println(submitSign());
}
}
29 changes: 17 additions & 12 deletions cpdaily/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,40 @@
*
*/
public class Data {
/**
* 图片链接
*/
public static String photoUrls = "http://cdn.meethigher.top/media/ccc3.jpg,http://cdn.meethigher.top/media/ccc2.jpg,http://cdn.meethigher.top/media/ccc1.jpg";
/**
* 默认赞数量
*/
public static int likeNum = 520;
/**
* {"appVersion":"8.1.11","systemName":"android","model":"MI
* 9","lon":0,"systemVersion":"10","deviceId":"设备号","userId":学号,"lat":0}的加密值
*/
public static String cpdailyExtension = "kQDkr/pNQMdvh/wnPA+r6EtMYsWjvHihlxWV/gdfSzUbosGnrEHnJQMiBRA/RO/v2pzirtMIWOBr9Ph5QXmLrt/ngN2gij4JaPXSQpGvPDsNMqxFHVa8dAAH9b5vav7LSy/AusZqXSa9YrtG1G0cLYuJyoCq8OfZyyIfHEChUnIrSCvLdw0wnuBtmLPss8I5d4t/3MF3Y1GjNvej+GW6prUV1Jbdtr8Z4qw==";
public static String cpdailyExtension = "kQDkr/pNQMdvv2ITpF4MDg8CNYEeTt0h/wnPA+r6EtMYsWjvHihlxWV/gdfSzUbosGnrEHnJQMiBRA/RO/v2pzirtMIWOBr9Ph5QXmLrt/ngN2gij4JaPXSQpGvPDsNMqxFHVa8dAAH9b5vav7LSy/AusZqXSa9YrtG1G0cLYuJyoCq8OfZyyIfHEChUnIrSCvLdw0wnuBtmLPss8I5d4t/3MF3Y1GjNvej+GW6prUV1Jbdtr8Z4qw==";
/**
* cookie
*/
public static String cookie = "acw_tc=2f624a35159972be4490bb23b5fabd7b; MOD_AUTH_CAS=ST-iap:101861587681910d38d65:20200910155656";
public static String cookie = "acw_tc=2f624a3515997253376138675e2b11ed991fe5bc28b3be4490bb23b5fabd7b; MOD_AUTH_CAS=ST-iap:1018615876819107:ST:8fd3e626-266d-4ced-84dc-d4e4a2d38d65:20200910155656";
/**
* 接收方邮箱
*/
public static String toMail = "meethigher@qq.com";
/**
* 定位的地点
*/
public static String poi = "吉林省长春市宽城区长春工业大学(北湖西区)";
public static String poi = "长春工业大学北湖校区西区知远苑-5栋宿舍";
/**
* 经度
*/
public static String log = "125.398185";
public static String log = "125.40051674459573";
/**
* 纬度
*/
public static String lat = "44.001709";


public static String lat = "44.00362121280072";

/**
* 学校的host
*/
Expand All @@ -46,12 +53,12 @@ public class Data {
*
* 2020-09-12 垃圾腾讯,还是阿里牛逼
*/
public static final String fromMail = "";
public static final String fromMail = "chen@meethigher.top";

/**
* 腾讯企业邮箱密码
*/
public static final String fromMailPw = "";
public static final String fromMailPw = "Chen1050121804";

/**
* Cpdaily-Extension需要根据实际情况
Expand Down Expand Up @@ -109,12 +116,10 @@ public static Map<String, String> getHeaders() {
* 获取排行榜接口
*/
public static final String rankUrl = host + "/wec-counselor-sign-apps/stu/sign/getSignRankList";

/**
* 刷赞接口
*/
public static final String giveLike = host + "/wec-counselor-sign-apps/stu/sign/giveLikeToStu";

public static final String test=host+"/wec-counselor-attendance-apps/student/attendance/giveLike";

}
44 changes: 15 additions & 29 deletions main/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
import cpdaily.SendMail;

public class Start {
public static int morning;
public static int noon;
public static int evening;
public static int hour;
public static int minute;
public static int second;
public static String isRank;
public static int delay;

public static boolean flag = false;
static {
System.out.println("2020-10-22-18:20版本");
Scanner input = new Scanner(System.in);
System.out.println("请输入Cpdaily-Extension:");
Data.cpdailyExtension = input.nextLine();
Expand All @@ -28,16 +27,14 @@ public class Start {
System.out.println("请输入MOD_AUTH_CAS:");
String modAuthCas = input.nextLine();
Data.cookie = "acw_tc=" + atwTc + "; MOD_AUTH_CAS=" + modAuthCas;
System.out.println("请输入要上传的照片链接:");
Data.photoUrls=input.nextLine();
System.out.println("请输入接收通知的邮箱:");
Data.toMail = input.nextLine();
System.out.println("是否加入刷赞功能? y or n:");
isRank = input.nextLine();
System.out.println("请输入早上开始小时:");
morning = input.nextInt();
System.out.println("请输入中午开始小时:");
noon = input.nextInt();
System.out.println("请输入晚上开始小时:");
evening = input.nextInt();
System.out.println("输入要刷赞的数量:");
Data.likeNum=input.nextInt();
System.out.println("请输入开始小时:");
hour=input.nextInt();
System.out.println("请输入开始分钟:");
minute = input.nextInt();
System.out.println("请输入开始秒:");
Expand All @@ -46,9 +43,7 @@ public class Start {
delay = input.nextInt();

input.close();

Cpdaily.prepData();
System.out.println("已经预加载数据,正在运行...");
System.out.println("正在运行");
}

public static void beginSubmit() {
Expand All @@ -67,13 +62,13 @@ public static void beginSubmit() {
String result = Cpdaily.submitResult();
if ("success".equals(result)) {
System.out.println(date + " 签到成功");
if ("y".equals(isRank)) {
if (Data.likeNum>0) {
Cpdaily.goGoGo();
} else {
//睡眠是为了留出时间来加载排行榜
try {
Thread.sleep(1000 * 30);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Expand All @@ -87,11 +82,6 @@ public static void beginSubmit() {
} else {
System.out.println("签到失败");
}

//预先加载下次数据
if(!flag) {
Cpdaily.prepData();
}
}
}

Expand All @@ -103,7 +93,6 @@ public static void main(String[] args) {
try {
Thread.sleep(1000 * 60 * 10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Expand All @@ -116,20 +105,17 @@ public static void main(String[] args) {
int currentHour = c.get(Calendar.HOUR_OF_DAY);
int currentMinute = c.get(Calendar.MINUTE);
int currentSecond = c.get(Calendar.SECOND);
if (currentHour == morning && currentMinute == minute && currentSecond == second) {
if (currentHour == hour && currentMinute == minute && currentSecond == second) {
flag = true;
}
if (currentHour == noon && currentMinute == minute && currentSecond == second) {
flag = true;
}
if (currentHour == evening && currentMinute == minute && currentSecond == second) {
flag = true;
//提前一个小时,预加载数据,霸榜,gogogo
if (currentHour == (hour-1) && currentMinute == minute && currentSecond == second) {
Cpdaily.prepData();
}
beginSubmit();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Expand Down

0 comments on commit fccaff8

Please sign in to comment.