Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
严琪
/
paysplug-in
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9694e76e
authored
Mar 15, 2018
by
jeffrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调试接口
parent
459da4cb
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
175 additions
and
42 deletions
+175
-42
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
+9
-0
app/src/main/java/com/yuqirong/listenwechatnotification/askhttp/ActivePullCashList.java
+25
-34
app/src/main/java/com/yuqirong/listenwechatnotification/bean/PullMoneyResp.java
+58
-0
app/src/main/java/com/yuqirong/listenwechatnotification/http/HttpService.java
+14
-7
app/src/main/java/com/yuqirong/listenwechatnotification/http/PayHttp.java
+58
-0
app/src/main/java/com/yuqirong/listenwechatnotification/uitl/Utils.java
+6
-0
app/src/main/res/layout/activity_main.xml
+5
-1
No files found.
app/src/main/java/com/yuqirong/listenwechatnotification/MainActivity.java
View file @
9694e76e
...
@@ -17,6 +17,7 @@ import android.widget.EditText;
...
@@ -17,6 +17,7 @@ import android.widget.EditText;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.yuqirong.listenwechatnotification.askhttp.ActivePullCashList
;
import
com.yuqirong.listenwechatnotification.askhttp.UpdateApk
;
import
com.yuqirong.listenwechatnotification.askhttp.UpdateApk
;
import
com.yuqirong.listenwechatnotification.broadcastReceiver.MyCashReceiver
;
import
com.yuqirong.listenwechatnotification.broadcastReceiver.MyCashReceiver
;
import
com.yuqirong.listenwechatnotification.service.WeChatNotificationListenerService
;
import
com.yuqirong.listenwechatnotification.service.WeChatNotificationListenerService
;
...
@@ -124,6 +125,14 @@ public class MainActivity extends ParentActivity {
...
@@ -124,6 +125,14 @@ public class MainActivity extends ParentActivity {
}
}
});
});
findViewById
(
R
.
id
.
btn_test
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
String
userName
=
Save2SharedPreferences
.
read
(
ALIPAYNAME
,
MainActivity
.
this
);
ActivePullCashList
pullCashList
=
new
ActivePullCashList
();
pullCashList
.
pullList
(
Utils
.
payChannelZFB
,
userName
);
}
});
// QRCodeFunction qrThread = new QRCodeFunction("QRCodeFunction---ZFB", Utils.ZFBImgPath);
// QRCodeFunction qrThread = new QRCodeFunction("QRCodeFunction---ZFB", Utils.ZFBImgPath);
// qrThread.start();
// qrThread.start();
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/askhttp/ActivePullCashList.java
View file @
9694e76e
package
com
.
yuqirong
.
listenwechatnotification
.
askhttp
;
package
com
.
yuqirong
.
listenwechatnotification
.
askhttp
;
import
android.util.Log
;
import
com.google.gson.Gson
;
import
com.yuqirong.listenwechatnotification.bean.PullMoneyResp
;
import
com.yuqirong.listenwechatnotification.function.QRCodeFunction
;
import
com.yuqirong.listenwechatnotification.function.QRCodeFunction
;
import
com.yuqirong.listenwechatnotification.http.HttpService
;
import
com.yuqirong.listenwechatnotification.http.HttpService
;
import
com.yuqirong.listenwechatnotification.uitl.FileUtils
;
import
com.yuqirong.listenwechatnotification.http.PayHttp
;
import
com.yuqirong.listenwechatnotification.uitl.PayTypeSingleTon
;
import
com.yuqirong.listenwechatnotification.uitl.Utils
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
retrofit2.Call
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
import
retrofit2.Response
;
import
retrofit2.Retrofit
;
import
retrofit2.converter.gson.GsonConverterFactory
;
import
retrofit2.converter.scalars.ScalarsConverterFactory
;
/**
/**
* 获取金额数据
* 获取金额数据
...
@@ -25,7 +23,10 @@ import retrofit2.converter.scalars.ScalarsConverterFactory;
...
@@ -25,7 +23,10 @@ import retrofit2.converter.scalars.ScalarsConverterFactory;
public
class
ActivePullCashList
{
public
class
ActivePullCashList
{
/**
*固定的 在服务器后台配置的
*/
private
static
final
String
token
=
"9908506dc651b6ce6e488c838c118354"
;
...
@@ -91,40 +92,30 @@ public class ActivePullCashList {
...
@@ -91,40 +92,30 @@ public class ActivePullCashList {
public
void
pullList
(
String
channel
,
String
username
){
public
void
pullList
(
String
channel
,
String
username
){
Retrofit
retrofit
=
new
Retrofit
.
Builder
().
baseUrl
(
HttpService
.
base_url
)
HttpService
httpService
=
PayHttp
.
get
();
//添加返回字符串的支持--不知道返回的是什么,添加字符串支持
Call
<
PullMoneyResp
>
call
=
httpService
.
pullZFBCashList
(
channel
,
username
,
token
);
.
addConverterFactory
(
ScalarsConverterFactory
.
create
())
//添加GSON转换支持
.
addConverterFactory
(
GsonConverterFactory
.
create
())
.
build
();
//获取接口
HttpService
service
=
retrofit
.
create
(
HttpService
.
class
);
Call
<
ArrayList
<
String
>>
call
=
service
.
pullZFBCashList
(
channel
,
username
);
call
.
enqueue
(
new
Callback
<
PullMoneyResp
>()
{
call
.
enqueue
(
new
Callback
<
ArrayList
<
String
>>()
{
@Override
@Override
public
void
onResponse
(
Call
<
ArrayList
<
String
>>
call
,
Response
<
ArrayList
<
String
>>
response
)
{
public
void
onResponse
(
Call
<
PullMoneyResp
>
call
,
Response
<
PullMoneyResp
>
response
)
{
ArrayList
<
String
>
object
=
response
.
body
();
PullMoneyResp
object
=
response
.
body
();
Log
.
d
(
"fei"
,
new
Gson
().
toJson
(
object
));
//1.当根据类型请求的金额列表数字为空的时候,不需要用eventbus来发送数据
//1.当根据类型请求的金额列表数字为空的时候,不需要用eventbus来发送数据
//2.只需要替换一下请求类型就可以了
//2.只需要替换一下请求类型就可以了
//3.删除文件夹下所有内容
//3.删除文件夹下所有内容
if
(
object
.
size
()
==
0
){
//
if (object.size() == 0){
if
(
PayTypeSingleTon
.
newInstance
().
getPayType
().
equals
(
Utils
.
payTypeZFB
)){
//
if (PayTypeSingleTon.newInstance().getPayType().equals(Utils.payTypeZFB)){
PayTypeSingleTon
.
newInstance
().
setPayType
(
Utils
.
payTypeWeiXin
);
//
PayTypeSingleTon.newInstance().setPayType(Utils.payTypeWeiXin);
}
else
{
//
}else{
PayTypeSingleTon
.
newInstance
().
setPayType
(
Utils
.
payTypeZFB
);
//
PayTypeSingleTon.newInstance().setPayType(Utils.payTypeZFB);
}
//
}
}
else
{
//
}else{
EventBus
.
getDefault
().
post
(
object
);
//
EventBus.getDefault().post(object);
}
//
}
}
}
@Override
@Override
public
void
onFailure
(
Call
<
ArrayList
<
String
>
>
call
,
Throwable
t
)
{
public
void
onFailure
(
Call
<
PullMoneyResp
>
call
,
Throwable
t
)
{
}
}
});
});
...
...
app/src/main/java/com/yuqirong/listenwechatnotification/bean/PullMoneyResp.java
0 → 100644
View file @
9694e76e
package
com
.
yuqirong
.
listenwechatnotification
.
bean
;
import
java.util.List
;
/**
* 创建日期:2018/3/15 on 16:48
* 描述:
* 作者:Li
*/
public
class
PullMoneyResp
{
/**
* status_code : 422
* message : data不能为空
* data : {"data":["data不能为空"]}
*/
private
int
status_code
;
private
String
message
;
private
DataBean
data
;
public
int
getStatus_code
()
{
return
status_code
;
}
public
void
setStatus_code
(
int
status_code
)
{
this
.
status_code
=
status_code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
DataBean
getData
()
{
return
data
;
}
public
void
setData
(
DataBean
data
)
{
this
.
data
=
data
;
}
public
static
class
DataBean
{
private
List
<
String
>
data
;
public
List
<
String
>
getData
()
{
return
data
;
}
public
void
setData
(
List
<
String
>
data
)
{
this
.
data
=
data
;
}
}
}
app/src/main/java/com/yuqirong/listenwechatnotification/http/HttpService.java
View file @
9694e76e
package
com
.
yuqirong
.
listenwechatnotification
.
http
;
package
com
.
yuqirong
.
listenwechatnotification
.
http
;
import
com.yuqirong.listenwechatnotification.bean.ImageBean
;
import
com.yuqirong.listenwechatnotification.bean.ImageBean
;
import
com.yuqirong.listenwechatnotification.bean.PullMoneyResp
;
import
com.yuqirong.listenwechatnotification.bean.UpdateBean
;
import
com.yuqirong.listenwechatnotification.bean.UpdateBean
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -8,7 +9,9 @@ import java.util.List;
...
@@ -8,7 +9,9 @@ import java.util.List;
import
retrofit2.Call
;
import
retrofit2.Call
;
import
retrofit2.http.Field
;
import
retrofit2.http.Field
;
import
retrofit2.http.FormUrlEncoded
;
import
retrofit2.http.GET
;
import
retrofit2.http.GET
;
import
retrofit2.http.Headers
;
import
retrofit2.http.POST
;
import
retrofit2.http.POST
;
import
retrofit2.http.Path
;
import
retrofit2.http.Path
;
import
retrofit2.http.Query
;
import
retrofit2.http.Query
;
...
@@ -19,19 +22,23 @@ import retrofit2.http.Query;
...
@@ -19,19 +22,23 @@ import retrofit2.http.Query;
public
interface
HttpService
{
public
interface
HttpService
{
// public String base_url = "http://test.haoyiwangluo.com
/";
public
String
base_url
=
"http://test.fourth-pay.checheng.net
/"
;
public
String
base_url
=
"http://www.haoyiwangluo.com/"
;
//
public String base_url = "http://www.haoyiwangluo.com/";
public
String
test_base_url
=
"http://test.fourth-pay.checheng.net/
app-api/
"
;
public
String
test_base_url
=
"http://test.fourth-pay.checheng.net/"
;
@GET
(
"app/status"
)
@GET
(
"
/app-api/
app/status"
)
Call
<
UpdateBean
>
postSoftVersion
(
@Query
(
"version"
)
String
version
);
Call
<
UpdateBean
>
postSoftVersion
(
@Query
(
"version"
)
String
version
);
@POST
(
"amounts"
)
@POST
(
"/app-api/amounts"
)
Call
<
ArrayList
<
String
>>
pullZFBCashList
(
@Field
(
"channel"
)
String
channel
,
@Field
(
"username"
)
String
username
);
@FormUrlEncoded
@Headers
({
"Accept: application/json"
})
Call
<
PullMoneyResp
>
pullZFBCashList
(
@Field
(
"channel"
)
String
channel
,
@Field
(
"username"
)
String
username
,
@Field
(
"token"
)
String
token
);
@POST
(
"amounts/submit"
)
@POST
(
"
/app-api/
amounts/submit"
)
Call
<
String
>
pushZFBCashList
(
@Field
(
"channel"
)
String
channel
,
@Field
(
"list"
)
ArrayList
<
ImageBean
>
imageBeans
);
Call
<
String
>
pushZFBCashList
(
@Field
(
"channel"
)
String
channel
,
@Field
(
"list"
)
ArrayList
<
ImageBean
>
imageBeans
);
}
}
app/src/main/java/com/yuqirong/listenwechatnotification/http/PayHttp.java
0 → 100644
View file @
9694e76e
package
com
.
yuqirong
.
listenwechatnotification
.
http
;
import
com.yuqirong.listenwechatnotification.MyApplication
;
import
com.yuqirong.listenwechatnotification.askhttp.HttpLoggingInterceptor
;
import
com.yuqirong.listenwechatnotification.http.HttpService
;
import
com.yuqirong.listenwechatnotification.uitl.Save2SharedPreferences
;
import
com.yuqirong.listenwechatnotification.uitl.Utils
;
import
java.io.IOException
;
import
okhttp3.Interceptor
;
import
okhttp3.OkHttpClient
;
import
okhttp3.Request
;
import
okhttp3.Response
;
import
retrofit2.Retrofit
;
import
retrofit2.converter.gson.GsonConverterFactory
;
import
retrofit2.converter.scalars.ScalarsConverterFactory
;
import
static
com
.
yuqirong
.
listenwechatnotification
.
MainActivity
.
API
;
/**
* 创建日期:2018/3/15 on 16:41
* 描述:
* 作者:Li
*/
public
class
PayHttp
{
private
static
HttpService
httpService
;
public
static
HttpService
get
(){
synchronized
(
HttpService
.
class
){
if
(
httpService
==
null
){
httpService
=
init
();
}
return
httpService
;
}
}
private
static
HttpService
init
(){
OkHttpClient
okHttpClient
=
new
OkHttpClient
.
Builder
()
.
addInterceptor
(
new
HttpLoggingInterceptor
())
.
build
();
String
url
=
Save2SharedPreferences
.
read
(
API
,
MyApplication
.
get
());
//建立retrofit对象
Retrofit
retrofit
=
new
Retrofit
.
Builder
().
baseUrl
(
url
)
// //添加返回字符串的支持--不知道返回的是什么,添加字符串支持
// .addConverterFactory(ScalarsConverterFactory.create())
//添加GSON转换支持
.
addConverterFactory
(
GsonConverterFactory
.
create
())
.
client
(
okHttpClient
)
.
build
();
//获取接口
HttpService
service
=
retrofit
.
create
(
HttpService
.
class
);
return
service
;
}
}
app/src/main/java/com/yuqirong/listenwechatnotification/uitl/Utils.java
View file @
9694e76e
...
@@ -21,6 +21,12 @@ public class Utils {
...
@@ -21,6 +21,12 @@ public class Utils {
//支付宝支付类型
//支付宝支付类型
public
static
String
payTypeZFB
=
"1"
;
public
static
String
payTypeZFB
=
"1"
;
//支付宝支付类型
public
static
String
payChannelZFB
=
"alipay_personal"
;
public
static
String
payChannelWX
=
"wechat_personal"
;
public
static
int
getLocalVersion
(
Context
ctx
)
{
public
static
int
getLocalVersion
(
Context
ctx
)
{
int
localVersion
=
0
;
int
localVersion
=
0
;
try
{
try
{
...
...
app/src/main/res/layout/activity_main.xml
View file @
9694e76e
...
@@ -119,7 +119,11 @@
...
@@ -119,7 +119,11 @@
android:layout_height=
"50dp"
android:layout_height=
"50dp"
android:text=
"监听"
/>
android:text=
"监听"
/>
<Button
android:id=
"@+id/btn_test"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:text=
"测试"
/>
<TextView
<TextView
android:id=
"@+id/tv_version_name"
android:id=
"@+id/tv_version_name"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
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