Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
8f17ac99
Commit
8f17ac99
authored
Sep 17, 2020
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update gateway
parent
8a6eb5ad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
62 deletions
+62
-62
src/main/java/tech/starwin/mvp/api/UserApi.java
+5
-4
src/main/java/tech/starwin/mvp/presenter/UserPresenter.java
+57
-58
No files found.
src/main/java/tech/starwin/mvp/api/UserApi.java
View file @
8f17ac99
...
@@ -292,8 +292,11 @@ public interface UserApi {
...
@@ -292,8 +292,11 @@ public interface UserApi {
@GET
(
"record/employ-photo"
)
@GET
(
"record/employ-photo"
)
Observable
<
RecordFilesResponse
>
getJobImg
();
Observable
<
RecordFilesResponse
>
getJobImg
();
@GET
@FormUrlEncoded
Observable
<
ResponseBody
>
analytics
(
@Url
String
url
);
@POST
(
"google/analytics/index"
)
Observable
<
ResponseBody
>
analytics
(
@Field
(
"name"
)
String
name
,
@Field
(
"imei"
)
String
imei
,
@Field
(
"type"
)
String
type
);
@GET
(
"record/bankcard"
)
@GET
(
"record/bankcard"
)
Observable
<
UserBankInfo
>
getBankCardInfo
();
Observable
<
UserBankInfo
>
getBankCardInfo
();
...
@@ -355,6 +358,4 @@ public interface UserApi {
...
@@ -355,6 +358,4 @@ public interface UserApi {
@Query
(
"passbackparams"
)
String
passbackparams
);
@Query
(
"passbackparams"
)
String
passbackparams
);
}
}
src/main/java/tech/starwin/mvp/presenter/UserPresenter.java
View file @
8f17ac99
...
@@ -93,58 +93,61 @@ public class UserPresenter extends BasePresenter<UserApi> {
...
@@ -93,58 +93,61 @@ public class UserPresenter extends BasePresenter<UserApi> {
public
void
getGateway
(
String
action
,
List
<
String
>
gatewayUrl
)
{
public
void
getGateway
(
String
action
,
List
<
String
>
gatewayUrl
)
{
Log
.
d
(
"Android"
,
AppInfoUtils
.
getAndroidID
(
LibConfig
.
getContext
()));
Log
.
d
(
"Android"
,
AppInfoUtils
.
getAndroidID
(
LibConfig
.
getContext
()));
FbDeepLink
.
fetchDeepLink
();
FbDeepLink
.
fetchDeepLink
();
Observable
.
fromIterable
(
gatewayUrl
)
.
subscribeOn
(
Schedulers
.
io
())
.
concatMap
(
new
Function
<
String
,
ObservableSource
<
GatewayInfoBean
>>()
{
@Override
public
ObservableSource
<
GatewayInfoBean
>
apply
(
String
s
)
throws
Exception
{
if
(
gatewayUrl
.
indexOf
(
s
)
==
gatewayUrl
.
size
()
-
1
)
{
return
getApiService
().
getGateway
(
s
);
}
return
getApiService
().
getGateway
(
s
).
onErrorReturn
(
new
Function
<
Throwable
,
GatewayInfoBean
>()
{
@Override
public
GatewayInfoBean
apply
(
Throwable
throwable
)
throws
Exception
{
return
new
GatewayInfoBean
();
}
});
}
})
.
filter
(
new
Predicate
<
GatewayInfoBean
>()
{
@Override
public
boolean
test
(
GatewayInfoBean
gatewayInfoBean
)
throws
Exception
{
return
gatewayInfoBean
!=
null
&&
gatewayInfoBean
.
gateway
!=
null
;
}
})
.
take
(
1
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
new
HttpObserver
<
GatewayInfoBean
>(
action
)
{
@Override
public
void
onStart
()
{
if
(
view
!=
null
)
{
view
.
onHttpStart
(
action
,
false
);
}
}
@Override
public
void
onSuccess
(
GatewayInfoBean
gatewayInfoBean
)
{
Gateway
.
setGatewayInfoBean
(
gatewayInfoBean
);
submitDeviceInfo
();
submitDeviceInfo
();
getCustomerMsg
(
action
);
getCustomerMsg
(
action
);
}
@Override
public
void
onError
(
int
code
,
String
msg
)
{
if
(
view
!=
null
)
{
view
.
onHttpError
(
action
,
msg
);
}
}
@Override
// Observable.fromIterable(gatewayUrl)
public
void
onFinish
()
{
// .subscribeOn(Schedulers.io())
}
// .concatMap(new Function<String, ObservableSource<GatewayInfoBean>>() {
});
// @Override
// public ObservableSource<GatewayInfoBean> apply(String s) throws Exception {
// if (gatewayUrl.indexOf(s) == gatewayUrl.size() - 1) {
// return getApiService().getGateway(s);
// }
// return getApiService().getGateway(s).onErrorReturn(new Function<Throwable, GatewayInfoBean>() {
// @Override
// public GatewayInfoBean apply(Throwable throwable) throws Exception {
// return new GatewayInfoBean();
// }
// });
// }
// })
// .filter(new Predicate<GatewayInfoBean>() {
// @Override
// public boolean test(GatewayInfoBean gatewayInfoBean) throws Exception {
// return gatewayInfoBean != null && gatewayInfoBean.gateway != null;
// }
// })
// .take(1)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(new HttpObserver<GatewayInfoBean>(action) {
// @Override
// public void onStart() {
// if (view != null) {
// view.onHttpStart(action, false);
// }
// }
//
// @Override
// public void onSuccess(GatewayInfoBean gatewayInfoBean) {
// Gateway.setGatewayInfoBean(gatewayInfoBean);
//
// submitDeviceInfo();
//
// getCustomerMsg(action);
// }
//
// @Override
// public void onError(int code, String msg) {
// if (view != null) {
// view.onHttpError(action, msg);
// }
// }
//
// @Override
// public void onFinish() {
// }
// });
}
}
...
@@ -918,15 +921,10 @@ public class UserPresenter extends BasePresenter<UserApi> {
...
@@ -918,15 +921,10 @@ public class UserPresenter extends BasePresenter<UserApi> {
@SuppressLint
(
"CheckResult"
)
@SuppressLint
(
"CheckResult"
)
public
void
analytics
(
String
action
,
boolean
isWifi
)
{
public
void
analytics
(
String
action
,
boolean
isWifi
)
{
StringBuilder
builder
=
new
StringBuilder
();
UserApi
userApi
=
ServiceGenerator
.
getService
(
UserApi
.
class
,
"http://13.250.10.209:8878"
);
builder
.
append
(
"http://13.250.10.209:8878/google/analytics/"
);
String
type
=
isWifi
?
"2"
:
"1"
;
builder
.
append
(
LibConfig
.
APPLICATION_ID
);
builder
.
append
(
"/"
);
builder
.
append
(
AppInfoUtils
.
getAndroidID
(
LibConfig
.
getContext
()));
builder
.
append
(
"/"
);
builder
.
append
(
isWifi
?
"2"
:
"1"
);
handleRequest
(
getApiService
().
analytics
(
builder
.
toString
()
),
new
HttpObserver
<
ResponseBody
>()
{
handleRequest
(
userApi
.
analytics
(
LibConfig
.
APPLICATION_ID
,
AppInfoUtils
.
getAndroidID
(
LibConfig
.
getContext
()),
type
),
new
HttpObserver
<
ResponseBody
>()
{
@Override
@Override
public
void
onStart
()
{
public
void
onStart
()
{
}
}
...
@@ -934,7 +932,8 @@ public class UserPresenter extends BasePresenter<UserApi> {
...
@@ -934,7 +932,8 @@ public class UserPresenter extends BasePresenter<UserApi> {
@Override
@Override
public
void
onSuccess
(
ResponseBody
data
)
{
public
void
onSuccess
(
ResponseBody
data
)
{
try
{
try
{
if
(
data
.
string
().
equals
(
"ok"
)
&&
!
isWifi
)
{
String
result
=
data
.
string
();
if
(
result
.
equals
(
"ok"
)
&&
!
isWifi
)
{
view
.
onHttpSuccess
(
action
,
"ok"
);
view
.
onHttpSuccess
(
action
,
"ok"
);
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
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