mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 23:56:13 +08:00
opt: dyn red
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -2,14 +2,19 @@ import 'index.dart';
|
|||||||
|
|
||||||
class CommonHttp {
|
class CommonHttp {
|
||||||
static Future unReadDynamic() async {
|
static Future unReadDynamic() async {
|
||||||
var res = await Request().get(Api.getUnreadDynamic,
|
var res = await Request().get(Api.getUnreadDynamic, data: {
|
||||||
data: {'alltype_offset': 0, 'video_offset': '', 'article_offset': 0});
|
'alltype_offset': 0,
|
||||||
|
'video_offset': 0,
|
||||||
|
'article_offset': 0,
|
||||||
|
});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {'status': true, 'data': res.data['data']['dyn_basic_infos']};
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': res.data['data']['update_info']['item']['count']
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
'status': false,
|
'status': false,
|
||||||
'data': [],
|
|
||||||
'msg': res.data['message'],
|
'msg': res.data['message'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:PiliPalaX/grpc/grpc_repo.dart';
|
import 'package:PiliPalaX/grpc/grpc_repo.dart';
|
||||||
|
import 'package:PiliPalaX/http/common.dart';
|
||||||
import 'package:PiliPalaX/pages/dynamics/view.dart';
|
import 'package:PiliPalaX/pages/dynamics/view.dart';
|
||||||
import 'package:PiliPalaX/pages/home/view.dart';
|
import 'package:PiliPalaX/pages/home/view.dart';
|
||||||
import 'package:PiliPalaX/pages/media/view.dart';
|
import 'package:PiliPalaX/pages/media/view.dart';
|
||||||
|
import 'package:PiliPalaX/utils/global_data.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
@@ -57,11 +59,19 @@ class MainController extends GetxController {
|
|||||||
if (!userLogin.value || dynIndex == -1) {
|
if (!userLogin.value || dynIndex == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await GrpcRepo.dynRed().then((res) {
|
if (GlobalData().grpcReply) {
|
||||||
if (res['status']) {
|
await GrpcRepo.dynRed().then((res) {
|
||||||
setCount(res['data']);
|
if (res['status']) {
|
||||||
}
|
setCount(res['data']);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await CommonHttp.unReadDynamic().then((res) {
|
||||||
|
if (res['status']) {
|
||||||
|
setCount(res['data']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCount([int count = 0]) async {
|
void setCount([int count = 0]) async {
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ class VideoReplyReplyController extends CommonController
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future queryData([bool isRefresh = true]) async {
|
Future queryData([bool isRefresh = true]) async {
|
||||||
if (!isDialogue &&
|
if (GlobalData().grpcReply &&
|
||||||
|
!isDialogue &&
|
||||||
currentPage == 1 &&
|
currentPage == 1 &&
|
||||||
!hasRoot &&
|
!hasRoot &&
|
||||||
firstFloor == null &&
|
firstFloor == null &&
|
||||||
|
|||||||
Reference in New Issue
Block a user