链接包控制支付方式,新增pay_type

This commit is contained in:
Martin 2024-10-14 14:03:24 +08:00
parent ad895b54d1
commit 9e6443293d
3 changed files with 129 additions and 28 deletions

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -17,6 +17,7 @@
<androidx.viewpager.widget.ViewPager
android:id="@+id/vp_content"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />