Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ecaa2fdd
authored
Mar 12, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
现在在线支付执行前会有100ms的时间预留,保证扫码反馈声音能播报完毕
parent
f7a10807
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
app/src/main/java/com/bgycc/smartcanteen/viewModel/PayOnlineViewModel.java
+5
-3
No files found.
app/src/main/java/com/bgycc/smartcanteen/viewModel/PayOnlineViewModel.java
View file @
ecaa2fdd
...
...
@@ -37,7 +37,9 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG;
* 支付状态(空闲、发送订单信息、支付中、支付成功、支付失败)都会通过{@link PayOnlineState}发出通知 <br/><br/>
*/
public
class
PayOnlineViewModel
extends
ViewModel
{
private
static
final
long
TIMEOUT
=
5
;
private
static
final
long
TIMEOUT
=
5
*
1000
;
// 在线支付延迟100ms执行,留出时间给扫码反馈
private
static
final
long
REQUEST_DELAY
=
100
;
private
static
final
long
DEFAULT_DELAY
=
3
*
1000
;
private
Gson
gson
;
private
String
deviceSN
;
...
...
@@ -71,9 +73,9 @@ public class PayOnlineViewModel extends ViewModel {
payRequest
=
new
PayRequest
(
deviceSN
,
payData
);
cancelTimeout
();
TimeoutRunnable
timeoutRunnable
=
new
TimeoutRunnable
();
timeoutFuture
=
SCTaskExecutor
.
getInstance
().
schedule
(
timeoutRunnable
,
TIMEOUT
,
TimeUnit
.
SECONDS
);
timeoutFuture
=
SCTaskExecutor
.
getInstance
().
schedule
(
timeoutRunnable
,
TIMEOUT
,
TimeUnit
.
MILLI
SECONDS
);
RequestRunnable
requestRunnable
=
new
RequestRunnable
();
SCTaskExecutor
.
getInstance
().
executeOnDiskIO
(
requestRunnable
);
SCTaskExecutor
.
getInstance
().
schedule
(
requestRunnable
,
REQUEST_DELAY
,
TimeUnit
.
MILLISECONDS
);
}
private
void
cancelTimeout
()
{
...
...
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