You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
792 B
31 lines
792 B
// api/api_collection.dart
|
|
|
|
import 'package:dio/dio.dart';
|
|
import 'package:music_player_miao/models/universal_bean.dart';
|
|
|
|
const String _CollectionURL = 'http://flyingpig.fun:10010/collections';
|
|
|
|
class CollectionApiMusic {
|
|
final Dio dio = Dio();
|
|
|
|
/// 添加收藏
|
|
Future<UniversalBean> addCollection({
|
|
required int musicId,
|
|
required String Authorization,
|
|
}) async {
|
|
|
|
Response response = await dio.post(
|
|
_CollectionURL,
|
|
queryParameters: {'musicId': musicId},
|
|
options: Options(headers: {
|
|
'Authorization': Authorization,
|
|
'Content-Type': 'application/json;charset=UTF-8'
|
|
})
|
|
);
|
|
|
|
print(response.data);
|
|
return UniversalBean.formMap(response.data); // 将返回的数据转换为 UniversalBean 对象
|
|
|
|
}
|
|
}
|