对接积分签到

pull/1/head
张萌 3 years ago
parent ed064fc688
commit 5658335989

@ -3,6 +3,7 @@ part of 'sars_api.dart';
class _ProfileApi { class _ProfileApi {
_MyHouse house = _MyHouse(); _MyHouse house = _MyHouse();
_MyFamily family = _MyFamily(); _MyFamily family = _MyFamily();
_Integral integral = _Integral();
} }
class _MyHouse { class _MyHouse {
@ -26,3 +27,11 @@ class _MyFamily {
//// ////
String get myFamilyReview => '/app/user/myFamily/review'; String get myFamilyReview => '/app/user/myFamily/review';
} }
class _Integral {
///
String get info => '/app/user/points/getPointsInfo';
///
String get sign => '/app/user/points/sign';
}

@ -1,4 +1,5 @@
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/extensions/num_ext.dart'; import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/extensions/widget_list_ext.dart'; import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
@ -33,17 +34,9 @@ class _ClockInPageState extends State<ClockInPage> {
bool get hasClocked => _integralModel?.isSign ?? false; bool get hasClocked => _integralModel?.isSign ?? false;
Future getData() async { Future getData() async {
var base = await NetUtil().get(API.intergral.info); var base = await NetUtil().get(SARSAPI.profile.integral.info);
if (base.status ?? false) { if (base.success) {
_integralModel = IntegralInfoModel.fromJson(base.data); _integralModel = IntegralInfoModel.fromJson(base.data);
} else {
BotToast.showText(text: base.message!);
}
}
@override
void initState() {
getData().then((value) {
if (_integralModel != null) { if (_integralModel != null) {
_records = _integralModel!.signRecordList; _records = _integralModel!.signRecordList;
_configs = _integralModel!.rewardSetting _configs = _integralModel!.rewardSetting
@ -54,7 +47,14 @@ class _ClockInPageState extends State<ClockInPage> {
.toList(); .toList();
setState(() {}); setState(() {});
} }
}); } else {
BotToast.showText(text: base.msg);
}
}
@override
void initState() {
getData();
super.initState(); super.initState();
} }
@ -221,14 +221,15 @@ class _ClockInPageState extends State<ClockInPage> {
onPressed: hasClocked onPressed: hasClocked
? null ? null
: () async { : () async {
var base = await NetUtil().get(API.intergral.sign); var base =
if (base.status ?? false) { await NetUtil().get(SARSAPI.profile.integral.sign);
if (base.success) {
await Get.dialog(ClockSuccessDialog( await Get.dialog(ClockSuccessDialog(
todayIntegral: 1, tomorrowIntegral: 2)); todayIntegral: 1, tomorrowIntegral: 2));
await UserTool.userProvider.changeTodayClocked(); await UserTool.userProvider.changeTodayClocked();
await getData(); await getData();
} else { } else {
BotToast.showText(text: base.message!); BotToast.showText(text: base.msg);
} }
}, },
elevation: 0, elevation: 0,

@ -1,4 +1,5 @@
import 'package:aku_new_community/const/resource.dart'; import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/pages/personal/clock_in/clock_in_page.dart'; import 'package:aku_new_community/pages/personal/clock_in/clock_in_page.dart';
import 'package:aku_new_community/pages/personal/user_profile_page.dart'; import 'package:aku_new_community/pages/personal/user_profile_page.dart';
@ -338,15 +339,15 @@ class _PersonalIndexState extends State<PersonalIndex>
Spacer(), Spacer(),
MaterialButton( MaterialButton(
onPressed: () async { onPressed: () async {
var base = var base = await NetUtil()
await NetUtil().get(API.intergral.sign); .get(SARSAPI.profile.integral.sign);
if (base.status ?? false) { if (base.success) {
await Get.dialog(ClockSuccessDialog( await Get.dialog(ClockSuccessDialog(
todayIntegral: 1, tomorrowIntegral: 2)); todayIntegral: 1, tomorrowIntegral: 2));
await UserTool.userProvider await UserTool.userProvider
.changeTodayClocked(); .changeTodayClocked();
} else { } else {
BotToast.showText(text: base.message!); BotToast.showText(text: base.msg);
} }
}, },
elevation: 0, elevation: 0,

Loading…
Cancel
Save