Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ChatGPT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
关振斌
ChatGPT
Commits
2f7c6604
Commit
2f7c6604
authored
Mar 07, 2023
by
关振斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
874883c2
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
104 additions
and
9 deletions
+104
-9
lib/common/apis/user.dart
lib/common/apis/user.dart
+9
-0
lib/common/utils/http.dart
lib/common/utils/http.dart
+1
-1
lib/common/values/server.dart
lib/common/values/server.dart
+4
-2
lib/entity/user_entity.dart
lib/entity/user_entity.dart
+23
-0
lib/pages/chat/bindings.dart
lib/pages/chat/bindings.dart
+1
-1
lib/pages/frame/android_pay_list/controller.dart
lib/pages/frame/android_pay_list/controller.dart
+46
-3
lib/pages/frame/android_pay_list/widgets/helloword.dart
lib/pages/frame/android_pay_list/widgets/helloword.dart
+1
-1
lib/pages/frame/notfound/controller.dart
lib/pages/frame/notfound/controller.dart
+9
-0
lib/pages/frame/pay_list/controller.dart
lib/pages/frame/pay_list/controller.dart
+9
-0
lib/pages/frame/pay_list/widgets/helloword.dart
lib/pages/frame/pay_list/widgets/helloword.dart
+1
-1
No files found.
lib/common/apis/user.dart
View file @
2f7c6604
...
@@ -47,6 +47,15 @@ class UserAPI {
...
@@ -47,6 +47,15 @@ class UserAPI {
// UserLoginResponseEntity.fromJson(response);
// UserLoginResponseEntity.fromJson(response);
}
}
static
Future
<
UserInfoEntity
>
getUserInfo
()
async
{
var
response
=
await
HttpUtil
().
get
(
'/user/info'
,
);
return
UserInfoEntity
.
fromMap
(
response
[
'data'
]);
// UserLoginResponseEntity.fromJson(response);
}
// /api/user/info
static
Future
<
MsmEntity
>
sendSms
(
static
Future
<
MsmEntity
>
sendSms
(
Map
<
String
,
dynamic
>?
params
,
Map
<
String
,
dynamic
>?
params
,
)
async
{
)
async
{
...
...
lib/common/utils/http.dart
View file @
2f7c6604
...
@@ -36,7 +36,7 @@ class HttpUtil {
...
@@ -36,7 +36,7 @@ class HttpUtil {
connectTimeout:
10000
,
connectTimeout:
10000
,
// 响应流上前后两次接受到数据的间隔,单位为毫秒。
// 响应流上前后两次接受到数据的间隔,单位为毫秒。
receiveTimeout:
45
000
,
receiveTimeout:
20
000
,
// Http请求头.
// Http请求头.
headers:
{},
headers:
{},
...
...
lib/common/values/server.dart
View file @
2f7c6604
// baidu yapi
// baidu yapi
// const SERVER_API_URL = 'https://yapi.baidu.com/mock/41008';
// const SERVER_API_URL = 'https://yapi.baidu.com/mock/41008';
// const SERVER_API_URL = 'https://yapi.ducafecat.tech/mock/11';
// const SERVER_API_URL = 'https://yapi.ducafecat.tech/mock/11';
const
SERVER_API_URL
=
'http://101.34.153.228:8083/api'
;
//线上
// const SERVER_API_URL = 'http://101.34.153.228:8083/api';//线上
// const SERVER_API_URL = 'http://192.168.120.23:8083/api';
// http://192.168.110.66:8083/api/doc.html
const
SERVER_API_URL
=
'http://192.168.110.66:8083/api'
;
// http://192.168.110.25:8083/
// http://192.168.110.25:8083/
// const SERVER_API_URL = 'http://192.168.2.178:8083/api';
// const SERVER_API_URL = 'http://192.168.2.178:8083/api';
// const SERVER_API_URL = 'http://192.168.110.57:8083/api';
// const SERVER_API_URL = 'http://192.168.110.57:8083/api';
...
...
lib/entity/user_entity.dart
View file @
2f7c6604
...
@@ -264,3 +264,26 @@ class MsmEntity {
...
@@ -264,3 +264,26 @@ class MsmEntity {
"timestamp"
:
timestamp
"timestamp"
:
timestamp
};
};
}
}
class
UserInfoEntity
{
UserInfoEntity
({
required
this
.
expireTime
,
required
this
.
integral
});
final
dynamic
expireTime
;
final
int
integral
;
// expireTime: res.expireTime,
// integral: res.integral
factory
UserInfoEntity
.
fromJson
(
String
str
)
=>
UserInfoEntity
.
fromMap
(
json
.
decode
(
str
));
String
toJson
()
=>
json
.
encode
(
toMap
());
factory
UserInfoEntity
.
fromMap
(
Map
<
String
,
dynamic
>
json
)
=>
UserInfoEntity
(
integral:
json
[
'integral'
],
expireTime:
json
[
"expireTime"
]
==
null
?
null
:
DateTime
.
parse
(
json
[
"expireTime"
]));
Map
<
String
,
dynamic
>
toMap
()
=>
{
"integral"
:
integral
,
"expireTime"
:
expireTime
};
}
lib/pages/chat/bindings.dart
View file @
2f7c6604
...
@@ -6,6 +6,6 @@ class ChatBinding implements Bindings {
...
@@ -6,6 +6,6 @@ class ChatBinding implements Bindings {
@override
@override
void
dependencies
()
{
void
dependencies
()
{
// print('ChatPageControllerChatPageControllerChatPageController');
// print('ChatPageControllerChatPageControllerChatPageController');
//
Get.lazyPut<ChatPageController>(() => ChatPageController());
Get
.
lazyPut
<
ChatPageController
>(()
=>
ChatPageController
());
}
}
}
}
lib/pages/frame/android_pay_list/controller.dart
View file @
2f7c6604
...
@@ -5,6 +5,7 @@ import 'package:alipay_kit/alipay_kit.dart';
...
@@ -5,6 +5,7 @@ import 'package:alipay_kit/alipay_kit.dart';
import
'package:chart/common/apis/apis.dart'
;
import
'package:chart/common/apis/apis.dart'
;
import
'package:chart/common/entities/good.dart'
;
import
'package:chart/common/entities/good.dart'
;
import
'package:chart/common/store/user.dart'
;
import
'package:chart/common/store/user.dart'
;
import
'package:chart/entity/user_entity.dart'
;
import
'package:chart/pages/frame/android_pay_list/unsafe_alipay_kit.dart'
;
import
'package:chart/pages/frame/android_pay_list/unsafe_alipay_kit.dart'
;
// import 'package:chart/common/routers/routes.dart';
// import 'package:chart/common/routers/routes.dart';
// import 'package:chart/common/store/store.dart';
// import 'package:chart/common/store/store.dart';
...
@@ -23,6 +24,7 @@ class AndroidPayListController extends GetxController {
...
@@ -23,6 +24,7 @@ class AndroidPayListController extends GetxController {
final
state
=
AndroidPayListState
();
final
state
=
AndroidPayListState
();
late
final
StreamSubscription
<
AlipayResp
>
_alipaySubs
;
//用于付
// Platform messages may fail, so we use a try/catch PlatformException.
// Platform messages may fail, so we use a try/catch PlatformException.
// prepare
// prepare
...
@@ -55,8 +57,49 @@ class AndroidPayListController extends GetxController {
...
@@ -55,8 +57,49 @@ class AndroidPayListController extends GetxController {
// 初始静态数据
// 初始静态数据
}
}
void
listenAlipayPay
(
AlipayResp
resp
)
{
final
String
content
=
'pay:
${resp.resultStatus}
-
${resp.result}
'
;
print
(
content
);
// 9000——订单支付成功 下面的result有值 8000——正在处理中 4000——订单支付失败 5000——重复请求 6001——用户中途取消 6002——网络连接出错
switch
(
resp
.
resultStatus
)
{
case
9000
:
EasyLoading
.
showToast
(
"订单支付成功"
);
UserAPI
.
getUserInfo
().
then
((
value
)
async
{
await
UserStore
.
to
.
saveProfile
(
IntegralEntity
(
id:
UserStore
.
to
.
profile
.
id
,
username:
UserStore
.
to
.
profile
.
username
,
token:
UserStore
.
to
.
profile
.
token
,
expireTime:
value
.
expireTime
,
integral:
value
.
integral
));
});
Get
.
back
();
break
;
case
8000
:
EasyLoading
.
showToast
(
"正在处理中"
);
break
;
case
4000
:
EasyLoading
.
showToast
(
"订单支付失败"
);
break
;
case
5000
:
EasyLoading
.
showToast
(
"5000"
);
break
;
case
6001
:
EasyLoading
.
showToast
(
"用户中途取消"
);
break
;
case
6002
:
EasyLoading
.
showToast
(
"网络连接出错"
);
break
;
default
:
break
;
}
}
Future
initializedPlugins
()
async
{
Future
initializedPlugins
()
async
{
await
AlipayKitPlatform
.
instance
.
isInstalled
();
await
AlipayKitPlatform
.
instance
.
isInstalled
();
_alipaySubs
=
AlipayKitPlatform
.
instance
.
payResp
().
listen
(
listenAlipayPay
);
}
}
Future
_getProduct
()
async
{
Future
_getProduct
()
async
{
...
@@ -102,6 +145,7 @@ class AndroidPayListController extends GetxController {
...
@@ -102,6 +145,7 @@ class AndroidPayListController extends GetxController {
});
});
AlipayKitPlatform
.
instance
.
pay
(
orderInfo:
orderInfo
);
AlipayKitPlatform
.
instance
.
pay
(
orderInfo:
orderInfo
);
EasyLoading
.
dismiss
();
EasyLoading
.
dismiss
();
// actSelected
// actSelected
// selected
// selected
...
@@ -145,6 +189,7 @@ class AndroidPayListController extends GetxController {
...
@@ -145,6 +189,7 @@ class AndroidPayListController extends GetxController {
///将一些数据保存在磁盘上也可能很有用。
///将一些数据保存在磁盘上也可能很有用。
@override
@override
void
onClose
()
{
void
onClose
()
{
_alipaySubs
.
cancel
();
super
.
onClose
();
super
.
onClose
();
// 1 stop & close 关闭对象
// 1 stop & close 关闭对象
// 2 save 持久化数据
// 2 save 持久化数据
...
@@ -153,9 +198,7 @@ class AndroidPayListController extends GetxController {
...
@@ -153,9 +198,7 @@ class AndroidPayListController extends GetxController {
///dispose 释放内存
///dispose 释放内存
@override
@override
void
dispose
()
{
void
dispose
()
{
// _purchaseUpdatedSubscription.cancel();
_alipaySubs
.
cancel
();
// _purchaseErrorSubscription.cancel();
// _conectionSubscription.cancel();
super
.
dispose
();
super
.
dispose
();
// dispose 释放对象
// dispose 释放对象
}
}
...
...
lib/pages/frame/android_pay_list/widgets/helloword.dart
View file @
2f7c6604
...
@@ -295,7 +295,7 @@ class PayItemWidget extends GetView<AndroidPayListController> {
...
@@ -295,7 +295,7 @@ class PayItemWidget extends GetView<AndroidPayListController> {
child:
Container
(
child:
Container
(
margin:
EdgeInsets
.
only
(
top:
20
),
margin:
EdgeInsets
.
only
(
top:
20
),
child:
GradientButton
(
child:
GradientButton
(
child:
Text
(
'
订阅
'
),
child:
Text
(
'
购买
'
),
increaseHeightBy:
15.00
,
increaseHeightBy:
15.00
,
increaseWidthBy:
200.00
,
increaseWidthBy:
200.00
,
callback:
controller
.
requestPurchase
,
callback:
controller
.
requestPurchase
,
...
...
lib/pages/frame/notfound/controller.dart
View file @
2f7c6604
import
'package:chart/common/apis/apis.dart'
;
import
'package:chart/common/apis/apis.dart'
;
import
'package:chart/common/store/store.dart'
;
import
'package:chart/common/store/store.dart'
;
import
'package:chart/entity/user_entity.dart'
;
import
'package:chart/package/chat_dash/dash_chat_2.dart'
as
Chat
;
import
'package:chart/package/chat_dash/dash_chat_2.dart'
as
Chat
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:flutter_vibrate/flutter_vibrate.dart'
;
import
'package:flutter_vibrate/flutter_vibrate.dart'
;
...
@@ -95,6 +96,14 @@ class ChatNewController extends GetxController {
...
@@ -95,6 +96,14 @@ class ChatNewController extends GetxController {
_addMessage
(
receiveMessage
);
_addMessage
(
receiveMessage
);
EasyLoading
.
dismiss
();
EasyLoading
.
dismiss
();
Vibrate
.
feedback
(
FeedbackType
.
success
);
Vibrate
.
feedback
(
FeedbackType
.
success
);
UserAPI
.
getUserInfo
().
then
((
value
)
async
{
await
UserStore
.
to
.
saveProfile
(
IntegralEntity
(
id:
UserStore
.
to
.
profile
.
id
,
username:
UserStore
.
to
.
profile
.
username
,
token:
UserStore
.
to
.
profile
.
token
,
expireTime:
value
.
expireTime
,
integral:
value
.
integral
));
});
}
else
{
}
else
{
final
receiveErrorMessage
=
Chat
.
ChatMessage
(
final
receiveErrorMessage
=
Chat
.
ChatMessage
(
user:
receiveUser
,
user:
receiveUser
,
...
...
lib/pages/frame/pay_list/controller.dart
View file @
2f7c6604
...
@@ -91,6 +91,15 @@ class PayListController extends GetxController {
...
@@ -91,6 +91,15 @@ class PayListController extends GetxController {
EasyLoading
.
showSuccess
(
'
${res?.message}
'
);
EasyLoading
.
showSuccess
(
'
${res?.message}
'
);
Vibrate
.
feedback
(
FeedbackType
.
success
);
Vibrate
.
feedback
(
FeedbackType
.
success
);
EasyLoading
.
dismiss
();
EasyLoading
.
dismiss
();
UserAPI
.
getUserInfo
().
then
((
value
)
async
{
await
UserStore
.
to
.
saveProfile
(
IntegralEntity
(
id:
UserStore
.
to
.
profile
.
id
,
username:
UserStore
.
to
.
profile
.
username
,
token:
UserStore
.
to
.
profile
.
token
,
expireTime:
value
.
expireTime
,
integral:
value
.
integral
));
});
Get
.
back
();
// equired this.id,
// equired this.id,
// required this.username,
// required this.username,
// required this.token,
// required this.token,
...
...
lib/pages/frame/pay_list/widgets/helloword.dart
View file @
2f7c6604
...
@@ -293,7 +293,7 @@ class PayItemWidget extends GetView<PayListController> {
...
@@ -293,7 +293,7 @@ class PayItemWidget extends GetView<PayListController> {
child:
Container
(
child:
Container
(
margin:
EdgeInsets
.
only
(
top:
20
),
margin:
EdgeInsets
.
only
(
top:
20
),
child:
GradientButton
(
child:
GradientButton
(
child:
Text
(
'
订阅
'
),
child:
Text
(
'
购买
'
),
increaseHeightBy:
15.00
,
increaseHeightBy:
15.00
,
increaseWidthBy:
200.00
,
increaseWidthBy:
200.00
,
callback:
controller
.
requestPurchase
,
callback:
controller
.
requestPurchase
,
...
...
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