Skip to content

Commit

Permalink
Merge pull request #14 from 2751162017/addsqlchanger
Browse files Browse the repository at this point in the history
解决了在一些情况下修改为钻石会员无效的情况
  • Loading branch information
nov30th committed Apr 11, 2024
2 parents e46249e + b330d0d commit 87ee796
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions app/src/main/java/im/hoho/alipayInstallB/PluginMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

import android.content.Context;
import android.os.Bundle;
import android.database.sqlite.SQLiteDatabase;
/**
* Created by qzj_ on 2016/5/9.
*/
Expand Down Expand Up @@ -53,6 +56,30 @@ protected void afterHookedMethod(MethodHookParam param1MethodHookParam) throws T
}
});

XposedHelpers.findAndHookMethod("android.app.Activity", lpparam.classLoader, "onCreate", Bundle.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Context context = (Context) param.thisObject; // 获取到Activity作为Context
XposedBridge.log("--------------DATABASE_UPDATER--------------");
File dbFile = context.getDatabasePath("alipayclient.db");
if (dbFile.exists()) {
XposedBridge.log("GET DATABASE: " + context.getDatabasePath("alipayclient.db").getParentFile());
try (SQLiteDatabase db = SQLiteDatabase.openDatabase(dbFile.getPath(), null, SQLiteDatabase.OPEN_READWRITE))
{
// 将本来的普通会员直接替换为钻石会员
db.execSQL("UPDATE 'main'.'userinfo' SET 'memberGrade' = 'diamond'");
XposedBridge.log("Database update successful!");
} catch (Exception e) {
XposedBridge.log("Database update error: " + e);
}
}else{
XposedBridge.log("CAN NOT GET DATABASE: " + context.getDatabasePath("alipayclient.db").getParentFile()+",PASS!");
}
XposedBridge.log("--------------DATABASE_UPDATER--------------");
}
});


//region modify skin
// final Class<?> ConfigUtilBiz = lpparam.classLoader.loadClass("com.alipay.mobile.onsitepaystatic.ConfigUtilBiz");
final Class<?> OspSkinModel = lpparam.classLoader.loadClass("com.alipay.mobile.onsitepaystatic.skin.OspSkinModel");
Expand Down

0 comments on commit 87ee796

Please sign in to comment.