Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MiYaFastCashier
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
MiYaFastCashier
Commits
874a9bc8
Commit
874a9bc8
authored
May 11, 2022
by
赵鹏翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d705b072
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
45 deletions
+27
-45
LFilePickerActivity.java
...in/java/com/miya/fastcashier/log/LFilePickerActivity.java
+4
-5
SystemParameterDialog.java
.../java/com/miya/fastcashier/log/SystemParameterDialog.java
+2
-2
ApiService.kt
app/src/main/java/com/miya/fastcashier/net/ApiService.kt
+11
-10
LoginViewModel.kt
...ain/java/com/miya/fastcashier/viewmodel/LoginViewModel.kt
+2
-8
MainViewModel.kt
...main/java/com/miya/fastcashier/viewmodel/MainViewModel.kt
+4
-7
PayViewModel.kt
.../main/java/com/miya/fastcashier/viewmodel/PayViewModel.kt
+4
-13
No files found.
app/src/main/java/com/miya/fastcashier/log/LFilePickerActivity.java
View file @
874a9bc8
...
...
@@ -50,7 +50,6 @@ public class LFilePickerActivity extends BaseActivity {
private
ArrayList
<
String
>
mListNumbers
=
new
ArrayList
<
String
>();
//存放选中条目的数据地址
private
String
mQrCodeEncodeMsg
;
private
byte
[]
dialogLock
=
new
byte
[
0
];
public
static
boolean
isProhibitWrite
=
false
;
//是否禁止写入文件
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -255,7 +254,7 @@ public class LFilePickerActivity extends BaseActivity {
}
public
void
uploadFile
(
String
path
)
{
//
isProhibitWrite = true
;
//
LogFileUtils.INSTANCE.setProhibitWrite(true)
;
// String equType = getEquType();
//
// File file = new File(path);
...
...
@@ -272,7 +271,7 @@ public class LFilePickerActivity extends BaseActivity {
// long size = file.length();
// if(size > 34307335){
// ToastUtils.showLong("日志文件过大");
//
isProhibitWrite = false
;
//
LogFileUtils.INSTANCE.setProhibitWrite(false)
;
// hidProgressDialog();
// return;
// }
...
...
@@ -286,7 +285,7 @@ public class LFilePickerActivity extends BaseActivity {
// @Override
// public void call(HttpResult s) {
// hidProgressDialog();
//
isProhibitWrite = false
;
//
LogFileUtils.INSTANCE.setProhibitWrite(false)
;
// successToast = Toasty.success(LFilePickerActivity.this, "文件上传成功!");
// successToast.show();
// showQrImageIfNeeded();
...
...
@@ -295,7 +294,7 @@ public class LFilePickerActivity extends BaseActivity {
// @Override
// public void call(Throwable throwable) {
// hidProgressDialog();
//
isProhibitWrite = false
;
//
LogFileUtils.INSTANCE.setProhibitWrite(false)
;
// Toasty.error(LFilePickerActivity.this, "文件上传失败!").show();
// }
// });
...
...
app/src/main/java/com/miya/fastcashier/log/SystemParameterDialog.java
View file @
874a9bc8
...
...
@@ -11,8 +11,8 @@ import com.miya.fastcashier.BuildConfig;
import
com.miya.fastcashier.R
;
import
com.miya.fastcashier.beans.SelfCashierAccountInfo
;
import
com.miya.fastcashier.databinding.DialogSystemParameterBinding
;
import
com.miya.fastcashier.net.ApiService
;
import
com.miya.fastcashier.service.AccountService
;
import
com.miya.fastcashier.service.LoginService
;
import
com.miya.fastcashier.utils.BaseFunctionKt
;
import
com.miya.print.PrinterManager
;
...
...
@@ -44,7 +44,7 @@ public class SystemParameterDialog extends Dialog {
setInfo
(
viewBinding
.
tvCashier
,
accountInfo
.
getShopInfo
().
getOperatorId
());
setInfo
(
viewBinding
.
tvVersionType
,
"fastCashier_"
+
BuildConfig
.
appType
);
setInfo
(
viewBinding
.
tvEquipment
,
"sunmi_v2pro"
);
setInfo
(
viewBinding
.
tvServerUrl
,
Login
Service
.
Companion
.
getBaseUrl
());
setInfo
(
viewBinding
.
tvServerUrl
,
Api
Service
.
Companion
.
getBaseUrl
());
setInfo
(
viewBinding
.
tvWifiName
,
BaseFunctionKt
.
getWifyName
(
getContext
()));
setInfo
(
viewBinding
.
tvNetIp
,
BaseFunctionKt
.
getNetIp
(
getContext
())
==
null
?
"未知"
:
BaseFunctionKt
.
getNetIp
(
getContext
()));
setInfo
(
viewBinding
.
tvPrintType
,
PrinterManager
.
getInstance
().
getPrinter
()
==
null
?
...
...
app/src/main/java/com/miya/fastcashier/
service/Login
Service.kt
→
app/src/main/java/com/miya/fastcashier/
net/Api
Service.kt
View file @
874a9bc8
package
com.miya.fastcashier.
service
package
com.miya.fastcashier.
net
import
android.util.Log
import
com.miya.fastcashier.beans.SelfCashierAccountInfo
...
...
@@ -13,18 +13,16 @@ import retrofit2.http.Body
import
retrofit2.http.POST
interface
LoginService
{
@POST
(
"verify/auth/token"
)
suspend
fun
login
(
@Body
loginRequestCall
:
LoginRequest
):
BaseResult
<
SelfCashierAccountInfo
>
interface
ApiService
{
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
():
Login
Service
{
fun
getApi
():
Api
Service
{
if
(
null
==
service
)
{
val
httpLoggingInterceptor
=
MiyaHttpLoggingInterceptor
{
...
...
@@ -41,15 +39,18 @@ interface LoginService {
.
addConverterFactory
(
GsonConverterFactory
.
create
())
.
build
()
service
=
retrofit
.
create
(
Login
Service
::
class
.
java
)
service
=
retrofit
.
create
(
Api
Service
::
class
.
java
)
}
return
service
!!
}
fun
getBaseUrl
():
String
{
fun
getBaseUrl
():
String
{
return
BASE_URL
}
}
@POST
(
LOGIN
)
suspend
fun
login
(
@Body
loginRequestCall
:
LoginRequest
):
BaseResult
<
SelfCashierAccountInfo
>
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/viewmodel/LoginViewModel.kt
View file @
874a9bc8
...
...
@@ -8,9 +8,8 @@ import com.miya.fastcashier.R
import
com.miya.fastcashier.beans.LoginFormState
import
com.miya.fastcashier.beans.LoginRequest
import
com.miya.fastcashier.beans.SelfCashierAccountInfo
import
com.miya.fastcashier.net.ApiService
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.launch
...
...
@@ -25,14 +24,9 @@ class LoginViewModel : ViewModel() {
viewModelScope
.
launch
(
Dispatchers
.
IO
)
{
try
{
val
result
=
Result
.
success
(
errorHandle
(
Login
Service
.
getApi
().
login
(
LoginRequest
(
userName
,
passWord
,
""
)))
errorHandle
(
Api
Service
.
getApi
().
login
(
LoginRequest
(
userName
,
passWord
,
""
)))
)
// val balanceDate = LocalKeyDataMKManageKit.getBalanceDate()
// if (balanceDate <= 0L) {
// //todo 改成服务器时间
// LocalKeyDataMKManageKit.putBalanceDate(System.currentTimeMillis())
// }
loginLiveData
.
postValue
(
result
)
}
catch
(
e
:
Exception
)
{
loginLiveData
.
postValue
(
Result
.
failure
(
e
))
...
...
app/src/main/java/com/miya/fastcashier/viewmodel/MainViewModel.kt
View file @
874a9bc8
...
...
@@ -3,18 +3,15 @@ package com.miya.fastcashier.viewmodel
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
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.repository.PayRepository
import
com.miya.fastcashier.service.AccountService
import
com.miya.fastcashier.service.LoginService
import
com.miya.fastcashier.service.PrintService
import
com.miya.fastcashier.utils.DateUtils
import
com.sdy.miya.moblie.component.pay.platform.bean.MiyaOrderRefundResponse
import
kotlinx.coroutines.
*
import
java.lang.Exception
import
java.lang.RuntimeException
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.
async
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.runBlocking
import
java.util.*
import
kotlin.collections.HashMap
...
...
app/src/main/java/com/miya/fastcashier/viewmodel/PayViewModel.kt
View file @
874a9bc8
...
...
@@ -5,25 +5,16 @@ import androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.viewModelScope
import
com.alibaba.fastjson.JSON
import
com.blankj.utilcode.util.LogUtils
import
com.blankj.utilcode.util.NumberUtils
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.dao.DatabaseKeeper
import
com.miya.fastcashier.repository.PayRepository
import
com.miya.fastcashier.service.AccountService
import
com.miya.fastcashier.service.LoginService
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
kotlinx.coroutines.
*
import
java.lang.RuntimeException
import
java.util.*
import
kotlin
.collections.HashMap
import
kotlinx.coroutines.
Dispatchers
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.isActive
import
kotlin
x.coroutines.launch
class
PayViewModel
:
ViewModel
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment