logo和名称替换
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import 'package:hgmj/hj_model/list_base_model.dart';
|
||||
import 'package:hgmj/hj_model/video_model.dart';
|
||||
import 'package:hgmj/hj_utils/codec_support.dart';
|
||||
import 'package:hgmj/tools_base/net/http_manager.dart';
|
||||
import 'package:hgmj/tools_base/toast.dart';
|
||||
import 'package:wydj/hj_model/list_base_model.dart';
|
||||
import 'package:wydj/hj_model/video_model.dart';
|
||||
import 'package:wydj/hj_utils/codec_support.dart';
|
||||
import 'package:wydj/tools_base/net/http_manager.dart';
|
||||
import 'package:wydj/tools_base/toast.dart';
|
||||
|
||||
import '../../config/config.dart';
|
||||
import '../../hj_model/home/video_library_model.dart';
|
||||
@@ -18,8 +18,8 @@ class VidService {
|
||||
static Future<WatchCount?> fetchWatchCount({String? vid}) async {
|
||||
final param = <String, dynamic>{'vid': vid};
|
||||
param.removeWhere((k, v) => v == null);
|
||||
final result =
|
||||
await httpManager.fetchResponseByGET('/vid/user/count', param: param, jsonTransformation: (json) => WatchCount.fromJson(json));
|
||||
final result = await httpManager.fetchResponseByGET('/vid/user/count',
|
||||
param: param, jsonTransformation: (json) => WatchCount.fromJson(json));
|
||||
return result.isSuccess ? result.data : null;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ class VidService {
|
||||
'via': via,
|
||||
'tagID': tagID,
|
||||
};
|
||||
final result = await httpManager.fetchResponseByPOST('/vid/play', param: param);
|
||||
final result =
|
||||
await httpManager.fetchResponseByPOST('/vid/play', param: param);
|
||||
return result.isSuccess;
|
||||
}
|
||||
|
||||
@@ -122,7 +123,8 @@ class VidService {
|
||||
'bountyPoint': bountyPoint,
|
||||
};
|
||||
param.removeWhere((k, v) => v == null);
|
||||
final result = await httpManager.fetchResponseByPOST('/vid/submit', param: param);
|
||||
final result =
|
||||
await httpManager.fetchResponseByPOST('/vid/submit', param: param);
|
||||
if (!result.isSuccess) {
|
||||
showToast(result.toast);
|
||||
}
|
||||
@@ -133,7 +135,11 @@ class VidService {
|
||||
/// [moduleSort] 默认视频排序 1、最新,2、最热,3、最多播放量或者推荐,4、十分钟以上视频,5、精华,6、视频 9 最新热评
|
||||
/// [showType]0 默认为hj
|
||||
static Future<ModuleDetailModel?> getModuleDetail(String? subModuleID,
|
||||
{int? moduleSort, int pageNumber = 1, int pageSize = 10, int? showType, String? tagId}) async {
|
||||
{int? moduleSort,
|
||||
int pageNumber = 1,
|
||||
int pageSize = 10,
|
||||
int? showType,
|
||||
String? tagId}) async {
|
||||
final param = <String, dynamic>{
|
||||
'pageSize': pageSize,
|
||||
'pageNumber': pageNumber,
|
||||
@@ -154,7 +160,9 @@ class VidService {
|
||||
/// 只回 allVideoInfo,不含专题/精选等结构,调用方别整个替换 dataSource
|
||||
/// [refreshToken] 每次用户主动下拉换新 UUID;同一 token 重取顺序不变,所以网络层自动重试是安全的
|
||||
static Future<ModuleDetailModel?> refreshRandomModule(String? subModuleID,
|
||||
{int? moduleSort, required String refreshToken, int pageSize = 30}) async {
|
||||
{int? moduleSort,
|
||||
required String refreshToken,
|
||||
int pageSize = 30}) async {
|
||||
final param = <String, dynamic>{
|
||||
'moduleSort': moduleSort,
|
||||
'pageSize': pageSize,
|
||||
@@ -170,7 +178,8 @@ class VidService {
|
||||
}
|
||||
|
||||
///sortType 1:最新 2:本周热门 4:本月最热 5:年度最热
|
||||
static Future<VideoListResp?> getNewestModule({int? sortType, int pageNumber = 1, int pageSize = 10}) async {
|
||||
static Future<VideoListResp?> getNewestModule(
|
||||
{int? sortType, int pageNumber = 1, int pageSize = 10}) async {
|
||||
final param = <String, dynamic>{
|
||||
'pageSize': pageSize,
|
||||
'pageNumber': pageNumber,
|
||||
@@ -186,7 +195,8 @@ class VidService {
|
||||
}
|
||||
|
||||
static Future<dynamic> getShopAddress() async {
|
||||
final result = await httpManager.fetchResponseByGET('/ping/store_url', param: {});
|
||||
final result =
|
||||
await httpManager.fetchResponseByGET('/ping/store_url', param: {});
|
||||
return result.isSuccess ? result.data : null;
|
||||
}
|
||||
|
||||
@@ -290,14 +300,18 @@ class VidService {
|
||||
/// 获取福利任务下面的视频
|
||||
static Future<List<WareDiscountAreaData>?> fetchFreeSource() async {
|
||||
final result = await httpManager.fetchResponseByGET('/vid/discount/area',
|
||||
param: {}, jsonTransformation: (json) => (json['List'] as List?)?.map((e) => WareDiscountAreaData.fromJson(e)).toList());
|
||||
param: {},
|
||||
jsonTransformation: (json) => (json['List'] as List?)
|
||||
?.map((e) => WareDiscountAreaData.fromJson(e))
|
||||
.toList());
|
||||
|
||||
return result.isSuccess ? result.data : null;
|
||||
}
|
||||
|
||||
/// 获取免费福利视频数据
|
||||
/// [sortType] 0 = 福利任务下面 1 最新 2最热
|
||||
static Future<ListBaseModel<VideoModel>> fetchFreeSourceList(String id, {int page = 1, int size = 10, required int sortType}) async {
|
||||
static Future<ListBaseModel<VideoModel>> fetchFreeSourceList(String id,
|
||||
{int page = 1, int size = 10, required int sortType}) async {
|
||||
final param = {
|
||||
'pageNumber': page,
|
||||
'pageSize': size,
|
||||
@@ -305,7 +319,8 @@ class VidService {
|
||||
'sortType': sortType,
|
||||
};
|
||||
final result = await httpManager.fetchResponseByGET('/vid/discount/list',
|
||||
param: param, jsonTransformation: (json) => ListBaseModel<VideoModel>.fromJson(json));
|
||||
param: param,
|
||||
jsonTransformation: (json) => ListBaseModel<VideoModel>.fromJson(json));
|
||||
//返回类型非空,给不了 null:失败时这里抛,由调用方 try/catch 兜底(改可空要连调用方一起改)
|
||||
return result.data;
|
||||
}
|
||||
@@ -313,7 +328,8 @@ class VidService {
|
||||
/// 获取跑马灯数据
|
||||
static Future<List<MarqueeModel>?> fetchAnnounce(int type) async {
|
||||
final param = <String, dynamic>{"type": type};
|
||||
final result = await httpManager.fetchResponseByGET('/mine/announce/list', param: param);
|
||||
final result = await httpManager.fetchResponseByGET('/mine/announce/list',
|
||||
param: param);
|
||||
|
||||
final List<MarqueeModel> list = [];
|
||||
if (result.isSuccess) {
|
||||
@@ -368,15 +384,17 @@ class VidService {
|
||||
|
||||
/// 获取片库筛选条件
|
||||
static Future<HomeVideoLibrary> fetchLibrary() async {
|
||||
final result =
|
||||
await httpManager.fetchResponseByGET('/vid/library', param: {}, jsonTransformation: (json) => HomeVideoLibrary.fromJson(json));
|
||||
final result = await httpManager.fetchResponseByGET('/vid/library',
|
||||
param: {},
|
||||
jsonTransformation: (json) => HomeVideoLibrary.fromJson(json));
|
||||
//返回类型非空,给不了 null:失败时这里抛,由调用方 try/catch 兜底(改可空要连调用方一起改)
|
||||
return result.data;
|
||||
}
|
||||
|
||||
///视频专题样式-更换一批
|
||||
static Future<VideoListResp> sectionVideoExchange(String? sectionID) async {
|
||||
final result = await httpManager.fetchResponseByGET('/vid/section/changeVideo/$sectionID', param: {});
|
||||
final result = await httpManager
|
||||
.fetchResponseByGET('/vid/section/changeVideo/$sectionID', param: {});
|
||||
//失败时 data 是原始结构,别拿它当模型解析;fromJson 内部 json ??= {},传 null 就是空列表
|
||||
return VideoListResp.fromJson(result.isSuccess ? result.data : null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user