对接积分签到

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

@ -3,6 +3,7 @@ part of 'sars_api.dart';
class _ProfileApi {
_MyHouse house = _MyHouse();
_MyFamily family = _MyFamily();
_Integral integral = _Integral();
}
class _MyHouse {
@ -26,3 +27,11 @@ class _MyFamily {
////
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/constants/sars_api.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/gen/assets.gen.dart';
@ -33,17 +34,9 @@ class _ClockInPageState extends State<ClockInPage> {
bool get hasClocked => _integralModel?.isSign ?? false;
Future getData() async {
var base = await NetUtil().get(API.intergral.info);
if (base.status ?? false) {
var base = await NetUtil().get(SARSAPI.profile.integral.info);
if (base.success) {
_integralModel = IntegralInfoModel.fromJson(base.data);
} else {
BotToast.showText(text: base.message!);
}
}
@override
void initState() {
getData().then((value) {
if (_integralModel != null) {
_records = _integralModel!.signRecordList;
_configs = _integralModel!.rewardSetting
@ -54,7 +47,14 @@ class _ClockInPageState extends State<ClockInPage> {
.toList();
setState(() {});
}
});
} else {
BotToast.showText(text: base.msg);
}
}
@override
void initState() {
getData();
super.initState();
}
@ -221,14 +221,15 @@ class _ClockInPageState extends State<ClockInPage> {
onPressed: hasClocked
? null
: () async {
var base = await NetUtil().get(API.intergral.sign);
if (base.status ?? false) {
var base =
await NetUtil().get(SARSAPI.profile.integral.sign);
if (base.success) {
await Get.dialog(ClockSuccessDialog(
todayIntegral: 1, tomorrowIntegral: 2));
await UserTool.userProvider.changeTodayClocked();
await getData();
} else {
BotToast.showText(text: base.message!);
BotToast.showText(text: base.msg);
}
},
elevation: 0,

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

Loading…
Cancel
Save