forked from constanline/XQuickEnergy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d78284d
commit b2621ee
Showing
12 changed files
with
227 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
- [x] 芭芭农场 | ||
- [x] 保护地巡逻 | ||
- [x] 蚂蚁新村 | ||
- [ ] 绿色营收 | ||
- [x] 绿色经营 | ||
- [x] 高版本API存储问题 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
app/src/main/java/pansong291/xposed/quickenergy/GreenFinance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
package pansong291.xposed.quickenergy; | ||
|
||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
import pansong291.xposed.quickenergy.hook.GreenFinanceRpcCall; | ||
import pansong291.xposed.quickenergy.util.Config; | ||
import pansong291.xposed.quickenergy.util.Log; | ||
|
||
/** | ||
* @author Constanline | ||
* @since 2023/09/08 | ||
*/ | ||
public class GreenFinance { | ||
private static final String TAG = GreenFinance.class.getCanonicalName(); | ||
|
||
public static void start() { | ||
if (!Config.greenFinance()) { | ||
return; | ||
} | ||
new Thread() { | ||
@Override | ||
public void run() { | ||
index(); | ||
} | ||
}.start(); | ||
} | ||
|
||
private static void batchSelfCollect(JSONArray bsnIds) { | ||
String s = GreenFinanceRpcCall.batchSelfCollect(bsnIds); | ||
try { | ||
JSONObject joSelfCollect = new JSONObject(s); | ||
if (joSelfCollect.getBoolean("success")) { | ||
int totalCollectPoint = joSelfCollect.getJSONObject("result").getInt("totalCollectPoint"); | ||
Log.other("绿色经营📊收集获得" + totalCollectPoint); | ||
} else { | ||
Log.i(TAG + ".batchSelfCollect", s); | ||
} | ||
} catch (Throwable th) { | ||
Log.i(TAG, "batchSelfCollect err:"); | ||
Log.printStackTrace(TAG, th); | ||
} | ||
} | ||
|
||
private static void index() { | ||
String s = GreenFinanceRpcCall.greenFinanceIndex(); | ||
try { | ||
JSONObject jo = new JSONObject(s); | ||
if (jo.getBoolean("success")) { | ||
JSONObject result = jo.getJSONObject("result"); | ||
if (!result.getBoolean("greenFinanceSigned")) { | ||
Log.other("绿色经营📊未开通"); | ||
return; | ||
} | ||
JSONObject mcaGreenLeafResult = result.getJSONObject("mcaGreenLeafResult"); | ||
JSONArray greenLeafList = mcaGreenLeafResult.getJSONArray("greenLeafList"); | ||
String currentCode = ""; | ||
JSONArray bsnIds = new JSONArray(); | ||
for (int i = 0; i < greenLeafList.length(); i++) { | ||
JSONObject greenLeaf = greenLeafList.getJSONObject(i); | ||
String code = greenLeaf.getString("code"); | ||
if (currentCode.equals(code) || bsnIds.length() == 0) { | ||
bsnIds.put(greenLeaf.getString("bsnId")); | ||
} else { | ||
batchSelfCollect(bsnIds); | ||
bsnIds = new JSONArray(); | ||
} | ||
} | ||
if (bsnIds.length() > 0) { | ||
batchSelfCollect(bsnIds); | ||
} | ||
} else { | ||
Log.i(TAG, jo.getString("resultDesc")); | ||
} | ||
} catch (Throwable th) { | ||
Log.i(TAG, "index err:"); | ||
Log.printStackTrace(TAG, th); | ||
} | ||
|
||
signIn("PLAY102632271"); | ||
signIn("PLAY102932217"); | ||
signIn("PLAY102232206"); | ||
|
||
String appletId = "AP13159535"; | ||
doTask(appletId); | ||
} | ||
|
||
private static void signIn(String sceneId) { | ||
String s = GreenFinanceRpcCall.signInQuery(sceneId); | ||
try { | ||
JSONObject jo = new JSONObject(s); | ||
if (jo.getBoolean("success")) { | ||
JSONObject result = jo.getJSONObject("result"); | ||
if (!result.getBoolean("isTodaySignin")) { | ||
s = GreenFinanceRpcCall.signInTrigger(sceneId); | ||
jo = new JSONObject(s); | ||
if (jo.getBoolean("success")) { | ||
Log.other("绿色经营📊签到成功"); | ||
} else { | ||
Log.i(TAG + ".signIn", s); | ||
} | ||
} | ||
} else { | ||
Log.i(TAG + ".signIn", s); | ||
} | ||
} catch (Throwable th) { | ||
Log.i(TAG, "signIn err:"); | ||
Log.printStackTrace(TAG, th); | ||
} | ||
} | ||
|
||
private static void doTask(String appletId) { | ||
String s = GreenFinanceRpcCall.taskQuery(appletId); | ||
try { | ||
JSONObject jo = new JSONObject(s); | ||
if (jo.getBoolean("success")) { | ||
JSONObject result = jo.getJSONObject("result"); | ||
JSONArray taskDetailList = result.getJSONArray("taskDetailList"); | ||
for (int i = 0; i < taskDetailList.length(); i++) { | ||
JSONObject taskDetail = taskDetailList.getJSONObject(i); | ||
if ("USER_TRIGGER".equals(taskDetail.getString("sendCampTriggerType"))) { | ||
if ("NONE_SIGNUP".equals(taskDetail.getString("taskProcessStatus"))) { | ||
s = GreenFinanceRpcCall.taskTrigger(taskDetail.getString("taskId"), "signup", appletId); | ||
jo = new JSONObject(s); | ||
if (jo.getBoolean("success")) { | ||
s = GreenFinanceRpcCall.taskTrigger(taskDetail.getString("taskId"), "send", appletId); | ||
jo = new JSONObject(s); | ||
if (jo.getBoolean("success")) { | ||
Log.other("绿色经营📊任务完成"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} else { | ||
Log.i(TAG + ".doTask", s); | ||
} | ||
} catch (Throwable th) { | ||
Log.i(TAG, "signIn err:"); | ||
Log.printStackTrace(TAG, th); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
app/src/main/java/pansong291/xposed/quickenergy/hook/GreenFinanceRpcCall.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package pansong291.xposed.quickenergy.hook; | ||
|
||
import org.json.JSONArray; | ||
import pansong291.xposed.quickenergy.util.FriendIdMap; | ||
|
||
public class GreenFinanceRpcCall { | ||
|
||
public static String greenFinanceIndex() { | ||
return RpcUtil.request( | ||
"com.alipay.mcaplatformunit.common.mobile.newservice.GreenFinancePageQueryService.indexV2", | ||
"[{\"clientVersion\":\"VERSION2\",\"custType\":\"MERCHANT\"}]"); | ||
} | ||
|
||
public static String batchSelfCollect(JSONArray bsnIds) { | ||
return RpcUtil.request("com.alipay.mcaplatformunit.common.mobile.service.GreenFinancePointCollectService.batchSelfCollect", | ||
"[{\"bsnIds\":" + bsnIds + ",\"clientVersion\":\"VERSION2\",\"custType\":\"MERCHANT\",\"uid\":\"" | ||
+ FriendIdMap.currentUid + "\"}]"); | ||
} | ||
|
||
public static String signInQuery(String sceneId) { | ||
return RpcUtil.request("com.alipay.loanpromoweb.promo.signin.query", | ||
"[{\"cycleCount\":7,\"cycleType\":\"d\",\"extInfo\":{},\"needContinuous\":1,\"sceneId\":\"" + sceneId + "\"}]"); | ||
} | ||
|
||
public static String signInTrigger(String sceneId) { | ||
return RpcUtil.request("com.alipay.loanpromoweb.promo.signin.trigger", | ||
"[{\"extInfo\":{},\"sceneId\":\"" + sceneId + "\"}]"); | ||
} | ||
|
||
public static String taskQuery(String appletId) { | ||
return RpcUtil.request("com.alipay.loanpromoweb.promo.task.taskQuery", | ||
"[{\"appletId\":\"" + appletId + "\",\"completedBottom\":true}]"); | ||
} | ||
|
||
public static String taskTrigger(String appletId, String stageCode, String taskCenId) { | ||
return RpcUtil.request("com.alipay.loanpromoweb.promo.task.taskTrigger", | ||
"[{\"appletId\":\"" + appletId + "\",\"stageCode\":\"" + stageCode + "\",\"taskCenId\":\"" + taskCenId | ||
+ "\"}]"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters