@@ -63,6 +63,8 @@ class Api {
6363 return res;
6464 };
6565
66+ static final _fullPathRegExp = RegExp ('http(s?)://' );
67+
6668 static Future <T ?> _get <T >(
6769 String path,
6870 BeanBuilder <T > builder, {
@@ -72,13 +74,15 @@ class Api {
7274 }) =>
7375 http
7476 .get (
75- Uri (
76- scheme: Apis .apiScheme,
77- host: Apis .apiHost,
78- port: Apis .apiPort,
79- queryParameters: queryParams,
80- path: path,
81- ),
77+ path.startsWith (_fullPathRegExp)
78+ ? Uri .parse (path)
79+ : Uri (
80+ scheme: Apis .apiScheme,
81+ host: Apis .apiHost,
82+ port: Apis .apiPort,
83+ queryParameters: queryParams,
84+ path: path,
85+ ),
8286 headers: < String , String > {
8387 HttpHeaders .contentTypeHeader: ContentType .json.toString (),
8488 }..addAll (
@@ -103,12 +107,14 @@ class Api {
103107 }) =>
104108 http
105109 .post (
106- Uri (
107- scheme: Apis .apiScheme,
108- host: Apis .apiHost,
109- port: Apis .apiPort,
110- path: path,
111- ),
110+ path.startsWith (_fullPathRegExp)
111+ ? Uri .parse (path)
112+ : Uri (
113+ scheme: Apis .apiScheme,
114+ host: Apis .apiHost,
115+ port: Apis .apiPort,
116+ path: path,
117+ ),
112118 body: jsonEncode (body),
113119 headers: < String , String > {
114120 HttpHeaders .contentTypeHeader: ContentType .json.toString (),
@@ -199,6 +205,26 @@ class Api {
199205 Apis .scheme.userLikes,
200206 (e) => (e['list' ] as List ).cast <int >(),
201207 );
208+
209+ static Future <AppBulletinResp ?> checkBulletin (bool isWeb) => _get (
210+ Apis .appBulletinUrl (isWeb),
211+ AppBulletinResp .fromMap,
212+ ignoreErrorHandle: true ,
213+ ignoreToken: true ,
214+ ).catchError ((_) {});
215+ }
216+
217+ class AppBulletinResp {
218+ int ? id;
219+ bool ? once;
220+ String ? title;
221+ String ? content;
222+
223+ AppBulletinResp .fromMap (Map map)
224+ : id = map['id' ],
225+ once = map['once' ],
226+ title = map['title' ],
227+ content = map['content' ];
202228}
203229
204230class MarketSchemeTransMetaDataResp {
0 commit comments