Skip to content

Commit

Permalink
1.其他-车神卡
Browse files Browse the repository at this point in the history
2.其他-实体红包
3.会员-添加一个浏览任务
  • Loading branch information
498953584 committed Jun 25, 2024
1 parent 258cb54 commit aeef557
Show file tree
Hide file tree
Showing 5 changed files with 426 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@
import tkaxv7s.xposed.sesame.util.TimeUtil;
import tkaxv7s.xposed.sesame.util.UserIdMap;

/**
* 会员
* @author xiong
*/
public class AntMember extends ModelTask {
private static final String TAG = AntMember.class.getSimpleName();

@Override
public String setName() {
return "会员";
}

public BooleanModelField receivePoint;
public BooleanModelField zcjSignIn;
public BooleanModelField merchantKmdk;
Expand All @@ -32,10 +37,12 @@ public ModelFields setFields() {
return modelFields;
}

@Override
public Boolean check() {
return receivePoint.getValue() && !TaskCommon.IS_ENERGY_TIME;
}

@Override
public Runnable init() {
return () -> {
try {
Expand All @@ -56,28 +63,32 @@ public Runnable init() {

signPageTaskList();

if (merchantKmdk.getValue() || zcjSignIn.getValue()) {
JSONObject jo = new JSONObject(AntMemberRpcCall.transcodeCheck());
if (jo.getBoolean("success")) {
JSONObject data = jo.getJSONObject("data");
if (data.optBoolean("isOpened")) {
if (zcjSignIn.getValue())
zcjSignIn();
queryAllStatusTaskList();

if (merchantKmdk.getValue()) {
if (TimeUtil.isNowAfterTimeStr("0600")
&& TimeUtil.isNowBeforeTimeStr("1200"))
kmdkSignIn();
kmdkSignUp();
}
taskListQuery();
} else {
Log.record("商家服务未开通!");
}
if (!merchantKmdk.getValue() && !zcjSignIn.getValue()) {
return;
}
JSONObject jo = new JSONObject(AntMemberRpcCall.transcodeCheck());
if (!jo.getBoolean("success")) {
return;
}
JSONObject data = jo.getJSONObject("data");
if (!data.optBoolean("isOpened")) {
Log.record("商家服务👪未开通");
return;
}
if (zcjSignIn.getValue()) {
zcjSignIn();
}
if (merchantKmdk.getValue()) {
if (TimeUtil.isNowAfterTimeStr("0600") && TimeUtil.isNowBeforeTimeStr("1200")) {
kmdkSignIn();
}
kmdkSignUp();
}
taskListQuery();
} catch (Throwable t) {
Log.i(TAG, "receivePoint.run err:");
Log.i(TAG, "init err:");
Log.printStackTrace(TAG, t);
}
};
Expand All @@ -104,8 +115,9 @@ private static void queryPointCert(int page, int pageSize) {
Log.i(s);
}
}
if (hasNextPage)
if (hasNextPage) {
queryPointCert(page + 1, pageSize);
}
} else {
Log.record(jo.getString("resultDesc"));
Log.i(s);
Expand Down Expand Up @@ -146,8 +158,9 @@ private static void kmdkSignUp() {
JSONObject jo = new JSONObject(AntMemberRpcCall.queryActivity());
if (jo.getBoolean("success")) {
String activityNo = jo.getString("activityNo");
if (!Log.getFormatDate().replace("-", "").equals(activityNo.split("_")[2]))
if (!Log.getFormatDate().replace("-", "").equals(activityNo.split("_")[2])) {
break;
}
if ("SIGN_UP".equals(jo.getString("signUpStatus"))) {
Log.record("开门打卡今日已报名!");
break;
Expand Down Expand Up @@ -209,8 +222,9 @@ private static void taskListQuery() {
JSONArray taskList = jo.getJSONObject("data").getJSONArray("taskList");
for (int i = 0; i < taskList.length(); i++) {
JSONObject task = taskList.getJSONObject(i);
if (!task.has("status"))
if (!task.has("status")) {
continue;
}
String title = task.getString("title");
String reward = task.getString("reward");
String taskStatus = task.getString("status");
Expand All @@ -233,35 +247,43 @@ private static void taskListQuery() {
String taskCode = task.getString("taskCode");
switch (taskCode) {
case "XCZBJLLRWCS_TASK":
taskReceive(taskCode, "XCZBJLL_VIEWED", title);//逛一逛精彩内容
// 逛一逛精彩内容
taskReceive(taskCode, "XCZBJLL_VIEWED", title);
break;
case "BBNCLLRWX_TASK":
taskReceive(taskCode, "GYG_BBNC_VIEWED", title);// 逛一逛芭芭农场
// 逛一逛芭芭农场
taskReceive(taskCode, "GYG_BBNC_VIEWED", title);
break;
case "LLSQMDLB_TASK":
taskReceive(taskCode, "LL_SQMDLB_VIEWED", title);//浏览收钱码大礼包
// 浏览收钱码大礼包
taskReceive(taskCode, "LL_SQMDLB_VIEWED", title);
break;
case "SYH_CPC_FIXED_2":
taskReceive(taskCode, "MRCH_CPC_FIXED_VIEWED", title);// 逛一逛商品橱窗
// 逛一逛商品橱窗
taskReceive(taskCode, "MRCH_CPC_FIXED_VIEWED", title);
break;
case "SYH_CPC_ALMM_1":
taskReceive(taskCode, "MRCH_CPC_ALMM_VIEWED", title);
break;
case "TJBLLRW_TASK":
taskReceive(taskCode, "TJBLLRW_TASK_VIEWED", title);// 逛逛淘金币,购物可抵钱
// 逛逛淘金币,购物可抵钱
taskReceive(taskCode, "TJBLLRW_TASK_VIEWED", title);
break;
case "HHKLLRW_TASK":
taskReceive(taskCode, "HHKLLX_VIEWED", title);// 49999元花呗红包集卡抽
// 49999元花呗红包集卡抽
taskReceive(taskCode, "HHKLLX_VIEWED", title);
break;
case "ZCJ_VIEW_TRADE":
taskReceive(taskCode, "ZCJ_VIEW_TRADE_VIEWED", title);// 浏览攻略,赚商家积分
// 浏览攻略,赚商家积分
taskReceive(taskCode, "ZCJ_VIEW_TRADE_VIEWED", title);
break;
}
}
}
}
if (doubleCheck)
if (doubleCheck) {
taskListQuery();
}
} else {
Log.i("taskListQuery err:" + " " + s);
}
Expand Down Expand Up @@ -292,77 +314,126 @@ private static void taskReceive(String taskCode, String actionCode, String title
}
}

private static void signPageTaskList() {
/**
* 做任务赚积分
*/
private void signPageTaskList() {
try {
String s = AntMemberRpcCall.signPageTaskList();
JSONObject jo = new JSONObject(s);
boolean doubleCheck = false;
if ("SUCCESS".equals(jo.getString("resultCode"))) {
if (!jo.has("categoryTaskList")) {
return;
if (!"SUCCESS".equals(jo.getString("resultCode"))) {
Log.i(TAG, "queryAllStatusTaskList err:" + jo.getString("resultDesc"));
return;
}
if (!jo.has("categoryTaskList")) {
return;
}
JSONArray categoryTaskList = jo.getJSONArray("categoryTaskList");
for (int i = 0; i < categoryTaskList.length(); i++) {
jo = categoryTaskList.getJSONObject(i);
if (!"BROWSE".equals(jo.getString("type"))) {
continue;
}
JSONArray taskList = jo.getJSONArray("taskList");
doubleCheck = doTask(taskList);
}
if (doubleCheck) {
signPageTaskList();
}
} catch (Throwable t) {
Log.i(TAG, "signPageTaskList err:");
Log.printStackTrace(TAG, t);
}
}

/**
* 查询所有状态任务列表
*/
private void queryAllStatusTaskList() {
try {
String str = AntMemberRpcCall.queryAllStatusTaskList();
JSONObject jsonObject = new JSONObject(str);
if (!"SUCCESS".equals(jsonObject.getString("resultCode"))) {
Log.i(TAG, "queryAllStatusTaskList err:" + jsonObject.getString("resultDesc"));
return;
}
if (!jsonObject.has("availableTaskList")) {
return;
}
if (doTask(jsonObject.getJSONArray("availableTaskList"))) {
queryAllStatusTaskList();
}
} catch (Throwable t) {
Log.i(TAG, "queryAllStatusTaskList err:");
Log.printStackTrace(TAG, t);
}
}

/**
* 做浏览任务
*
* @param taskList 任务列表
* @return 是否再次检查
*/
private boolean doTask(JSONArray taskList) {
boolean doubleCheck = false;
try {
for (int j = 0; j < taskList.length(); j++) {
JSONObject task = taskList.getJSONObject(j);
int count = 1;
boolean hybrid = task.getBoolean("hybrid");
int periodCurrentCount = 0;
int periodTargetCount = 0;
if (hybrid) {
periodCurrentCount = Integer.parseInt(task.getJSONObject("extInfo").getString("PERIOD_CURRENT_COUNT"));
periodTargetCount = Integer.parseInt(task.getJSONObject("extInfo").getString("PERIOD_TARGET_COUNT"));
count = periodTargetCount > periodCurrentCount ? periodTargetCount - periodCurrentCount : 0;
}
if (count <= 0) {
continue;
}
JSONArray categoryTaskList = jo.getJSONArray("categoryTaskList");
for (int i = 0; i < categoryTaskList.length(); i++) {
jo = categoryTaskList.getJSONObject(i);
if (!"BROWSE".equals(jo.getString("type")))
JSONObject taskConfigInfo = task.getJSONObject("taskConfigInfo");
String name = taskConfigInfo.getString("name");
Long id = taskConfigInfo.getLong("id");
String awardParamPoint = taskConfigInfo.getJSONObject("awardParam")
.getString("awardParamPoint");
String targetBusiness = taskConfigInfo.getJSONArray("targetBusiness").getString(0);
for (int k = 0; k < count; k++) {
JSONObject jo = new JSONObject(AntMemberRpcCall.applyTask(name, id));
if (!"SUCCESS".equals(jo.getString("resultCode"))) {
Log.i(TAG, "signPageTaskList.applyTask err:" + jo.optString("resultDesc"));
continue;
JSONArray taskList = jo.getJSONArray("taskList");
for (int j = 0; j < taskList.length(); j++) {
JSONObject task = taskList.getJSONObject(j);
int count = 1;
boolean hybrid = task.getBoolean("hybrid");
int PERIOD_CURRENT_COUNT = 0;
int PERIOD_TARGET_COUNT = 0;
if (hybrid) {
PERIOD_CURRENT_COUNT = Integer
.parseInt(task.getJSONObject("extInfo").getString("PERIOD_CURRENT_COUNT"));
PERIOD_TARGET_COUNT = Integer
.parseInt(task.getJSONObject("extInfo").getString("PERIOD_TARGET_COUNT"));
if (PERIOD_TARGET_COUNT > PERIOD_CURRENT_COUNT) {
count = PERIOD_TARGET_COUNT - PERIOD_CURRENT_COUNT;
} else {
count = 0;
}
}
if (count > 0) {
JSONObject taskConfigInfo = task.getJSONObject("taskConfigInfo");
String name = taskConfigInfo.getString("name");
Long id = taskConfigInfo.getLong("id");
String awardParamPoint = taskConfigInfo.getJSONObject("awardParam")
.getString("awardParamPoint");
String targetBusiness = taskConfigInfo.getJSONArray("targetBusiness").getString(0);
for (int k = 0; k < count; k++) {
jo = new JSONObject(AntMemberRpcCall.applyTask(name, id));
if ("SUCCESS".equals(jo.getString("resultCode"))) {
Thread.sleep(1000);
String[] targetBusinessArray = targetBusiness.split("#");
jo = new JSONObject(AntMemberRpcCall.executeTask(targetBusinessArray[2],
targetBusinessArray[1]));
if ("SUCCESS".equals(jo.getString("resultCode"))) {
String ex = "";
if (hybrid) {
ex = "(" + (PERIOD_CURRENT_COUNT + k + 1) + "/"
+ PERIOD_TARGET_COUNT + ")";
}
Log.other("会员任务🎖️[" + name + ex + "]#" + awardParamPoint + "积分");
doubleCheck = true;
}
}
}
}
}
TimeUtil.sleep(1500);
String[] targetBusinessArray = targetBusiness.split("#");
String bizParam;
String bizSubType;
if (targetBusinessArray.length > 2) {
bizParam = targetBusinessArray[2];
bizSubType = targetBusinessArray[1];
} else {
bizParam = targetBusinessArray[1];
bizSubType = targetBusinessArray[0];
}
jo = new JSONObject(AntMemberRpcCall.executeTask(bizParam, bizSubType));
if (!"SUCCESS".equals(jo.getString("resultCode"))) {
Log.i(TAG, "signPageTaskList.executeTask err:" + jo.optString("resultDesc"));
continue;
}
String ex = "";
if (hybrid) {
ex = "(" + (periodCurrentCount + k + 1) + "/" + periodTargetCount + ")";
}
Log.other("会员任务🎖️[" + name + ex + "]#" + awardParamPoint + "积分");
doubleCheck = true;
}
if (doubleCheck)
signPageTaskList();
} else {
Log.record(jo.getString("resultCode"));
Log.i(s);
}

} catch (Throwable t) {
Log.i(TAG, "signPageTaskList err:");
Log.printStackTrace(TAG, t);
}
return doubleCheck;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import tkaxv7s.xposed.sesame.hook.ApplicationHook;
import tkaxv7s.xposed.sesame.util.RandomUtil;

/**
* 会员RpcCall类
* @author xiong
*/
public class AntMemberRpcCall {

private static String getUniqueId() {
Expand Down Expand Up @@ -115,4 +119,8 @@ public static String executeTask(String bizParam, String bizSubType) {
+ bizParam + "\",\"bizSubType\":\"" + bizSubType + "\",\"bizType\":\"BROWSE\"}]");
}

public static String queryAllStatusTaskList() {
return ApplicationHook.requestString("alipay.antmember.biz.rpc.membertask.h5.signPageTaskList",
"[{\"sourceBusiness\":\"signInAd\",\"sourcePassMap\":{\"innerSource\":\"\",\"source\":\"myTab\",\"unid\":\"\"}}]");
}
}
Loading

0 comments on commit aeef557

Please sign in to comment.