From 9e6443293d2789300b277ca3167066ef8b69f8ba Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Mon, 14 Oct 2024 14:03:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=8C=85=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E6=96=B9=E5=BC=8F=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?pay=5Ftype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/bean/ConfigBean.java | 9 ++ .../main/activity/MyWalletActivity.java | 147 ++++++++++++++---- .../main/res/layout/activity_my_wallet.xml | 1 + 3 files changed, 129 insertions(+), 28 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/ConfigBean.java b/common/src/main/java/com/yunbao/common/bean/ConfigBean.java index 497026ce5..75d9316ba 100644 --- a/common/src/main/java/com/yunbao/common/bean/ConfigBean.java +++ b/common/src/main/java/com/yunbao/common/bean/ConfigBean.java @@ -62,6 +62,7 @@ public class ConfigBean extends BaseModel { private String google_isup; private String sud_game_speech; + private int pay_type = 0; @SerializedName("is_return_user")//是否需要弹窗(0否,1是) private String isReturnUser=""; @@ -72,6 +73,14 @@ public class ConfigBean extends BaseModel { @SerializedName("jump_h5_url")//点击跳转H5页面地址 private String jumpH5Url=""; + public int getPay_type() { + return pay_type; + } + + public void setPay_type(int pay_type) { + this.pay_type = pay_type; + } + @JSONField(name = "is_return_user") public String getIsReturnUser() { return isReturnUser; diff --git a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java index 70a513e97..490d870dd 100644 --- a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java @@ -29,6 +29,7 @@ import com.yunbao.common.pay.samsung.SamsungUtil; import com.yunbao.common.utils.GoogleUtils; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.main.R; import com.yunbao.main.http.MainHttpUtil; import com.yunbao.main.utils.ColorTransitionPagerTitleView; @@ -63,14 +64,21 @@ public class MyWalletActivity extends AbsActivity { LoadingDialog loadingDialog; SamsungUtil samsungUtil; + int payConfig = 0; + @Override protected int getLayoutId() { return R.layout.activity_my_wallet; } protected void main() { - super.main(); + payConfig= CommonAppConfig.getInstance().getConfig().getPay_type(); + if(CommonAppConfig.IS_GOOGLE_PLAY==0&&payConfig==3){ + ToastUtil.show(WordUtil.isNewZh()?"充值維護中,請稍後再試":"Recharge is under maintenance. Please try again later."); + finish(); + } + mw = MyWalletActivity.this; setTitle(mContext.getString(R.string.wallet)); @@ -87,8 +95,8 @@ public class MyWalletActivity extends AbsActivity { googleUtils.initGooglePay(); } - vp_content = (ViewPager) findViewById(R.id.vp_content); + vp_content.setVisibility(View.VISIBLE); TextView rView = (TextView) findViewById(R.id.rView); findViewById(R.id.redPacketMain).setVisibility(View.VISIBLE); findViewById(R.id.redPacketMain).setOnClickListener(v -> { @@ -153,8 +161,55 @@ public class MyWalletActivity extends AbsActivity { payHandler.post(runnable1); payHandler.postDelayed(runnable2, 2000); } else { - payHandler.post(runnable1); - payHandler.postDelayed(runnable2, 1000); + if(payConfig==1){ + payHandler.post(runnable1); + payHandler.postDelayed(runnable2, 1000); + }else{ + googleUtils.setQueryPurchaseListener(mContext, new GoogleUtils.QueryPurchasesListener() { + @Override + public void onResult(JSONObject obj) { + try { + int code = obj.getInt("querySize"); + if (code == 0) { + payHandler.post(runnable1); + payHandler.postDelayed(runnable2, 1000); + } else { + JSONArray tokenList = obj.getJSONArray("tokenList"); + JSONArray orderList = obj.getJSONArray("orderList"); + String tradeNo = obj.getString("tradeNo"); + + for (int i = 0; i < tokenList.length(); i++) { + int finalI = i; + payHandler.post(new Runnable() { + @Override + public void run() { + //谷歌掉单处理 + try { + CommonHttpUtil.Google_sec_pay(tokenList.getString(finalI), orderList.getString(finalI), tradeNo, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (finalI == tokenList.length() - 1) { + loadingDialog.setShowText(getString(R.string.order_query_success)); + loadingDialog.dismiss(); + } + ToastUtil.show("充值已到账"); + finish(); + } + }); + } catch (JSONException e) { + e.printStackTrace(); + } + } + }); + } + } + } catch (JSONException e) { + e.printStackTrace(); + } + } + }); + googleUtils.queryPurchasesAsync(); + } } }); @@ -224,20 +279,38 @@ public class MyWalletActivity extends AbsActivity { bundle2.putString("url", CommonAppConfig.HOST + "/h5/mall/samsungpaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); samsungFragment2.setArguments(bundle2); } else { - walletFragment = new WalletFragment(); - Bundle bundle = new Bundle(); - bundle.putString("url", CommonAppConfig.HOST + "/h5/mall/walletbean.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - walletFragment.setArguments(bundle); + if(payConfig==1){ + walletFragment = new WalletFragment(); + Bundle bundle = new Bundle(); + bundle.putString("url", CommonAppConfig.HOST + "/h5/mall/walletbean.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + walletFragment.setArguments(bundle); - googleFragment1 = new GoogleFragment(); - Bundle bundle1 = new Bundle(); - bundle1.putString("url", CommonAppConfig.HOST + "/h5/mall/walletcoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - googleFragment1.setArguments(bundle1); + googleFragment1 = new GoogleFragment(); + Bundle bundle1 = new Bundle(); + bundle1.putString("url", CommonAppConfig.HOST + "/h5/mall/walletcoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + googleFragment1.setArguments(bundle1); - googleFragment2 = new GoogleFragment(); - Bundle bundle2 = new Bundle(); - bundle2.putString("url", CommonAppConfig.HOST + "/h5/mall/walletgold.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - googleFragment2.setArguments(bundle2); + googleFragment2 = new GoogleFragment(); + Bundle bundle2 = new Bundle(); + bundle2.putString("url", CommonAppConfig.HOST + "/h5/mall/walletgold.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + googleFragment2.setArguments(bundle2); + }else{ + rView.setVisibility(View.VISIBLE); + walletFragment = new WalletFragment(); + Bundle bundle = new Bundle(); + bundle.putString("url", CommonAppConfig.HOST + "/h5/mall/walletbean.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + walletFragment.setArguments(bundle); + + googleFragment1 = new GoogleFragment(); + Bundle bundle1 = new Bundle(); + bundle1.putString("url", CommonAppConfig.HOST + "/h5/mall/googlepaycoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + googleFragment1.setArguments(bundle1); + + googleFragment2 = new GoogleFragment(); + Bundle bundle2 = new Bundle(); + bundle2.putString("url", CommonAppConfig.HOST + "/h5/mall/googlepaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + googleFragment2.setArguments(bundle2); + } } } else { if (CommonAppConfig.IS_GOOGLE_PLAY == 1) { @@ -293,21 +366,39 @@ public class MyWalletActivity extends AbsActivity { } else { Log.i("tss", "不是首充"); //链接版本 + if(payConfig==1){ + walletFragment = new WalletFragment(); + Bundle bundle = new Bundle(); + bundle.putString("url", CommonAppConfig.HOST + "/h5/mall/walletbean.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + walletFragment.setArguments(bundle); - walletFragment = new WalletFragment(); - Bundle bundle = new Bundle(); - bundle.putString("url", CommonAppConfig.HOST + "/h5/mall/walletbean.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - walletFragment.setArguments(bundle); + googleFragment1 = new GoogleFragment(); + Bundle bundle1 = new Bundle(); + bundle1.putString("url", CommonAppConfig.HOST + "/h5/mall/walletcoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + googleFragment1.setArguments(bundle1); - googleFragment1 = new GoogleFragment(); - Bundle bundle1 = new Bundle(); - bundle1.putString("url", CommonAppConfig.HOST + "/h5/mall/walletcoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - googleFragment1.setArguments(bundle1); + googleFragment2 = new GoogleFragment(); + Bundle bundle2 = new Bundle(); + bundle2.putString("url", CommonAppConfig.HOST + "/h5/mall/walletgold.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + googleFragment2.setArguments(bundle2); + }else{ + rView.setVisibility(View.VISIBLE); - googleFragment2 = new GoogleFragment(); - Bundle bundle2 = new Bundle(); - bundle2.putString("url", CommonAppConfig.HOST + "/h5/mall/walletgold.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); - googleFragment2.setArguments(bundle2); + walletFragment = new WalletFragment(); + Bundle bundle = new Bundle(); + bundle.putString("url", CommonAppConfig.HOST + "/h5/mall/walletbean.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + walletFragment.setArguments(bundle); + + googleFragment1 = new GoogleFragment(); + Bundle bundle1 = new Bundle(); + bundle1.putString("url", CommonAppConfig.HOST + "/h5/mall/googlepaycoin.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + googleFragment1.setArguments(bundle1); + + googleFragment2 = new GoogleFragment(); + Bundle bundle2 = new Bundle(); + bundle2.putString("url", CommonAppConfig.HOST + "/h5/mall/googlepaygole.html?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")); + googleFragment2.setArguments(bundle2); + } } } diff --git a/main/src/main/res/layout/activity_my_wallet.xml b/main/src/main/res/layout/activity_my_wallet.xml index 755794c4b..f6c2b20be 100644 --- a/main/src/main/res/layout/activity_my_wallet.xml +++ b/main/src/main/res/layout/activity_my_wallet.xml @@ -17,6 +17,7 @@