mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: update thumb dyn api
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -221,8 +221,11 @@ class Api {
|
||||
static const String followDynamic = '/x/polymer/web-dynamic/v1/feed/all';
|
||||
|
||||
// 动态点赞
|
||||
static const String likeDynamic =
|
||||
'${HttpString.tUrl}/dynamic_like/v1/dynamic_like/thumb';
|
||||
// static const String likeDynamic =
|
||||
// '${HttpString.tUrl}/dynamic_like/v1/dynamic_like/thumb';
|
||||
|
||||
// 动态点赞 new
|
||||
static const String thumbDynamic = '/x/dynamic/feed/dyn/thumb';
|
||||
|
||||
// 获取稍后再看
|
||||
static const String seeYouLater = '/x/v2/history/toview/web';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
@@ -60,23 +61,51 @@ class DynamicsHttp {
|
||||
}
|
||||
|
||||
// 动态点赞
|
||||
static Future likeDynamic({
|
||||
// static Future likeDynamic({
|
||||
// required String? dynamicId,
|
||||
// required int? up,
|
||||
// }) async {
|
||||
// var res = await Request().post(
|
||||
// Api.likeDynamic,
|
||||
// queryParameters: {
|
||||
// 'dynamic_id': dynamicId,
|
||||
// 'up': up,
|
||||
// 'csrf': Accounts.main.csrf,
|
||||
// },
|
||||
// );
|
||||
// if (res.data['code'] == 0) {
|
||||
// return {
|
||||
// 'status': true,
|
||||
// 'data': res.data['data'],
|
||||
// };
|
||||
// } else {
|
||||
// return {'status': false, 'msg': res.data['message']};
|
||||
// }
|
||||
// }
|
||||
|
||||
// 动态点赞
|
||||
static Future thumbDynamic({
|
||||
required String? dynamicId,
|
||||
required int? up,
|
||||
}) async {
|
||||
var res = await Request().post(
|
||||
Api.likeDynamic,
|
||||
Api.thumbDynamic,
|
||||
queryParameters: {
|
||||
'dynamic_id': dynamicId,
|
||||
'up': up,
|
||||
'csrf': Accounts.main.csrf,
|
||||
},
|
||||
data: {
|
||||
'dyn_id_str': dynamicId,
|
||||
'up': up,
|
||||
'spmid': '333.1365.0.0',
|
||||
},
|
||||
options: Options(
|
||||
headers: {
|
||||
'referer': HttpString.dynamicShareBaseUrl,
|
||||
},
|
||||
),
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ class ArticleController extends ReplyController<MainListReply> {
|
||||
|
||||
Future onLike() async {
|
||||
bool isLike = stats.value?.like?.status == true;
|
||||
final res = await DynamicsHttp.likeDynamic(
|
||||
final res = await DynamicsHttp.thumbDynamic(
|
||||
dynamicId: opusData?.idStr ?? articleData?.dynIdStr,
|
||||
up: isLike ? 2 : 1);
|
||||
if (res['status']) {
|
||||
|
||||
@@ -40,7 +40,7 @@ class _ActionPanelState extends State<ActionPanel> {
|
||||
int count = like?.count ?? 0;
|
||||
bool status = like?.status == true;
|
||||
int up = status ? 2 : 1;
|
||||
var res = await DynamicsHttp.likeDynamic(dynamicId: dynamicId, up: up);
|
||||
var res = await DynamicsHttp.thumbDynamic(dynamicId: dynamicId, up: up);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast(!status ? '点赞成功' : '取消赞');
|
||||
if (up == 1) {
|
||||
|
||||
@@ -312,7 +312,7 @@ class RequestUtils {
|
||||
int count = like?.count ?? 0;
|
||||
bool status = like?.status ?? false;
|
||||
int up = status ? 2 : 1;
|
||||
var res = await DynamicsHttp.likeDynamic(dynamicId: dynamicId, up: up);
|
||||
var res = await DynamicsHttp.thumbDynamic(dynamicId: dynamicId, up: up);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast(!status ? '点赞成功' : '取消赞');
|
||||
if (up == 1) {
|
||||
|
||||
Reference in New Issue
Block a user