mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: validate
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,12 +1,18 @@
|
|||||||
import 'package:PiliPlus/http/api.dart';
|
import 'package:PiliPlus/http/api.dart';
|
||||||
import 'package:PiliPlus/http/init.dart';
|
import 'package:PiliPlus/http/init.dart';
|
||||||
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
class ValidateHttp {
|
class ValidateHttp {
|
||||||
static Future gaiaVgateRegister(String vVoucher) async {
|
static Future gaiaVgateRegister(String vVoucher) async {
|
||||||
final res = await Request().post(
|
final res = await Request().post(
|
||||||
Api.gaiaVgateRegister,
|
Api.gaiaVgateRegister,
|
||||||
data: {'v_voucher': vVoucher},
|
queryParameters: {
|
||||||
|
if (Accounts.main.isLogin) 'csrf': Accounts.main.csrf,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
'v_voucher': vVoucher,
|
||||||
|
},
|
||||||
options: Options(
|
options: Options(
|
||||||
contentType: Headers.formUrlEncodedContentType,
|
contentType: Headers.formUrlEncodedContentType,
|
||||||
),
|
),
|
||||||
@@ -26,6 +32,9 @@ class ValidateHttp {
|
|||||||
}) async {
|
}) async {
|
||||||
final res = await Request().post(
|
final res = await Request().post(
|
||||||
Api.gaiaVgateValidate,
|
Api.gaiaVgateValidate,
|
||||||
|
queryParameters: {
|
||||||
|
if (Accounts.main.isLogin) 'csrf': Accounts.main.csrf,
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
'challenge': challenge,
|
'challenge': challenge,
|
||||||
'seccode': seccode,
|
'seccode': seccode,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class LiveController
|
|||||||
@override
|
@override
|
||||||
bool handleError(String? errMsg) {
|
bool handleError(String? errMsg) {
|
||||||
if (errMsg?.startsWith('voucher') == true) {
|
if (errMsg?.startsWith('voucher') == true) {
|
||||||
|
loadingState.value = LoadingState.error(' -352 ');
|
||||||
RequestUtils.validate(
|
RequestUtils.validate(
|
||||||
errMsg!,
|
errMsg!,
|
||||||
(gaiaVtoken) {
|
(gaiaVtoken) {
|
||||||
@@ -35,7 +36,6 @@ class LiveController
|
|||||||
onReload();
|
onReload();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
loadingState.value = LoadingState.error(' -352 ');
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -491,8 +491,12 @@ class RequestUtils {
|
|||||||
token: captchaData.token,
|
token: captchaData.token,
|
||||||
validate: captchaData.validate,
|
validate: captchaData.validate,
|
||||||
);
|
);
|
||||||
if (res['status']) {
|
if (res['status'] && res['data']?['is_valid'] == 1) {
|
||||||
onSuccess.call(captchaData.token!);
|
// onSuccess(captchaData.token!);
|
||||||
|
final griskId = res['data']?['grisk_id'];
|
||||||
|
if (griskId != null) {
|
||||||
|
onSuccess(griskId);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user