初始化

This commit is contained in:
谢宇宁
2026-09-15 15:44:13 +07:00
commit a23ba685e9
1065 changed files with 101122 additions and 0 deletions
@@ -0,0 +1,142 @@
//评论相关接口
import 'package:hgdj/hj_model/comment/comment_list_res.dart';
import 'package:hgdj/hj_model/comment/comment_model.dart';
import 'package:hgdj/hj_model/comment/reply_model.dart';
import 'package:hgdj/hj_model/list_base_model.dart';
import 'package:hgdj/tools_base/net/http_manager.dart';
class CommentService {
// //一级评论的全部列表
static Future<CommentListRes?> getCommentList(
String? objID,
String? curTime,
int? pageNumber,
int? pageSize, {
String? objType, //video:视频(默认) cartoon:动漫 section:专题
}) async {
final param = <String, dynamic>{
'objID': objID,
'curTime': curTime,
'pageNumber': pageNumber,
'pageSize': pageSize,
'objType': objType,
};
param.removeWhere((k, v) => v == null);
final result = await httpManager.fetchResponseByGET(
'/comment/list',
param: param,
);
return result.isSuccess ? CommentListRes.fromJson(result.data) : null;
}
//发表评论(1)
//Address.SEND_COMMENT) objType 评论对象类型 video:视频(默认) cartoon:动漫 section:专题 driftBottle:树洞纸条
// quote这个是评论引用资源,如视频,图集等数据,需要传quote相关数据。
static Future<CommentModel?> sendComment(
String? objID,
int? level,
String? content,
String objType, {
String? quoteID, //引用id
String? quoteImg, //引用资源图片
String? quoteTitle, //引用资源标题
String? quoteType, //引用类型 vid视频 col用户播单 sec官方播单
String? image, // 图片资源
}) async {
final param = {
'objID': objID,
'level': level,
'content': content,
"objType": objType,
"quoteID": quoteID,
"quoteImg": quoteImg,
"quoteTitle": quoteTitle,
"quoteType": quoteType,
'image': image,
};
param.removeWhere((k, v) => v == null);
final result = await httpManager.fetchResponseByPOST(
'/comment/send',
param: param,
);
if (result.isSuccess && result.data is Map) {
return CommentModel.fromJson(result.data);
}
return null;
}
/// 回复
///sendReply 回复评论,
///
///[quoteID] 引用资源id
///[objType] 是业务类型, 根据项目业务来定。
///[cid](评论id), [rid](回复id), [toUserID] (回复评论人的id), 只有回复评论才需要这个参数。
///[objID] 对象id(如视频详情,传视频详情id)。
///评论 [level] = 1 回复 [level] = 2
// */
static Future<ReplyModel?> sendReply(
String? objID,
int? level,
String? content, {
String? cid,
String? rid,
int? toUserID,
dynamic objType,
String? quoteID,
String? quoteImg,
String? quoteTitle,
String? quoteType,
String? image, // 图片资源
}) async {
final param = {
'cid': cid,
'content': content,
'level': level,
'objID': objID,
"objType": objType,
"quoteID": quoteID,
"quoteImg": quoteImg,
"quoteTitle": quoteTitle,
"quoteType": quoteType,
'rid': rid,
'toUserID': toUserID,
'image': image,
};
param.removeWhere((k, v) => v == null);
final result = await httpManager.fetchResponseByPOST(
'/comment/send',
param: param,
);
if (result.isSuccess && result.data is Map) {
return ReplyModel.fromJson(result.data);
}
return null;
}
///评论的全部回复列表
static Future<ListBaseModel<ReplyModel>?> getReplyList(
String? objID,
String? cmtId,
String? curTime,
int? pageNumber,
int? pageSize, [
String? fstID,
]) async {
final param = <String, dynamic>{
'objID': objID,
'cmtId': cmtId,
'curTime': curTime,
'pageNumber': pageNumber,
'pageSize': pageSize,
'fstID': fstID
};
param.removeWhere((k, v) => v == null);
final result = await httpManager.fetchResponseByGET(
'/comment/info',
param: param,
jsonTransformation: (json) => ListBaseModel<ReplyModel>.fromJson(json),
);
return result.isSuccess ? result.data : null;
}
}