Commit 874a9bc8 authored by 赵鹏翔's avatar 赵鹏翔

update

parent d705b072
...@@ -50,7 +50,6 @@ public class LFilePickerActivity extends BaseActivity { ...@@ -50,7 +50,6 @@ public class LFilePickerActivity extends BaseActivity {
private ArrayList<String> mListNumbers = new ArrayList<String>();//存放选中条目的数据地址 private ArrayList<String> mListNumbers = new ArrayList<String>();//存放选中条目的数据地址
private String mQrCodeEncodeMsg; private String mQrCodeEncodeMsg;
private byte[] dialogLock = new byte[0]; private byte[] dialogLock = new byte[0];
public static boolean isProhibitWrite = false;//是否禁止写入文件
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -255,7 +254,7 @@ public class LFilePickerActivity extends BaseActivity { ...@@ -255,7 +254,7 @@ public class LFilePickerActivity extends BaseActivity {
} }
public void uploadFile(String path) { public void uploadFile(String path) {
// isProhibitWrite = true; // LogFileUtils.INSTANCE.setProhibitWrite(true);
// String equType = getEquType(); // String equType = getEquType();
// //
// File file = new File(path); // File file = new File(path);
...@@ -272,7 +271,7 @@ public class LFilePickerActivity extends BaseActivity { ...@@ -272,7 +271,7 @@ public class LFilePickerActivity extends BaseActivity {
// long size = file.length(); // long size = file.length();
// if(size > 34307335){ // if(size > 34307335){
// ToastUtils.showLong("日志文件过大"); // ToastUtils.showLong("日志文件过大");
// isProhibitWrite = false; // LogFileUtils.INSTANCE.setProhibitWrite(false);
// hidProgressDialog(); // hidProgressDialog();
// return; // return;
// } // }
...@@ -286,7 +285,7 @@ public class LFilePickerActivity extends BaseActivity { ...@@ -286,7 +285,7 @@ public class LFilePickerActivity extends BaseActivity {
// @Override // @Override
// public void call(HttpResult s) { // public void call(HttpResult s) {
// hidProgressDialog(); // hidProgressDialog();
// isProhibitWrite = false; // LogFileUtils.INSTANCE.setProhibitWrite(false);
// successToast = Toasty.success(LFilePickerActivity.this, "文件上传成功!"); // successToast = Toasty.success(LFilePickerActivity.this, "文件上传成功!");
// successToast.show(); // successToast.show();
// showQrImageIfNeeded(); // showQrImageIfNeeded();
...@@ -295,7 +294,7 @@ public class LFilePickerActivity extends BaseActivity { ...@@ -295,7 +294,7 @@ public class LFilePickerActivity extends BaseActivity {
// @Override // @Override
// public void call(Throwable throwable) { // public void call(Throwable throwable) {
// hidProgressDialog(); // hidProgressDialog();
// isProhibitWrite = false; // LogFileUtils.INSTANCE.setProhibitWrite(false);
// Toasty.error(LFilePickerActivity.this, "文件上传失败!").show(); // Toasty.error(LFilePickerActivity.this, "文件上传失败!").show();
// } // }
// }); // });
......
...@@ -11,8 +11,8 @@ import com.miya.fastcashier.BuildConfig; ...@@ -11,8 +11,8 @@ import com.miya.fastcashier.BuildConfig;
import com.miya.fastcashier.R; import com.miya.fastcashier.R;
import com.miya.fastcashier.beans.SelfCashierAccountInfo; import com.miya.fastcashier.beans.SelfCashierAccountInfo;
import com.miya.fastcashier.databinding.DialogSystemParameterBinding; import com.miya.fastcashier.databinding.DialogSystemParameterBinding;
import com.miya.fastcashier.net.ApiService;
import com.miya.fastcashier.service.AccountService; import com.miya.fastcashier.service.AccountService;
import com.miya.fastcashier.service.LoginService;
import com.miya.fastcashier.utils.BaseFunctionKt; import com.miya.fastcashier.utils.BaseFunctionKt;
import com.miya.print.PrinterManager; import com.miya.print.PrinterManager;
...@@ -44,7 +44,7 @@ public class SystemParameterDialog extends Dialog { ...@@ -44,7 +44,7 @@ public class SystemParameterDialog extends Dialog {
setInfo(viewBinding.tvCashier, accountInfo.getShopInfo().getOperatorId()); setInfo(viewBinding.tvCashier, accountInfo.getShopInfo().getOperatorId());
setInfo(viewBinding.tvVersionType, "fastCashier_" + BuildConfig.appType); setInfo(viewBinding.tvVersionType, "fastCashier_" + BuildConfig.appType);
setInfo(viewBinding.tvEquipment, "sunmi_v2pro"); setInfo(viewBinding.tvEquipment, "sunmi_v2pro");
setInfo(viewBinding.tvServerUrl, LoginService.Companion.getBaseUrl()); setInfo(viewBinding.tvServerUrl, ApiService.Companion.getBaseUrl());
setInfo(viewBinding.tvWifiName, BaseFunctionKt.getWifyName(getContext())); setInfo(viewBinding.tvWifiName, BaseFunctionKt.getWifyName(getContext()));
setInfo(viewBinding.tvNetIp, BaseFunctionKt.getNetIp(getContext()) == null ? "未知" : BaseFunctionKt.getNetIp(getContext())); setInfo(viewBinding.tvNetIp, BaseFunctionKt.getNetIp(getContext()) == null ? "未知" : BaseFunctionKt.getNetIp(getContext()));
setInfo(viewBinding.tvPrintType, PrinterManager.getInstance().getPrinter() == null ? setInfo(viewBinding.tvPrintType, PrinterManager.getInstance().getPrinter() == null ?
......
package com.miya.fastcashier.service package com.miya.fastcashier.net
import android.util.Log import android.util.Log
import com.miya.fastcashier.beans.SelfCashierAccountInfo import com.miya.fastcashier.beans.SelfCashierAccountInfo
...@@ -13,18 +13,16 @@ import retrofit2.http.Body ...@@ -13,18 +13,16 @@ import retrofit2.http.Body
import retrofit2.http.POST import retrofit2.http.POST
interface LoginService { interface ApiService {
@POST("verify/auth/token")
suspend fun login(@Body loginRequestCall: LoginRequest): BaseResult<SelfCashierAccountInfo>
companion object { companion object {
private const val BASE_URL = "https://hhms.miyapay.com/" const val LOGIN: String = "verify/auth/token"
private var service: LoginService? = null private const val BASE_URL = "https://hhms.miyapay.com/"
private var service: ApiService? = null
fun getApi(): LoginService { fun getApi(): ApiService {
if (null == service) { if (null == service) {
val httpLoggingInterceptor = val httpLoggingInterceptor =
MiyaHttpLoggingInterceptor { MiyaHttpLoggingInterceptor {
...@@ -41,15 +39,18 @@ interface LoginService { ...@@ -41,15 +39,18 @@ interface LoginService {
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.build() .build()
service = retrofit.create(LoginService::class.java) service = retrofit.create(ApiService::class.java)
} }
return service!! return service!!
} }
fun getBaseUrl():String{ fun getBaseUrl(): String {
return BASE_URL return BASE_URL
} }
} }
@POST(LOGIN)
suspend fun login(@Body loginRequestCall: LoginRequest): BaseResult<SelfCashierAccountInfo>
} }
\ No newline at end of file
...@@ -8,9 +8,8 @@ import com.miya.fastcashier.R ...@@ -8,9 +8,8 @@ import com.miya.fastcashier.R
import com.miya.fastcashier.beans.LoginFormState import com.miya.fastcashier.beans.LoginFormState
import com.miya.fastcashier.beans.LoginRequest import com.miya.fastcashier.beans.LoginRequest
import com.miya.fastcashier.beans.SelfCashierAccountInfo import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.net.ApiService
import com.miya.fastcashier.net.BaseResult import com.miya.fastcashier.net.BaseResult
import com.miya.fastcashier.service.LoginService
import com.miya.fastcashier.utils.manage.LocalKeyDataMKManageKit
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
...@@ -25,14 +24,9 @@ class LoginViewModel : ViewModel() { ...@@ -25,14 +24,9 @@ class LoginViewModel : ViewModel() {
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
try { try {
val result = Result.success( val result = Result.success(
errorHandle(LoginService.getApi().login(LoginRequest(userName, passWord, ""))) errorHandle(ApiService.getApi().login(LoginRequest(userName, passWord, "")))
) )
// val balanceDate = LocalKeyDataMKManageKit.getBalanceDate()
// if (balanceDate <= 0L) {
// //todo 改成服务器时间
// LocalKeyDataMKManageKit.putBalanceDate(System.currentTimeMillis())
// }
loginLiveData.postValue(result) loginLiveData.postValue(result)
} catch (e: Exception) { } catch (e: Exception) {
loginLiveData.postValue(Result.failure(e)) loginLiveData.postValue(Result.failure(e))
......
...@@ -3,18 +3,15 @@ package com.miya.fastcashier.viewmodel ...@@ -3,18 +3,15 @@ package com.miya.fastcashier.viewmodel
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.miya.fastcashier.beans.LoginRequest
import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.beans.ViewOrderStatisticsInfo import com.miya.fastcashier.beans.ViewOrderStatisticsInfo
import com.miya.fastcashier.repository.PayRepository import com.miya.fastcashier.repository.PayRepository
import com.miya.fastcashier.service.AccountService import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.service.LoginService
import com.miya.fastcashier.service.PrintService import com.miya.fastcashier.service.PrintService
import com.miya.fastcashier.utils.DateUtils import com.miya.fastcashier.utils.DateUtils
import com.sdy.miya.moblie.component.pay.platform.bean.MiyaOrderRefundResponse import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.* import kotlinx.coroutines.async
import java.lang.Exception import kotlinx.coroutines.launch
import java.lang.RuntimeException import kotlinx.coroutines.runBlocking
import java.util.* import java.util.*
import kotlin.collections.HashMap import kotlin.collections.HashMap
......
...@@ -5,25 +5,16 @@ import androidx.lifecycle.MutableLiveData ...@@ -5,25 +5,16 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.alibaba.fastjson.JSON import com.alibaba.fastjson.JSON
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.NumberUtils
import com.elvishew.xlog.XLog import com.elvishew.xlog.XLog
import com.miya.fastcashier.beans.LoginRequest
import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.beans.ViewPayOrderData import com.miya.fastcashier.beans.ViewPayOrderData
import com.miya.fastcashier.dao.DatabaseKeeper
import com.miya.fastcashier.repository.PayRepository import com.miya.fastcashier.repository.PayRepository
import com.miya.fastcashier.service.AccountService import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.service.LoginService
import com.miya.fastcashier.service.PrintService import com.miya.fastcashier.service.PrintService
import com.miya.fastcashier.utils.DateUtils
import com.sdy.miya.moblie.component.pay.core.error.ParamInvalidException
import com.sdy.miya.moblie.component.pay.platform.bean.MiyaOrderRefundResponse
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import kotlinx.coroutines.* import kotlinx.coroutines.Dispatchers
import java.lang.RuntimeException import kotlinx.coroutines.Job
import java.util.* import kotlinx.coroutines.isActive
import kotlin.collections.HashMap import kotlinx.coroutines.launch
class PayViewModel : ViewModel() { class PayViewModel : ViewModel() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment