From 77d659467e0f91df9fc2b6b0da17681f49e0978d Mon Sep 17 00:00:00 2001 From: level <1364007522@qq.com> Date: Thu, 22 Aug 2024 15:51:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=9A=E5=A4=87?= =?UTF-8?q?=E7=94=A8=E5=85=85=E5=80=BC=E7=95=8C=E9=9D=A2=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E4=BD=BF=E7=94=A8=E6=9C=8D=E5=8A=A1=E7=AB=AF=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E8=BF=9B=E7=A8=8B=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fragment/recharge/RechargeFragment.kt | 36 +++++++++++++++++-- .../yingmao/clash/net/http/entity/PayRsp.kt | 19 +++++++++- .../main/res/layout/backup_payment_dialog.xml | 4 +-- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/yingmao/clash/fragment/recharge/RechargeFragment.kt b/app/src/main/java/com/yingmao/clash/fragment/recharge/RechargeFragment.kt index fb2fccd..a1abe87 100644 --- a/app/src/main/java/com/yingmao/clash/fragment/recharge/RechargeFragment.kt +++ b/app/src/main/java/com/yingmao/clash/fragment/recharge/RechargeFragment.kt @@ -547,6 +547,8 @@ class RechargeFragment : BaseFragment() { } private fun orderPayment(data: Trade) { + val jhPay = data.payType?.get(0)?.payChannel + val kjPay = data.payType?.get(2)?.payChannel activity?.let { MaterialDialog(it).show { this.cancelable(true) @@ -557,16 +559,44 @@ class RechargeFragment : BaseFragment() { noVerticalPadding = true, horizontalPadding = false ) + if (jhPay != null) { + findViewById(R.id.JUhePay).text = jhPay + } + if (kjPay != null) { + findViewById(R.id.KJPay).text = kjPay + } getCustomView().findViewById(R.id.ivAlipay).setOnClickListener { - viewModel.orderPayment(data, 10, 1, "ip@影猫充值") + val payModel = data.payType?.get(0)?.payModel + val payType = data.payType?.get(0)?.payType + val payParam = data.payType?.get(0)?.payParam + if (payModel != null && payType != null && payParam != null) { + viewModel.orderPayment(data, payModel, payType, payParam) + } else { + viewModel.orderPayment(data, 10, 1, "ip@影猫充值") + } } getCustomView().findViewById(R.id.ivWechatPay) .setOnClickListener { - viewModel.orderPayment(data, 10, 2, "ip@影猫充值") + val payModel = data.payType?.get(1)?.payModel + val payType = data.payType?.get(1)?.payType + val payParam = data.payType?.get(1)?.payParam + if (payModel != null && payType != null && payParam != null) { + viewModel.orderPayment(data, payModel, payType, payParam) + } else { + viewModel.orderPayment(data, 10, 2, "ip@影猫充值") + } + } getCustomView().findViewById(R.id.ivQuickPayment) .setOnClickListener { - viewModel.orderPayment(data, 11, 1, "ip@影猫充值") + val payModel = data.payType?.get(2)?.payModel + val payType = data.payType?.get(2)?.payType + val payParam = data.payType?.get(2)?.payParam + if (payModel != null && payType != null && payParam != null) { + viewModel.orderPayment(data, payModel, payType, payParam) + } else { + viewModel.orderPayment(data, 11, 1, "ip@影猫充值") + } } getCustomView().findViewById(R.id.ivBack).setOnClickListener { dismiss() diff --git a/app/src/main/java/com/yingmao/clash/net/http/entity/PayRsp.kt b/app/src/main/java/com/yingmao/clash/net/http/entity/PayRsp.kt index 6510ec9..bbdd9d6 100644 --- a/app/src/main/java/com/yingmao/clash/net/http/entity/PayRsp.kt +++ b/app/src/main/java/com/yingmao/clash/net/http/entity/PayRsp.kt @@ -24,7 +24,8 @@ data class PayRsp( data class Trade( @field:SerializedName("payUrl") var payUrl: String? = null, - + @field:SerializedName("payType") + var payType: List? = null, @field:SerializedName("totalFee") val totalFee: String? = null, @@ -42,6 +43,22 @@ data class Trade( } } +data class PayType( + @field:SerializedName("id") + var id: Int? = null, + @field:SerializedName("templateId") + var templateId: Int? = null, + @field:SerializedName("payModel") + var payModel: Int? = null, + @field:SerializedName("payChannel") + var payChannel: String? = null, + @field:SerializedName("payType") + var payType: Int? = null, + @field:SerializedName("payParam") + var payParam: String? = null, + @field:SerializedName("payOrder") + var payOrder: Int? = null, +) //汇旺财 data class QRPayRsp(@field:SerializedName("msg") val msg: String? = null, diff --git a/app/src/main/res/layout/backup_payment_dialog.xml b/app/src/main/res/layout/backup_payment_dialog.xml index d9a53cb..0c5970b 100644 --- a/app/src/main/res/layout/backup_payment_dialog.xml +++ b/app/src/main/res/layout/backup_payment_dialog.xml @@ -26,7 +26,7 @@ android:layout_marginTop="20dp" > Date: Tue, 27 Aug 2024 16:26:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C=E6=88=90=E5=8A=9F=E5=90=8E?= =?UTF-8?q?,=E9=A6=96=E6=AC=A1=E5=90=AF=E5=8A=A8=E6=97=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E4=B8=AA=E5=BC=B9=E7=AA=97=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yingmao/clash/act/NewMainActivity.kt | 25 +++++++++++-- .../com/yingmao/clash/act/SplashActivity.kt | 5 +++ .../com/yingmao/clash/conf/BZYConstants.kt | 1 + .../main/res/layout/first_entry_layout.xml | 36 +++++++++++++++++++ app/src/main/res/values/strings.xml | 2 ++ 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/layout/first_entry_layout.xml diff --git a/app/src/main/java/com/yingmao/clash/act/NewMainActivity.kt b/app/src/main/java/com/yingmao/clash/act/NewMainActivity.kt index 575a565..32a8049 100644 --- a/app/src/main/java/com/yingmao/clash/act/NewMainActivity.kt +++ b/app/src/main/java/com/yingmao/clash/act/NewMainActivity.kt @@ -10,6 +10,7 @@ import android.content.pm.PackageManager import android.net.Uri import android.os.Build import android.os.Bundle +import android.os.Handler import android.text.TextUtils import android.view.View import android.widget.ImageView @@ -44,7 +45,6 @@ import com.yingmao.clash.entity.CheckLoginRsp import com.yingmao.clash.fragment.NewAccFragment import com.yingmao.clash.fragment.mine.MineFragment import com.yingmao.clash.fragment.recharge.BackupRechargeActivity -import com.yingmao.clash.fragment.recharge.RechargeFragment import com.yingmao.clash.listener.DownLoadListener import com.yingmao.clash.net.http.HttpApi import com.yingmao.clash.net.http.HttpReqType @@ -84,7 +84,8 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody import java.io.File import java.text.SimpleDateFormat -import java.util.* +import java.util.Date +import java.util.UUID class NewMainActivity : BaseActivity() { @@ -220,8 +221,28 @@ class NewMainActivity : BaseActivity() { startLog() // showBindAccount() + firstEntry() } + private fun firstEntry() { + val decodeBool = + MMKV.defaultMMKV().decodeBool(BZYConstants.INITIALIZATION, true) + if ((decodeBool)) { + MaterialDialog(this).show { + cornerRadius(res = R.dimen.dp_10) + customView( + R.layout.first_entry_layout, + scrollable = false, + noVerticalPadding = true, + horizontalPadding = false + ) + getCustomView().findViewById(R.id.determine).setOnClickListener { + MMKV.defaultMMKV().encode(BZYConstants.INITIALIZATION, false) + dismiss() + } + } + } + } private fun startLog() { launch(Dispatchers.IO) { diff --git a/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt b/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt index 481481f..ab1aee6 100644 --- a/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt +++ b/app/src/main/java/com/yingmao/clash/act/SplashActivity.kt @@ -376,6 +376,11 @@ class SplashActivity : BaseActivity() { val encryPsw = AESUtil.byteArrayToHexStr( AESUtil.encrypt(BZYConstants.defaultPassword) ) + val decodeBool = + MMKV.defaultMMKV().decodeBool(BZYConstants.INITIALIZATION, false) + if (decodeBool) { + MMKV.defaultMMKV().encode(BZYConstants.INITIALIZATION, true) + } splashAtyVM.login(encryName, encryPsw) } else if (code == "20062") { message?.let { diff --git a/app/src/main/java/com/yingmao/clash/conf/BZYConstants.kt b/app/src/main/java/com/yingmao/clash/conf/BZYConstants.kt index 4eb5f33..a72ef6e 100644 --- a/app/src/main/java/com/yingmao/clash/conf/BZYConstants.kt +++ b/app/src/main/java/com/yingmao/clash/conf/BZYConstants.kt @@ -102,5 +102,6 @@ class BZYConstants { const val GoSeaShareUrl = "https://reg.cannmaxllc.com/page/register.html?userId=" const val BackHomeShareUrl = "https://38.180.8.92:8080/page/register.html?userId=" // const val shareTextHost = "嗨,一个稳定好用的加速器,打开链接注册免费体验吧=> https://38.180.8.92:8080/page/register.html?userId=" + const val INITIALIZATION = "is_initialization" } } \ No newline at end of file diff --git a/app/src/main/res/layout/first_entry_layout.xml b/app/src/main/res/layout/first_entry_layout.xml new file mode 100644 index 0000000..ca9b1fa --- /dev/null +++ b/app/src/main/res/layout/first_entry_layout.xml @@ -0,0 +1,36 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 40efe07..99775ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -392,4 +392,6 @@ 验证失败,还剩%d次机会 聚合支付(推荐) 快捷支付 + 免费时长已赠送,如果出现初始化,请等待一分钟后关闭app重新打开 + 确定 \ No newline at end of file