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/init.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class ValidateHttp {
|
||||
static Future gaiaVgateRegister(String vVoucher) async {
|
||||
final res = await Request().post(
|
||||
Api.gaiaVgateRegister,
|
||||
data: {'v_voucher': vVoucher},
|
||||
queryParameters: {
|
||||
if (Accounts.main.isLogin) 'csrf': Accounts.main.csrf,
|
||||
},
|
||||
data: {
|
||||
'v_voucher': vVoucher,
|
||||
},
|
||||
options: Options(
|
||||
contentType: Headers.formUrlEncodedContentType,
|
||||
),
|
||||
@@ -26,6 +32,9 @@ class ValidateHttp {
|
||||
}) async {
|
||||
final res = await Request().post(
|
||||
Api.gaiaVgateValidate,
|
||||
queryParameters: {
|
||||
if (Accounts.main.isLogin) 'csrf': Accounts.main.csrf,
|
||||
},
|
||||
data: {
|
||||
'challenge': challenge,
|
||||
'seccode': seccode,
|
||||
|
||||
@@ -28,6 +28,7 @@ class LiveController
|
||||
@override
|
||||
bool handleError(String? errMsg) {
|
||||
if (errMsg?.startsWith('voucher') == true) {
|
||||
loadingState.value = LoadingState.error(' -352 ');
|
||||
RequestUtils.validate(
|
||||
errMsg!,
|
||||
(gaiaVtoken) {
|
||||
@@ -35,7 +36,6 @@ class LiveController
|
||||
onReload();
|
||||
},
|
||||
);
|
||||
loadingState.value = LoadingState.error(' -352 ');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -491,8 +491,12 @@ class RequestUtils {
|
||||
token: captchaData.token,
|
||||
validate: captchaData.validate,
|
||||
);
|
||||
if (res['status']) {
|
||||
onSuccess.call(captchaData.token!);
|
||||
if (res['status'] && res['data']?['is_valid'] == 1) {
|
||||
// onSuccess(captchaData.token!);
|
||||
final griskId = res['data']?['grisk_id'];
|
||||
if (griskId != null) {
|
||||
onSuccess(griskId);
|
||||
}
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user