admin
2022-05-07 4c7cde7ae5ed57335405459e47de4bbd2726c4ba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import 'dart:convert';
 
import 'package:flutter/material.dart';
import 'package:makemoney/model/msg/app_notify_msg_model.dart';
import 'package:makemoney/utils/encrypt_util.dart';
import '../../utils/string_util.dart';
import '../../utils/user_util.dart';
 
import 'http.dart';
import 'dart:io';
 
class MsgApiUtil {
  ///获取页面通知信息
  static Future<AppNotifyMsgModel?> getNotifyMsg(
      BuildContext context, String type) async {
    var result = await HttpUtil.baseRequest(
        context, "/api/v1/msg/getNotifyMsg", {"type": type}, () {});
    if (result.success) {
      var data = result.data;
      if (data == null) {
        return null;
      }
 
      if (data["code"] == 0) {
        return AppNotifyMsgModel.fromJson(data["data"]);
      }
    }
    return null;
  }
 
  ///获取用户消息
  static Future<Map<String, dynamic>?> getUserMsg(
      BuildContext context, int page) async {
    Map<String, dynamic> params = {};
    params["uid"] = await UserUtil.getUid();
    params["page"] = page;
 
    var result = await HttpUtil.baseRequest(
        context, "/api/v1/msg/getUserMsg", params, () {});
    if (result.success) {
      return result.data;
    }
    return null;
  }
}