tj
2025-03-28 dde2eeddbaf07246da7c2c352e7d49ec63fddcd2
app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt
@@ -31,6 +31,7 @@
import com.google.android.material.snackbar.Snackbar
import kotlinx.coroutines.launch
import com.bumptech.glide.Glide
import com.example.firstapp.activity.VipActivity
import com.example.firstapp.database.response.UserInfo
class NotificationsFragment : Fragment() {
@@ -130,37 +131,37 @@
    private fun setupClickListeners() {
        // 支付插件
        binding.payPlugin.setOnClickListener {
            // 跳转到支付插件页面
            lifecycleScope.launch {
                try {
                    val response = RetrofitClient.apiService.getPayOrderInfo()
                    var orderInfo=response.data
                    Log.d("AliPayHelper","获取订单信息时: ${response}")
                    // 这里调用支付宝
                    PayAbility.aliPay(requireActivity(), orderInfo, Observer {
                        when (it.resultStatus) {
                            "9000" -> {
//                                Snackbar.make(binding.root, "支付成功", Snackbar.LENGTH_LONG).show()
                                requireActivity().runOnUiThread {
                                    Toast.makeText(requireContext(), "支付成功", Toast.LENGTH_LONG).show()
                                }
                            }
                            else -> {
//                                Snackbar.make(binding.root, "支付失败", Snackbar.LENGTH_LONG).show()
                                requireActivity().runOnUiThread {
                                    Toast.makeText(requireContext(), "支付失败", Toast.LENGTH_LONG).show()
                                }
                            }
                        }
                    })
                } catch (e: Exception) {
                    Log.d("AliPayHelper","获取订单信息时发生错误: ${e.message}")
                }
            }
        }
//        binding.payPlugin.setOnClickListener {
//            // 跳转到支付插件页面
//            lifecycleScope.launch {
//                try {
//                    val response = RetrofitClient.apiService.getPayOrderInfo()
//                    var orderInfo=response.data
//                    Log.d("AliPayHelper","获取订单信息时: ${response}")
//                    // 这里调用支付宝
//                    PayAbility.aliPay(requireActivity(), orderInfo, Observer {
//                        when (it.resultStatus) {
//                            "9000" -> {
////                                Snackbar.make(binding.root, "支付成功", Snackbar.LENGTH_LONG).show()
//                                requireActivity().runOnUiThread {
//                                    Toast.makeText(requireContext(), "支付成功", Toast.LENGTH_LONG).show()
//                                }
//                            }
//                            else -> {
////                                Snackbar.make(binding.root, "支付失败", Snackbar.LENGTH_LONG).show()
//                                requireActivity().runOnUiThread {
//                                    Toast.makeText(requireContext(), "支付失败", Toast.LENGTH_LONG).show()
//                                }
//
//                            }
//                        }
//                    })
//
//                } catch (e: Exception) {
//                    Log.d("AliPayHelper","获取订单信息时发生错误: ${e.message}")
//                }
//            }
//        }
        // 设置提醒
@@ -210,7 +211,6 @@
        // 隐私协议
        binding.layoutPrivacy.setOnClickListener {
            startContentActivity("privacy_policy", "隐私协议")
            startActivity(intent)
        }
        // 使用教程
@@ -233,7 +233,10 @@
        // VIP续费
        binding.btnRenew.setOnClickListener {
            Toast.makeText(context, "VIP续费功能开发中", Toast.LENGTH_SHORT).show()
//            Toast.makeText(context, "VIP续费功能开发中", Toast.LENGTH_SHORT).show()
            // 跳转到vipActivity
            val intent = Intent(requireContext(), VipActivity::class.java)
            startActivity(intent)
        }
    }