logo和名称替换
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import 'package:hgmj/hj_model/list_base_model.dart';
|
||||
import 'package:wydj/hj_model/list_base_model.dart';
|
||||
//公共服务api接口
|
||||
import 'package:hgmj/hj_model/home/video_list_model.dart';
|
||||
import 'package:hgmj/tools_base/event_bus/events.dart';
|
||||
import 'package:hgmj/tools_base/net/http_manager.dart';
|
||||
import 'package:wydj/hj_model/home/video_list_model.dart';
|
||||
import 'package:wydj/tools_base/event_bus/events.dart';
|
||||
import 'package:wydj/tools_base/net/http_manager.dart';
|
||||
|
||||
import '../../hj_model/banner/comment_top_banner_model.dart';
|
||||
import '../../hj_model/home/plate_model.dart';
|
||||
@@ -64,14 +64,18 @@ class CommonService {
|
||||
}
|
||||
|
||||
/// 按场景拉取 Banner 列表(如评论置顶 COMMENT_TOP)
|
||||
static Future<List<CommentTopBannerModel>> fetchBannerList({required String scene}) async {
|
||||
static Future<List<CommentTopBannerModel>> fetchBannerList(
|
||||
{required String scene}) async {
|
||||
final result = await httpManager.fetchResponseByGET(
|
||||
'/banner/list',
|
||||
param: {'scene': scene},
|
||||
jsonTransformation: (json) {
|
||||
final list = json['list'] as List?;
|
||||
if (list == null) return <CommentTopBannerModel>[];
|
||||
final items = list.map((e) => CommentTopBannerModel.fromJson(e is Map ? Map<String, dynamic>.from(e) : null)).toList();
|
||||
final items = list
|
||||
.map((e) => CommentTopBannerModel.fromJson(
|
||||
e is Map ? Map<String, dynamic>.from(e) : null))
|
||||
.toList();
|
||||
items.sort((a, b) => (b.sort ?? 0).compareTo(a.sort ?? 0));
|
||||
return items;
|
||||
},
|
||||
@@ -100,14 +104,16 @@ class CommonService {
|
||||
param: param,
|
||||
);
|
||||
if (result.isSuccess) {
|
||||
eventBus.emit(CollectStatusModel(id: objID, isLiked: true, type: type, likeCountDelta: 1));
|
||||
eventBus.emit(CollectStatusModel(
|
||||
id: objID, isLiked: true, type: type, likeCountDelta: 1));
|
||||
}
|
||||
return result.isSuccess;
|
||||
}
|
||||
|
||||
//取消点赞
|
||||
//SP:长视频 SHORT:短视频 COVER:图文帖子 PIC:图集帖子 SEED_LINK:种子/黄油帖子 TAG:标签 COMMENT:评论 video:动漫 image:漫画 text:小说
|
||||
static Future<bool> cancelLike(String? objID, String? type, {List<String>? objIDArr}) async {
|
||||
static Future<bool> cancelLike(String? objID, String? type,
|
||||
{List<String>? objIDArr}) async {
|
||||
assert((type != null && type.isNotEmpty), 'cancelLike type 不能为空');
|
||||
List<String> ids = [];
|
||||
if (objIDArr?.isNotEmpty == true) {
|
||||
@@ -121,18 +127,31 @@ class CommonService {
|
||||
param: param,
|
||||
);
|
||||
if (result.isSuccess) {
|
||||
eventBus.emit(CollectStatusModel(id: objID, isLiked: false, type: type, likeCountDelta: -1));
|
||||
eventBus.emit(CollectStatusModel(
|
||||
id: objID, isLiked: false, type: type, likeCountDelta: -1));
|
||||
}
|
||||
return result.isSuccess;
|
||||
}
|
||||
|
||||
/// 获取我关注用户发的视频
|
||||
/// type 为0 获取用户所有动态, 1为获取用户全部视频
|
||||
static Future<VideoListResp?> fetchFollowDynamics({int page = 1, int size = 20, int? uid, int? type, String? newsType}) async {
|
||||
final param = <String, dynamic>{'pageSize': size, 'pageNumber': page, 'uid': uid, 'type': type, 'newsType': newsType};
|
||||
static Future<VideoListResp?> fetchFollowDynamics(
|
||||
{int page = 1,
|
||||
int size = 20,
|
||||
int? uid,
|
||||
int? type,
|
||||
String? newsType}) async {
|
||||
final param = <String, dynamic>{
|
||||
'pageSize': size,
|
||||
'pageNumber': page,
|
||||
'uid': uid,
|
||||
'type': type,
|
||||
'newsType': newsType
|
||||
};
|
||||
param.removeWhere((k, v) => v == null);
|
||||
final result = await httpManager.fetchResponseByGET('/follow/dynamics/list',
|
||||
param: param, jsonTransformation: (json) => VideoListResp.fromJson(json));
|
||||
param: param,
|
||||
jsonTransformation: (json) => VideoListResp.fromJson(json));
|
||||
return result.isSuccess ? result.data : null;
|
||||
}
|
||||
|
||||
@@ -150,7 +169,8 @@ class CommonService {
|
||||
'type': followUserType,
|
||||
};
|
||||
param.removeWhere((k, v) => v == null);
|
||||
final result = await httpManager.fetchResponseByGET('/follow/list', param: param, jsonTransformation: (json) {
|
||||
final result = await httpManager.fetchResponseByGET('/follow/list',
|
||||
param: param, jsonTransformation: (json) {
|
||||
return ListBaseModel<FollowUserModel>.fromJson(json);
|
||||
});
|
||||
return result.isSuccess ? result.data : null;
|
||||
@@ -198,7 +218,8 @@ class CommonService {
|
||||
'newsType': newsType,
|
||||
};
|
||||
param.removeWhere((k, v) => v == null);
|
||||
final result = await httpManager.fetchResponseByGET('/vid/recommend/list', param: param, jsonTransformation: (json) {
|
||||
final result = await httpManager.fetchResponseByGET('/vid/recommend/list',
|
||||
param: param, jsonTransformation: (json) {
|
||||
return VideoListResp.fromJson(json);
|
||||
});
|
||||
return result.isSuccess ? result.data : null;
|
||||
|
||||
Reference in New Issue
Block a user