18034727885
2026-07-03 179cac09de002b7c58538f991a26042bbdd6d27d
修复问题
1个文件已添加
4个文件已修改
323 ■■■■■ 已修改文件
app/src/main/java/cn/ptaxi/yuekeduocx/driver/base/local/BasePhotoActivity.kt 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/ptaxi/yuekeduocx/driver/netUtls/Api.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/ptaxi/yuekeduocx/driver/netUtls/MyUploadObserver.java 182 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/ptaxi/yuekeduocx/driver/ui/mine/WithdrawAccountActivity.kt 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/ptaxi/yuekeduocx/driver/utils/AudioRecorderUploadManager.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/cn/ptaxi/yuekeduocx/driver/base/local/BasePhotoActivity.kt
@@ -25,10 +25,9 @@
import cn.ptaxi.yuekeduocx.driver.R
import cn.ptaxi.yuekeduocx.driver.utils.sysErr
import cn.ptaxi.yuekeduocx.driver.base.Const
import cn.ptaxi.yuekeduocx.driver.bean.StringBean
import cn.ptaxi.yuekeduocx.driver.netUtls.Api
import cn.ptaxi.yuekeduocx.driver.netUtls.HttpManager
import cn.ptaxi.yuekeduocx.driver.netUtls.MyObserver
import cn.ptaxi.yuekeduocx.driver.netUtls.MyUploadObserver
import cn.ptaxi.yuekeduocx.driver.ui.DialogUtil
import cn.ptaxi.yuekeduocx.driver.utils.BitmapUtil
import com.tbruyelle.rxpermissions2.RxPermissions
@@ -239,25 +238,24 @@
                Log.e("mmp==========>","path:${filePath}")
                Log.e("mmp==========>","copyFile path:${copyFile}")
                HttpManager.getInstance().post(Api.upImage, copyFile,object :
                    MyObserver(this){
                    override fun success(responseString: String?) {
                        val fromJson = gson.fromJson<StringBean>(responseString, StringBean::class.java)
                        var url = fromJson.data
                        if (!url.isNullOrEmpty()){
                            showNum--
                            Handler(mainLooper).post {
                                Log.d("showNum==", "showNum==========" + showNum.toString())
                                sysErr(url)
                                if (showNum <= 0)
                                    dismissDialog()
                                getPhoneUrl(url!!, type, copyFile.absolutePath)
                                getPhoneUrl(url, type)
                            }
                        }else{
                            showNum--
                HttpManager.getInstance().post(Api.upImage, copyFile, object :
                    MyUploadObserver(this) {
                    override fun success(responseString: String) {
                        showNum--
                        Handler(mainLooper).post {
                            Log.d("showNum==", "showNum==========$showNum")
                            sysErr(responseString)
                            if (showNum <= 0)
                                dismissDialog()
                            getPhoneUrl(responseString, type, copyFile.absolutePath)
                            getPhoneUrl(responseString, type)
                        }
                    }
                    override fun onError(code: Int, msg: String?, resposeString: String?) {
                        super.onError(code, msg, resposeString)
                        showNum--
                    }
                })
//                val ossUtil = OSSUtil(this)
app/src/main/java/cn/ptaxi/yuekeduocx/driver/netUtls/Api.java
@@ -35,12 +35,12 @@
//    public static final String strShare = "http://123.56.89.63:8443/share/shareIndex.html";
//    public static final String strShareDriver = "http://123.56.89.63:8443/driverShare/qr.html";
    public static final String strShare = "http://zhentonggongsi.com/share/shareIndex.html";
    public static final String strShare = "http://rideapi.yuekeduo.com.cn/share/shareIndex.html";
//    public static final String strShare = "http://123.56.89.63:8443/share/shareIndex.html";
    public static final String strShareDriver = "http://zhentonggongsi.com/driverShare/qr.html";
    public static final String strShareDriver = "http://rideapi.yuekeduo.com.cn/driverShare/qr.html";
    public static String upImage = "https://traffic.qytzt.cn/upload/image"; //上传
    public static String upImage = "https://rideapi.yuekeduo.com.cn/upload/image"; //上传
//    public static String upImage = "http://192.168.110.106:8010/upload/image"; //上传
    /**
app/src/main/java/cn/ptaxi/yuekeduocx/driver/netUtls/MyUploadObserver.java
New file
@@ -0,0 +1,182 @@
package cn.ptaxi.yuekeduocx.driver.netUtls;
import android.graphics.Bitmap;
import android.util.Log;
import com.google.gson.JsonSyntaxException;
import java.lang.ref.WeakReference;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import cn.ptaxi.yuekeduocx.driver.base.MyApplication;
import cn.ptaxi.yuekeduocx.driver.utils.LogUtils;
import cn.sinata.xldutils.activitys.BaseActivity;
import cn.sinata.xldutils.fragment.BaseFragment;
import cn.sinata.xldutils.net.utils.ResultException;
import cn.sinata.xldutils.utils.StringUtils;
import cn.sinata.xldutils.utils.Toast;
import cn.sinata.xldutils.utils.Utils;
import cn.sinata.xldutils.xldUtils;
import io.reactivex.Observer;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import okhttp3.ResponseBody;
import retrofit2.HttpException;
/**
 * 自定义Observer类处理网络上传文件 返回链接地址数据
 * Created by Administrator on 2018/1/25.
 */
public abstract class MyUploadObserver implements Observer<ResponseBody>, Disposable {
    WeakReference<BaseActivity> activities;
    WeakReference<BaseFragment> fragments;
    public static final String REQUEST_ERROR = "请求出错!";
    public static final String PARSER_ERROR = "数据解析出错!";
    public static final String SERVER_ERROR = "服务器异常,请稍后重试!";
    public static final String NET_ERROR = "未连接到服务器!";
    public static final String NET_TIMEOUT = "链接超时,请稍后再试!";
    public MyUploadObserver(BaseActivity activity) {
        activities = new WeakReference<>(activity);
        if (activity != null) {
            activity.compositeSubscription.add(this);
        }
    }
    public MyUploadObserver(BaseFragment fragment) {
        fragments = new WeakReference<BaseFragment>(fragment);
        if (fragment != null && !fragment.isDetached()) {
            fragment.addDisposable(this);
        }
    }
    public MyUploadObserver() {
    }
    @Override
    public void onSubscribe(@NonNull Disposable d) {
    }
    @Override
    public void onNext(@NonNull ResponseBody responseBody) {
        dismissDialog();
        try {
            String responseString = responseBody.string().replaceAll("\"","");
            LogUtils.e("responseString", "**" + responseString);
            if (StringUtils.isEmpty(responseString)) { //判空
                int code = -1;
                String msg = PARSER_ERROR;
                onError(code, msg, responseString);
                return;
            }
            if (responseString.startsWith("http")) {
                success(responseString);
            } else {
                onError(-1, "上传失败", responseString);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Override
    public void onError(@NonNull Throwable e) {
        dismissDialog();
        if (xldUtils.DEBUG) {
            e.printStackTrace();
        }
        Utils.systemErr(e);
        Log.e("responseString", "responseString get  " + e.toString());
        int code = -1;
        String msg = REQUEST_ERROR;
        if (e instanceof JsonSyntaxException ||
                e instanceof NumberFormatException ||
                e instanceof IllegalStateException) {
            msg = PARSER_ERROR;
        } else if (e instanceof HttpException) {
            msg = SERVER_ERROR;
        } else if (e instanceof ConnectException) {
            msg = NET_ERROR;
        } else if (e instanceof SocketTimeoutException) {
            msg = NET_TIMEOUT;
        } else if (e instanceof ResultException) {
            code = ((ResultException) e).getCode();
            msg = e.getMessage();
        }
        try {
            onError(code, msg, "");
        } catch (Exception es) {
            es.printStackTrace();
        }
    }
    protected void onError(int code, String msg, String resposeString) {
        if (shouldShowErrorToast()) {
            showToast(msg);
        }
    }
    protected boolean shouldShowErrorToast() {
        return true;
    }
    @Override
    public void onComplete() {
    }
    /**
     * 显示toast
     *
     * @param s 提示文字
     */
    protected void showToast(String s) {
        Toast.create(MyApplication.Companion.getInstance()).show(s);
    }
    /**
     * 访问成功回调抽象方法
     *
     * @param responseString 返回的数据
     */
    public abstract void success(String responseString);
    /**
     * 访问成功回调方法
     *
     * @param bitmap 获取的Bitmap
     */
    public void success(Bitmap bitmap) {
    }
    private void dismissDialog() {
        if (activities != null) {
            BaseActivity activity = activities.get();
            if (activity != null) {
                activity.dismissDialog();
            }
        }
        if (fragments != null) {
            BaseFragment fragment = fragments.get();
            if (fragment != null) {
                fragment.dismissDialog();
            }
        }
    }
    @Override
    public boolean isDisposed() {
        return false;
    }
    @Override
    public void dispose() {
    }
}
app/src/main/java/cn/ptaxi/yuekeduocx/driver/ui/mine/WithdrawAccountActivity.kt
@@ -5,27 +5,39 @@
import android.os.CountDownTimer
import android.os.Environment
import android.util.Log
import cn.ptaxi.yuekeduocx.driver.utils.isValidIdCard
import cn.ptaxi.yuekeduocx.driver.utils.isValidPhone
import cn.ptaxi.yuekeduocx.driver.utils.visible
import cn.ptaxi.yuekeduocx.driver.IdCardDateRangeDialog
import cn.ptaxi.yuekeduocx.driver.R
import cn.ptaxi.yuekeduocx.driver.SelectPhotoDialogKt
import cn.ptaxi.yuekeduocx.driver.base.MyApplication
import cn.ptaxi.yuekeduocx.driver.base.MyBaseActivity
import cn.ptaxi.yuekeduocx.driver.bean.StringBean
import cn.ptaxi.yuekeduocx.driver.bean.UserBankInfo
import cn.ptaxi.yuekeduocx.driver.netUtls.Api
import cn.ptaxi.yuekeduocx.driver.netUtls.HttpManager
import cn.ptaxi.yuekeduocx.driver.netUtls.MyObserver
import cn.ptaxi.yuekeduocx.driver.netUtls.MyUploadObserver
import cn.ptaxi.yuekeduocx.driver.netUtls.callNet
import cn.ptaxi.yuekeduocx.driver.netUtls.getMapByAny
import cn.ptaxi.yuekeduocx.driver.netUtls.upload
import cn.ptaxi.yuekeduocx.driver.bean.StringBean
import cn.ptaxi.yuekeduocx.driver.bean.UserBankInfo
import cn.ptaxi.yuekeduocx.driver.netUtls.*
import cn.ptaxi.yuekeduocx.driver.utils.Cache.CacheKey
import cn.ptaxi.yuekeduocx.driver.utils.glide.GlideUtil
import kotlinx.android.synthetic.main.activity_mine.*
import kotlinx.android.synthetic.main.activity_withdraw_account.*
import cn.ptaxi.yuekeduocx.driver.utils.isValidIdCard
import cn.ptaxi.yuekeduocx.driver.utils.isValidPhone
import cn.ptaxi.yuekeduocx.driver.utils.visible
import kotlinx.android.synthetic.main.activity_withdraw_account.et_bank_name
import kotlinx.android.synthetic.main.activity_withdraw_account.et_bank_num
import kotlinx.android.synthetic.main.activity_withdraw_account.et_code
import kotlinx.android.synthetic.main.activity_withdraw_account.et_id_card
import kotlinx.android.synthetic.main.activity_withdraw_account.et_name
import kotlinx.android.synthetic.main.activity_withdraw_account.et_phone
import kotlinx.android.synthetic.main.activity_withdraw_account.et_provider
import kotlinx.android.synthetic.main.activity_withdraw_account.et_pwd
import kotlinx.android.synthetic.main.activity_withdraw_account.iv_back
import kotlinx.android.synthetic.main.activity_withdraw_account.iv_front
import kotlinx.android.synthetic.main.activity_withdraw_account.tv_action
import kotlinx.android.synthetic.main.activity_withdraw_account.tv_bank
import kotlinx.android.synthetic.main.activity_withdraw_account.tv_date
import kotlinx.android.synthetic.main.activity_withdraw_account.tv_get_code
import kotlinx.android.synthetic.main.activity_withdraw_account.tv_success
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.startActivityForResult
import org.jetbrains.anko.toast
@@ -313,23 +325,30 @@
                                backImg = ""
                            }
                            showDialog()
                            HttpManager.getInstance().post(Api.upImage, file,object : MyObserver(this@WithdrawAccountActivity){
                                override fun success(responseString: String?) {
                                    val fromJson = gson.fromJson<StringBean>(responseString, StringBean::class.java)
                                    var url = fromJson.data
                                    if (!url.isNullOrEmpty()){
                                        if (requestCode == 2){
                                            frontImg = url
                                            GlideUtil.load(MyApplication.getInstance(), frontImg, iv_front,0)
                            HttpManager.getInstance().post(
                                Api.upImage,
                                file,
                                object : MyUploadObserver(this@WithdrawAccountActivity) {
                                    override fun success(responseString: String) {
                                        if (requestCode == 2) {
                                            frontImg = responseString
                                            GlideUtil.load(
                                                MyApplication.getInstance(),
                                                frontImg,
                                                iv_front,
                                                0
                                            )
                                        } else {
                                            backImg = responseString
                                            GlideUtil.load(
                                                MyApplication.getInstance(),
                                                backImg,
                                                iv_back,
                                                0
                                            )
                                        }
                                        else{
                                            backImg = url
                                            GlideUtil.load(MyApplication.getInstance(), backImg, iv_back,0)
                                        }
                                    }else
                                        toast(fromJson.msg ?: "上传失败")
                                }
                            })
                                    }
                                })
                            upload(true,
                                Api.uploadImg,file){
app/src/main/java/cn/ptaxi/yuekeduocx/driver/utils/AudioRecorderUploadManager.java
@@ -11,11 +11,6 @@
import com.google.gson.Gson;
import com.tbruyelle.rxpermissions2.RxPermissions;
import cn.ptaxi.yuekeduocx.driver.bean.StringBean;
import cn.ptaxi.yuekeduocx.driver.netUtls.Api;
import cn.ptaxi.yuekeduocx.driver.netUtls.HttpManager;
import cn.ptaxi.yuekeduocx.driver.netUtls.MyDefaultObserver;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@@ -25,6 +20,10 @@
import java.util.Map;
import java.util.Set;
import cn.ptaxi.yuekeduocx.driver.netUtls.Api;
import cn.ptaxi.yuekeduocx.driver.netUtls.HttpManager;
import cn.ptaxi.yuekeduocx.driver.netUtls.MyDefaultObserver;
import cn.ptaxi.yuekeduocx.driver.netUtls.MyUploadObserver;
import lombok.NonNull;
/**
@@ -242,18 +241,19 @@
     * @param file      录制音频文件
     */
    private void uploadAudioFile(String orderId, String orderType, @NonNull File file) {
        HttpManager.getInstance().post(Api.upImage, file, new MyDefaultObserver() {
        HttpManager.getInstance().post(Api.upImage, file, new MyUploadObserver() {
            @Override
            public void success(String responseString) {
                StringBean bean = gson.fromJson(responseString, StringBean.class);
                if (!TextUtils.isEmpty(bean.data)) {
                    Log.d(TAG, "upload success file==>" + file.getAbsolutePath() + " url==>" + bean.data);
                    saveAudioFileUploadResult(orderId, orderType, bean.data);
                    deleteAudioFiles(orderId, orderType);
                    saveOrderAudioUrl(orderId, orderType, bean.data);
                } else {
                    Log.d(TAG, "upload failed file==>" + file.getAbsolutePath());
                }
                Log.d(TAG, "upload success file==>" + file.getAbsolutePath() + " url==>" + responseString);
                saveAudioFileUploadResult(orderId, orderType, responseString);
                deleteAudioFiles(orderId, orderType);
                saveOrderAudioUrl(orderId, orderType, responseString);
            }
            @Override
            protected void onError(int code, String msg, String resposeString) {
                super.onError(code, msg, resposeString);
                Log.d(TAG, "upload failed file==>" + file.getAbsolutePath());
            }
            @Override