|
|
@@ -0,0 +1,136 @@ |
|
|
|
import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
|
|
|
|
// 应用配置信息 |
|
|
|
|
|
|
|
class AppConfigModel { |
|
|
|
// 应用配置的key |
|
|
|
AppConfigKeyModel keys; |
|
|
|
// 引导页 |
|
|
|
AppConfigGuideModel guideImage; |
|
|
|
|
|
|
|
static AppConfigModel _config; |
|
|
|
|
|
|
|
AppConfigModel({this.keys, this.guideImage}); |
|
|
|
|
|
|
|
static AppConfigModel getConfig() => _config; |
|
|
|
|
|
|
|
static Future<AppConfigModel> init() async { |
|
|
|
Map result = |
|
|
|
await NetUtil.post('/api/v1/app/guide', method: NetMethod.GET); |
|
|
|
try { |
|
|
|
var data = result['data']; |
|
|
|
_config = AppConfigModel.fromJson(Map<String, dynamic>.from(data)); |
|
|
|
Logger.debug('基础设置初始化'); |
|
|
|
return _config; |
|
|
|
} catch (err) { |
|
|
|
Logger.error(err); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
AppConfigModel.fromJson(Map<String, dynamic> json) { |
|
|
|
keys = json['keys'] != null ? new AppConfigKeyModel.fromJson(json['keys']) : null; |
|
|
|
guideImage = json['guide_image'] != null |
|
|
|
? new AppConfigGuideModel.fromJson(json['guide_image']) |
|
|
|
: null; |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, dynamic> toJson() { |
|
|
|
final Map<String, dynamic> data = new Map<String, dynamic>(); |
|
|
|
if (this.keys != null) { |
|
|
|
data['keys'] = this.keys.toJson(); |
|
|
|
} |
|
|
|
if (this.guideImage != null) { |
|
|
|
data['guide_image'] = this.guideImage.toJson(); |
|
|
|
} |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class AppConfigKeyModel { |
|
|
|
AppConfigKeyItemModel weibo; |
|
|
|
AppConfigKeyItemModel qq; |
|
|
|
AppConfigKeyItemModel weixin; |
|
|
|
AppConfigKeyItemModel jdIos; |
|
|
|
AppConfigKeyItemModel jdAndroid; |
|
|
|
|
|
|
|
AppConfigKeyModel({this.weibo, this.qq, this.weixin, this.jdIos, this.jdAndroid}); |
|
|
|
|
|
|
|
AppConfigKeyModel.fromJson(Map<String, dynamic> json) { |
|
|
|
weibo = json['weibo'] != null ? new AppConfigKeyItemModel.fromJson(json['weibo']) : null; |
|
|
|
qq = json['qq'] != null ? new AppConfigKeyItemModel.fromJson(json['qq']) : null; |
|
|
|
weixin = |
|
|
|
json['weixin'] != null ? new AppConfigKeyItemModel.fromJson(json['weixin']) : null; |
|
|
|
jdIos = json['jd_ios'] != null ? new AppConfigKeyItemModel.fromJson(json['jd_ios']) : null; |
|
|
|
jdAndroid = json['jd_android'] != null |
|
|
|
? new AppConfigKeyItemModel.fromJson(json['jd_android']) |
|
|
|
: null; |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, dynamic> toJson() { |
|
|
|
final Map<String, dynamic> data = new Map<String, dynamic>(); |
|
|
|
if (this.weibo != null) { |
|
|
|
data['weibo'] = this.weibo.toJson(); |
|
|
|
} |
|
|
|
if (this.qq != null) { |
|
|
|
data['qq'] = this.qq.toJson(); |
|
|
|
} |
|
|
|
if (this.weixin != null) { |
|
|
|
data['weixin'] = this.weixin.toJson(); |
|
|
|
} |
|
|
|
if (this.jdIos != null) { |
|
|
|
data['jd_ios'] = this.jdIos.toJson(); |
|
|
|
} |
|
|
|
if (this.jdAndroid != null) { |
|
|
|
data['jd_android'] = this.jdAndroid.toJson(); |
|
|
|
} |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class AppConfigKeyItemModel { |
|
|
|
String appId; |
|
|
|
String appkey; |
|
|
|
String secret; |
|
|
|
String redirectUrl; |
|
|
|
String universalLink; |
|
|
|
|
|
|
|
AppConfigKeyItemModel({this.appkey, this.secret, this.redirectUrl}); |
|
|
|
|
|
|
|
AppConfigKeyItemModel.fromJson(Map<String, dynamic> json) { |
|
|
|
appId = json['app_id']; |
|
|
|
appkey = json['appkey']; |
|
|
|
secret = json['secret']; |
|
|
|
redirectUrl = json['redirect_url']; |
|
|
|
universalLink = json['universal_link']; |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, dynamic> toJson() { |
|
|
|
final Map<String, dynamic> data = new Map<String, dynamic>(); |
|
|
|
data['app_id'] = this.appId; |
|
|
|
data['appkey'] = this.appkey; |
|
|
|
data['secret'] = this.secret; |
|
|
|
data['redirect_url'] = this.redirectUrl; |
|
|
|
data['universal_link'] = this.universalLink; |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class AppConfigGuideModel { |
|
|
|
String isShowIndicator; |
|
|
|
List<String> images; |
|
|
|
|
|
|
|
AppConfigGuideModel({this.isShowIndicator, this.images}); |
|
|
|
|
|
|
|
AppConfigGuideModel.fromJson(Map<String, dynamic> json) { |
|
|
|
isShowIndicator = json['is_show_indicator']; |
|
|
|
images = json['images'].cast<String>(); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, dynamic> toJson() { |
|
|
|
final Map<String, dynamic> data = new Map<String, dynamic>(); |
|
|
|
data['is_show_indicator'] = this.isShowIndicator; |
|
|
|
data['images'] = this.images; |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |