Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TangKuPos
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王海
TangKuPos
Commits
bc814fa7
Commit
bc814fa7
authored
Mar 14, 2018
by
zhang_z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
延长支付连接时间,增加重试次数;
增加营销计划的验证;
parent
6a2cc996
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
10 deletions
+66
-10
app/src/main/java/com/xingdata/zzdpos/model/Ms.java
app/src/main/java/com/xingdata/zzdpos/model/Ms.java
+10
-1
pay/src/main/java/com/xingdata/zxpay/api/Factory.java
pay/src/main/java/com/xingdata/zxpay/api/Factory.java
+1
-9
pay/src/main/java/com/xingdata/zxpay/api/RetryHelper.java
pay/src/main/java/com/xingdata/zxpay/api/RetryHelper.java
+41
-0
pay/src/main/java/com/xingdata/zxpay/pax/C.java
pay/src/main/java/com/xingdata/zxpay/pax/C.java
+5
-0
pay/src/main/java/com/xingdata/zxpay/pax/Factory.java
pay/src/main/java/com/xingdata/zxpay/pax/Factory.java
+9
-0
No files found.
app/src/main/java/com/xingdata/zzdpos/model/Ms.java
View file @
bc814fa7
...
...
@@ -27,7 +27,7 @@ public class Ms extends RealmObject implements BaseModel, BaseBean {
* @return 是否可用
*/
public
boolean
isAvailable
(
Vip
vip
)
{
return
checkMsByDate
()
&&
checkMsByWeek
()
&&
checkMsByTime
()
&&
checkMsByVip
(
vip
);
return
checkMsBy
Status
()
&&
checkMsBy
Date
()
&&
checkMsByWeek
()
&&
checkMsByTime
()
&&
checkMsByVip
(
vip
);
}
public
interface
OnApplyListener
{
...
...
@@ -105,6 +105,15 @@ public class Ms extends RealmObject implements BaseModel, BaseBean {
}
}
/**
* 验证启动状态
*
* @return 是否通过验证
*/
private
boolean
checkMsByStatus
()
{
return
msStatus
==
null
||
msStatus
==
0
;
}
/**
* 验证日期
...
...
pay/src/main/java/com/xingdata/zxpay/api/Factory.java
View file @
bc814fa7
package
com
.
xingdata
.
zxpay
.
api
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.schedulers.Schedulers
;
public
class
Factory
{
protected
static
<
T
>
Observable
<
T
>
run
(
Observable
<
T
>
observable
)
{
return
observable
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
());
}
}
pay/src/main/java/com/xingdata/zxpay/api/RetryHelper.java
0 → 100644
View file @
bc814fa7
package
com
.
xingdata
.
zxpay
.
api
;
import
com.blankj.utilcode.util.LogUtils
;
import
java.io.IOException
;
import
java.util.concurrent.TimeUnit
;
import
io.reactivex.Observable
;
import
io.reactivex.ObservableSource
;
import
io.reactivex.functions.Function
;
public
class
RetryHelper
implements
Function
<
Observable
<
Throwable
>,
ObservableSource
<?>>
{
private
int
retryCount
;
private
int
retryTime
;
private
int
nowCount
=
0
;
public
RetryHelper
(
int
retryCount
,
int
retryTime
)
{
this
.
retryCount
=
retryCount
;
this
.
retryTime
=
retryTime
;
}
@Override
public
ObservableSource
<?>
apply
(
Observable
<
Throwable
>
throwableObservable
)
throws
Exception
{
return
throwableObservable
.
flatMap
((
Function
<
Throwable
,
ObservableSource
<?>>)
throwable
->
{
if
(
throwable
instanceof
IOException
)
{
if
(++
nowCount
<=
retryCount
)
{
LogUtils
.
e
(
"重试时间:"
+
retryTime
+
"重试:"
+
nowCount
);
return
Observable
.
timer
(
retryTime
,
TimeUnit
.
MILLISECONDS
);
}
return
Observable
.
error
(
throwable
);
}
else
{
return
Observable
.
error
(
throwable
);
}
});
}
}
pay/src/main/java/com/xingdata/zxpay/pax/C.java
View file @
bc814fa7
...
...
@@ -6,6 +6,11 @@ class C {
*/
static
final
String
VERSION
=
"V1.0"
;
/**
* 重试延迟时间
*/
static
final
int
RETRY_DELAY_TIME
=
60
*
1000
;
/**
* 测试数据
*/
...
...
pay/src/main/java/com/xingdata/zxpay/pax/Factory.java
View file @
bc814fa7
...
...
@@ -5,17 +5,26 @@ import android.util.SparseArray;
import
com.blankj.utilcode.util.TimeUtils
;
import
com.xingdata.zxpay.PayCenter
;
import
com.xingdata.zxpay.api.RetryHelper
;
import
java.text.SimpleDateFormat
;
import
java.util.Locale
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.schedulers.Schedulers
;
public
class
Factory
extends
com
.
xingdata
.
zxpay
.
api
.
Factory
{
private
static
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyymmddhhmmss"
,
Locale
.
getDefault
());
private
static
SparseArray
<
String
>
orderMap
=
new
SparseArray
<>();
public
static
<
T
>
Observable
<
T
>
run
(
Observable
<
T
>
observable
)
{
return
observable
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
retryWhen
(
new
RetryHelper
(
3
,
C
.
RETRY_DELAY_TIME
));
}
/**
* 条码支付
*
...
...
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