Commit 97bf3e0f authored by 汪林玲's avatar 汪林玲

生活模块网络库新增null-safety

parents
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/
# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
.vscode/
\ No newline at end of file
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 1aafb3a8b9b0c36241c5f5b34ee914770f015818
channel: stable
project_type: package
# 生活模块网络库
### 引入说明
```
life_repository:
git:
url: 'git@git.xiaomanxiong.com:flutter-plugin/app-life-repository.git'
ref: 'null-safety'
```
\ No newline at end of file
class ActivityConfigEntity {
static ActivityConfigEntity fromJson(Map<String, dynamic>? json) {
return ActivityConfigEntity.from(json!);
}
String? id;
String? redirectType;
String? bindParams;
String? imgUrl;
String? redirectTitle;
String? locationType;
String? startTime;
String? endTime;
String? weight;
String? showContent;
String? showType;
String? iosRedirectUrl;
String? androidRedirectUrl;
String? groupId;
String? behaviorType;
String? dayNumber;
String? specificTime;
String? showTime;
ActivityConfigEntity(
{this.id,
this.redirectType,
this.bindParams,
this.imgUrl,
this.redirectTitle,
this.locationType,
this.startTime,
this.endTime,
this.weight,
this.showContent,
this.showType,
this.iosRedirectUrl,
this.androidRedirectUrl,
this.groupId,
this.behaviorType,
this.dayNumber,
this.specificTime,
this.showTime});
ActivityConfigEntity.from(Map<String, dynamic> json) {
id = json['id'];
redirectType = json['redirect_type'];
bindParams = json['bind_params'];
imgUrl = json['img_url'];
redirectTitle = json['redirect_title'];
locationType = json['location_type'];
startTime = json['start_time'];
endTime = json['end_time'];
weight = json['weight'];
showContent = json['show_content'];
showType = json['show_type'];
iosRedirectUrl = json['ios_redirect_url'];
androidRedirectUrl = json['android_redirect_url'];
groupId = json['group_id'];
behaviorType = json['behavior_type'];
dayNumber = json['day_number'];
specificTime = json['specific_time'];
showTime = json['show_time'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['redirect_type'] = this.redirectType;
data['bind_params'] = this.bindParams;
data['img_url'] = this.imgUrl;
data['redirect_title'] = this.redirectTitle;
data['location_type'] = this.locationType;
data['start_time'] = this.startTime;
data['end_time'] = this.endTime;
data['weight'] = this.weight;
data['show_content'] = this.showContent;
data['show_type'] = this.showType;
data['ios_redirect_url'] = this.iosRedirectUrl;
data['android_redirect_url'] = this.androidRedirectUrl;
data['group_id'] = this.groupId;
data['behavior_type'] = this.behaviorType;
data['day_number'] = this.dayNumber;
data['specific_time'] = this.specificTime;
data['show_time'] = this.showTime;
return data;
}
}
class AppNavEntity {
static AppNavEntity fromJson(Map<String, dynamic>? json) {
return AppNavEntity.from(json!);
}
String? id;
String? name;
String? title;
String? iconUrl;
String? redirectType;
String? androidRedirectUrl;
String? iosRedirectUrl;
String? bindParams;
String? groupId;
String? behaviorType;
String? dayNumber;
String? startTime;
String? endTime;
String? specificTime;
AppNavEntity(
{this.id,
this.name,
this.title,
this.iconUrl,
this.redirectType,
this.androidRedirectUrl,
this.iosRedirectUrl,
this.bindParams,
this.groupId,
this.behaviorType,
this.dayNumber,
this.startTime,
this.endTime,
this.specificTime});
AppNavEntity.from(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
title = json['title'];
iconUrl = json['icon_url'];
redirectType = json['redirect_type'];
androidRedirectUrl = json['android_redirect_url'];
iosRedirectUrl = json['ios_redirect_url'];
bindParams = json['bind_params'];
groupId = json['group_id'];
behaviorType = json['behavior_type'];
dayNumber = json['day_number'];
startTime = json['start_time'];
endTime = json['end_time'];
specificTime = json['specific_time'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['title'] = this.title;
data['icon_url'] = this.iconUrl;
data['redirect_type'] = this.redirectType;
data['android_redirect_url'] = this.androidRedirectUrl;
data['ios_redirect_url'] = this.iosRedirectUrl;
data['bind_params'] = this.bindParams;
data['group_id'] = this.groupId;
data['behavior_type'] = this.behaviorType;
data['day_number'] = this.dayNumber;
data['start_time'] = this.startTime;
data['end_time'] = this.endTime;
data['specific_time'] = this.specificTime;
return data;
}
}
class ComboItem {
String? shopImg;
String? shopId;
String? shopTitle;
String? distance;
String? itemTitle;
String? endPrice;
String? dealType;
String? commentScore;
String? address;
String? originalPrice;
String? userCommission;
String? userCommissionText;
String? dealId;
ComboItem(
{this.shopImg,
this.shopId,
this.shopTitle,
this.distance,
this.itemTitle,
this.endPrice,
this.dealType,
this.commentScore,
this.address,
this.originalPrice,
this.userCommission,
this.userCommissionText,
this.dealId});
ComboItem.fromJson(Map<String, dynamic> json) {
shopImg = json['shop_img'];
shopId = json['shop_id'];
shopTitle = json['shop_title'];
distance = json['distance'];
itemTitle = json['item_title'];
endPrice = json['end_price'];
dealType = json['deal_type'];
commentScore = json['comment_score'];
address = json['address'];
originalPrice = json['original_price'];
userCommission = json['user_commission'];
userCommissionText = json['user_commission_text'];
dealId = json['deal_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['shop_img'] = this.shopImg;
data['shop_id'] = this.shopId;
data['shop_title'] = this.shopTitle;
data['distance'] = this.distance;
data['item_title'] = this.itemTitle;
data['end_price'] = this.endPrice;
data['deal_type'] = this.dealType;
data['comment_score'] = this.commentScore;
data['address'] = this.address;
data['original_price'] = this.originalPrice;
data['user_commission'] = this.userCommission;
data['user_commission_text'] = this.userCommissionText;
data['deal_id'] = this.dealId;
return data;
}
}
class FilterItemEntity {
static FilterItemEntity fromJson(Map<String, dynamic> json) {
return FilterItemEntity.from(json);
}
String? id;
String? name;
List<FilterItemEntity>? subs;
FilterItemEntity(this.id, this.name, this.subs);
FilterItemEntity.from(Map<String, dynamic> json) {
id = json['id'];
name = json['name'] ?? json['text'];
subs = [];
var subList = json['sub_list'];
if (subList != null && subList is List) {
subList.forEach((item) {
subs!.add(FilterItemEntity.fromJson(item));
});
}
}
}
class FilterObject {
static FilterObject fromJson(Map<String, dynamic>? json) {
return FilterObject.from(json!);
}
late List<FilterItemEntity> regions;
late List<FilterItemEntity> categorys;
late List<FilterItemEntity> sorts;
FilterObject.from(Map<String, dynamic> json) {
regions = [];
categorys = [];
sorts = [];
json['region_list'].forEach((item) {
regions.add(FilterItemEntity.fromJson(item));
});
json['category_list'].forEach((item) {
categorys.add(FilterItemEntity.fromJson(item));
});
json['sort_list'].forEach((item) {
sorts.add(FilterItemEntity.fromJson(item));
});
}
}
class IpConfigEntity {
String? status;
String? info;
String? infocode;
String? province;
String? city;
String? adcode;
String? rectangle;
IpConfigEntity({
this.status,
this.info,
this.infocode,
this.province,
this.city,
this.adcode,
this.rectangle,
});
}
class Poi2MapEntity {
String? name;
String? id;
String? location;
String? type;
String? typecode;
String? pname;
String? cityname;
String? adname;
String? address;
String? pcode;
String? citycode;
String? adcode;
Poi2MapEntity({
this.name,
this.id,
this.location,
this.type,
this.typecode,
this.pname,
this.cityname,
this.adname,
this.address,
this.pcode,
this.citycode,
this.adcode,
});
}
class RestaurantItem {
String? shopImg;
String? shopId;
String? shopTitle;
String? commentScore;
String? avgPrice;
String? quarterVolume;
String? categoryName;
String? regionName;
String? distance;
String? showStarScore;
List<ShopSubItemList>? itemList;
RestaurantItem(
{this.shopImg,
this.shopId,
this.shopTitle,
this.commentScore,
this.avgPrice,
this.quarterVolume,
this.categoryName,
this.regionName,
this.distance,
this.showStarScore,
this.itemList});
RestaurantItem.fromJson(Map<String, dynamic> json) {
shopImg = json['shop_img'];
shopId = json['shop_id'];
shopTitle = json['shop_title'];
commentScore = json['comment_score'];
showStarScore = json['show_star_score'];
avgPrice = json['avg_price'];
quarterVolume = json['quarter_volume'];
categoryName = json['category_name'];
regionName = json['region_name'];
distance = json['distance'];
if (json['item_list'] != null) {
itemList =List<ShopSubItemList>.empty(growable: true);
json['item_list'].forEach((v) {
itemList!.add(new ShopSubItemList.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['shop_img'] = this.shopImg;
data['shop_id'] = this.shopId;
data['shop_title'] = this.shopTitle;
data['comment_score'] = this.commentScore;
data['show_star_score'] = this.showStarScore;
data['avg_price'] = this.avgPrice;
data['quarter_volume'] = this.quarterVolume;
data['category_name'] = this.categoryName;
data['region_name'] = this.regionName;
data['distance'] = this.distance;
if (this.itemList != null) {
data['item_list'] = this.itemList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class ShopSubItemList {
String? itemTitle;
String? endPrice;
String? originalPrice;
String? dealType;
ShopSubItemList({this.itemTitle, this.endPrice, this.originalPrice, this.dealType});
ShopSubItemList.fromJson(Map<String, dynamic> json) {
itemTitle = json['item_title'];
endPrice = json['end_price'];
originalPrice = json['original_price'];
dealType = json['deal_type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['item_title'] = this.itemTitle;
data['end_price'] = this.endPrice;
data['original_price'] = this.originalPrice;
data['deal_type'] = this.dealType;
return data;
}
}
class SearchTipsItem {
static SearchTipsItem fromJson(Map<String, dynamic>? json) {
return SearchTipsItem.from(json!);
}
String? id;
String? name;
SearchTipsItem.from(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
}
class SecKillGoods {
static SecKillGoods fromJson(Map<String, dynamic>? json) {
return SecKillGoods.from(json!);
}
String? itemTitle;
String? itemPic;
String? endPrice;
String? originalPrice;
String? soldPercent;
String? menuText;
String? volumeText;
String? address;
String? distance;
String? couponUrl;
String? isRedirect;
String? userCommission;
String? userCommissionText;
SecKillGoods(
{this.itemTitle,
this.itemPic,
this.endPrice,
this.originalPrice,
this.soldPercent,
this.menuText,
this.volumeText,
this.address,
this.distance,
this.couponUrl,
this.isRedirect,
this.userCommission,
this.userCommissionText});
SecKillGoods.from(Map<String, dynamic> json) {
itemTitle = json['item_title'];
itemPic = json['item_pic'];
endPrice = json['end_price'];
originalPrice = json['original_price'];
soldPercent = json['sold_percent'];
menuText = json['menu_text'];
volumeText = json['volume_text'];
address = json['address'];
distance = json['distance'];
couponUrl = json['coupon_url'];
isRedirect = json['is_redirect'];
userCommission = json['user_commission'];
userCommissionText = json['user_commission_text'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['item_title'] = this.itemTitle;
data['item_pic'] = this.itemPic;
data['end_price'] = this.endPrice;
data['original_price'] = this.originalPrice;
data['sold_percent'] = this.soldPercent;
data['menu_text'] = this.menuText;
data['volume_text'] = this.volumeText;
data['address'] = this.address;
data['distance'] = this.distance;
data['coupon_url'] = this.couponUrl;
data['is_redirect'] = this.isRedirect;
data['user_commission'] = this.userCommission;
data['user_commission_text'] = this.userCommissionText;
return data;
}
}
class SeckillSession {
static SeckillSession fromJson(Map<String, dynamic>? json) {
return SeckillSession.from(json!);
}
String? id;
String? text;
String? statusText;
SeckillSession({this.id, this.text, this.statusText});
SeckillSession.from(Map<String, dynamic> json) {
id = json['id'];
text = json['text'];
statusText = json['status_text'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['text'] = this.text;
data['status_text'] = this.statusText;
return data;
}
}
class ShopCommentItemEntity {
String? comment;
String? createTime;
String? star;
ShopCommentItemEntity({this.comment, this.createTime, this.star});
ShopCommentItemEntity.fromJson(Map<String, dynamic> json) {
comment = json['comment'];
createTime = json['create_time'];
star = json['star'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['comment'] = this.comment;
data['create_time'] = this.createTime;
data['star'] = this.star;
return data;
}
}
class ShopInfoEntity {
static ShopInfoEntity fromJson(Map<String, dynamic>? json) {
return ShopInfoEntity.from(json!);
}
ShopInfo? shopInfo;
List<ShopCouponItem>? shopCouponItems;
ShopInfoEntity({this.shopInfo, this.shopCouponItems});
ShopInfoEntity.from(Map<String, dynamic> json) {
shopInfo = json['shop_info'] != null
? new ShopInfo.fromJson(json['shop_info'])
: null;
if (json['item_list'] != null) {
shopCouponItems = List<ShopCouponItem>.empty(growable: true);
json['item_list'].forEach((v) {
shopCouponItems!.add(new ShopCouponItem.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.shopInfo != null) {
data['shop_info'] = this.shopInfo!.toJson();
}
if (this.shopCouponItems != null) {
data['item_list'] = this.shopCouponItems!.map((v) => v.toJson()).toList();
}
return data;
}
}
class ShopInfo {
String? shopImg;
String? shopId;
String? shopTitle;
String? address;
String? cityName;
String? commentScore;
String? showStarScore;
String? distance;
String? avgPrice;
String? quarterVolume;
String? businessTime;
ShopInfo(
{this.shopImg,
this.shopId,
this.shopTitle,
this.address,
this.cityName,
this.commentScore,
this.showStarScore,
this.distance,
this.avgPrice,
this.quarterVolume,
this.businessTime});
ShopInfo.fromJson(Map<String, dynamic> json) {
shopImg = json['shop_img'];
shopId = json['shop_id'];
shopTitle = json['shop_title'];
address = json['address'];
cityName = json['city_name'];
commentScore = json['comment_score'];
showStarScore = json['show_star_score'];
distance = json['distance'];
avgPrice = json['avg_price'];
quarterVolume = json['quarter_volume'];
businessTime = json['business_time'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['shop_img'] = this.shopImg;
data['shop_id'] = this.shopId;
data['shop_title'] = this.shopTitle;
data['address'] = this.address;
data['city_name'] = this.cityName;
data['comment_score'] = this.commentScore;
data['show_star_score'] = this.showStarScore;
data['distance'] = this.distance;
data['avg_price'] = this.avgPrice;
data['quarter_volume'] = this.quarterVolume;
data['business_time'] = this.businessTime;
return data;
}
}
class ShopCouponItem {
String? itemTitle;
String? itemImg;
String? originalPrice;
String? endPrice;
String? couponUrl;
String? dealType;
String? discountPercent;
String? userCommission;
String? userCommissionText;
String? dealId;
ShopCouponItem(
{this.itemTitle,
this.itemImg,
this.originalPrice,
this.endPrice,
this.couponUrl,
this.dealType,
this.discountPercent,
this.userCommission,
this.userCommissionText,
this.dealId});
ShopCouponItem.fromJson(Map<String, dynamic> json) {
itemTitle = json['item_title'];
itemImg = json['item_img'];
originalPrice = json['original_price'];
endPrice = json['end_price'];
couponUrl = json['coupon_url'];
dealType = json['deal_type'];
discountPercent = json['discount_percent'];
userCommission = json['user_commission'];
userCommissionText = json['user_commission_text'];
dealId = json['deal_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['item_title'] = this.itemTitle;
data['item_img'] = this.itemImg;
data['original_price'] = this.originalPrice;
data['end_price'] = this.endPrice;
data['coupon_url'] = this.couponUrl;
data['deal_type'] = this.dealType;
data['discount_percent'] = this.discountPercent;
data['user_commission'] = this.userCommission;
data['user_commission_text'] = this.userCommissionText;
data['deal_id'] = this.dealId;
return data;
}
}
import './combo_item.dart';
import './restaurant_item.dart';
class ShopItemEntity {
static ShopItemEntity fromJson(Map<String, dynamic>? json) {
return ShopItemEntity.from(json!);
}
// 0 优惠店铺,1 优惠套餐
int? type;
ComboItem? combo;
RestaurantItem? restaurant;
ShopItemEntity.from(Map<String, dynamic> json) {
type = json['item_list'] != null ? 0 : 1;
if (type == 0) {
restaurant = RestaurantItem.fromJson(json);
} else if (type == 1) {
combo = ComboItem.fromJson(json);
}
}
}
import 'shop_recommend_item_entity.dart';
import 'shop_comment_item_entity.dart';
class ShopOuterInfoEntity {
static ShopOuterInfoEntity fromJson(Map<String, dynamic>? json) {
return ShopOuterInfoEntity.from(json!);
}
List<ShopRecommendItemEntity> recommendItemEntitys = [];
List<ShopCommentItemEntity> commentItemEntitys = [];
ShopOuterInfoEntity.from(Map<String, dynamic> json) {
recommendItemEntitys = [];
commentItemEntitys = [];
json['recommend_list'].forEach((item) {
recommendItemEntitys.add(ShopRecommendItemEntity.fromJson(item));
});
json['comment_list'].forEach((item) {
commentItemEntitys.add(ShopCommentItemEntity.fromJson(item));
});
}
}
class ShopRecommendItemEntity {
String? itemTitle;
String? itemPic;
ShopRecommendItemEntity({this.itemTitle, this.itemPic});
ShopRecommendItemEntity.fromJson(Map<String, dynamic> json) {
itemTitle = json['item_title'];
itemPic = json['item_pic'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['item_title'] = this.itemTitle;
data['item_pic'] = this.itemPic;
return data;
}
}
class MapTipEntity {
String? id;
String? name;
String? district;
String? adcode;
String? location;
String? address;
String? typecode;
List<dynamic>? city;
MapTipEntity({
this.id,
this.name,
this.district,
this.adcode,
this.location,
this.address,
this.typecode,
this.city,
});
}
library life_repository;
export 'repository/amap_repository.dart';
export 'repository/app_nav_repository.dart';
export 'repository/city_repository.dart';
export 'repository/sec_kill_repository.dart';
export 'repository/filter_arepository.dart';
export 'repository/shop_list_repository.dart';
export 'repository/shop_info_repository.dart';
/// 数据实体类
export 'entity/tip_map_entity.dart';
export 'entity/poi2_map_entity.dart';
export 'entity/ipconfig_entity.dart';
export 'entity/app_nav_entity.dart';
export 'entity/sec_kill_session.dart';
export 'entity/sec_kill_goods.dart';
export 'entity/activity_config_entity.dart';
export 'entity/filter_item_entity.dart';
export 'entity/combo_item.dart';
export 'entity/restaurant_item.dart';
export 'entity/shop_item_entity.dart';
export 'entity/search_tips_item.dart';
export 'entity/shop_info_entity.dart';
export 'entity/shop_recommend_item_entity.dart';
export 'entity/shop_comment_item_entity.dart';
export 'entity/shop_outer_info_entity.dart';
export 'package:base_repository/base_repository.dart';
import 'package:life_repository/entity/ipconfig_entity.dart';
import 'package:life_repository/entity/poi2_map_entity.dart';
import 'package:life_repository/entity/tip_map_entity.dart';
import 'impl/amap_repository_impl.dart';
///
/// TencentRepository
/// 高德地图相关的网络库
///
abstract class AMapRepository {
///
/// 获取单例
///
static AMapRepository get() {
return AMapRepositoryImpl();
}
///
/// 输入提示是一类简单的HTTP接口,提供根据用户输入的关键词查询返回建议列表。
/// [key] 请求服务权限标识(用户在高德地图官网申请Web服务API类型KEY)
/// [keywords] 查询关键词
/// [type] POI分类(服务可支持传入多个分类,多个类型剑用“|”分隔、可选值:POI分类名称、分类代码、此处强烈建议使用分类代码,否则可能会得到不符合预期的结果)
/// [location] 坐标(格式:“X,Y”(经度,纬度),不可以包含空格、建议使用location参数,可在此location附近优先返回搜索关键词信息、在请求参数city不为空时生效)
/// [city] 搜索城市(可选值:citycode、adcode,不支持县级市。填入此参数后,会尽量优先返回此城市数据,但是不一定仅局限此城市,如:在深圳市搜天安门,返回北京天安门结果。)
/// [citylimit] 仅返回指定城市数据(可选值:true/false) false
/// [datatype] 返回的数据类型(多种数据类型用“|”分隔,可选值:all-返回所有数据类型、poi-返回POI数据类型、bus-返回公交站点数据类型、busline-返回公交线路数据类型)
/// [sig] 数字签名(数字签名获取和使用方法:https://lbs.amap.com/faq/account/key/72)
/// [output] 返回数据格式类型(可选值:JSON,XML)
///
Future<List<MapTipEntity>> inputSearchTips({
required String key,
required String keywords,
String? type,
String? location,
String? city,
bool citylimit = false,
String datatype = 'all',
String? sig,
String output = 'JSON',
});
///
/// 地点搜索服务2.0是一类Web API接口服务;服务提供多种场景的地点搜索能力,包括关键字搜索、周边搜索、多边形区域搜索、ID搜索。
/// 周边搜索
/// [key] 请求服务权限标识(用户在高德地图官网申请Web服务API类型KEY)
/// [location] 中心点坐标(圆形区域检索中心点,不支持多个点。经度和纬度用","分割,经度在前,纬度在后,经纬度小数点后不得超过6位)
/// [keywords] 地点关键字(需要被检索的地点文本信息。、多个关键字用“|”分割,文本总长度不可超过80字符)
/// [types] 指定地点类型(点文本搜索接口支持按照设定的POI类型限定地点搜索结果;地点类型与poi typecode是同类内容,可以传入多个poi typecode,相互之间用“|”分隔,内容可以参考POI分类码表;地点(POI)列表的排序会按照高德搜索能力进行综合权重排序;120000(商务住宅)150000(交通设施服务))
/// [radius] 搜索半径(取值范围:0-50000,大于50000时按默认值,单位:米)
/// [sortrule] 排序规则(规定返回结果的排序规则。按距离排序:distance;综合排序:weight)
/// [region] 搜索区划(增加指定区域内数据召回权重,如需严格限制召回数据在区域内,请搭配使用city_limit参数,可输入行政区划名或对应citycode或adcode) 无,默认全国范围内搜索
/// [showFields] 返回结果控制(show_fields用来筛选response结果中可选字段。show_fields的使用需要遵循如下规则:1、具体可指定返回的字段类请见下方返回结果说明中的“show_fields”内字段类型;2、多个字段间采用“,”进行分割;3、show_fields未设置时,只返回基础信息类内字段。)
/// [pageSize] 当前分页展示的数据条数(page_size的取值1-25)
/// [pageNum] 请求第几分页(page_num的取值1-100)
/// [sig] 数字签名(请参考数字签名获取和使用方法)
/// [output] 返回结果格式类型(默认格式为json,目前只支持json格式;)
///
Future<List<Poi2MapEntity>> poi2AroundSearch({
required String key,
required String location,
String? keywords,
String? types,
String radius = '3000',
String sortrule = 'distance',
String? region,
String? showFields,
int pageSize = 10,
int pageNum = 1,
String? sig,
String output = 'json',
});
///
/// IP定位是一套简单的HTTP接口,根据用户输入的IP地址,能够快速的帮用户定位IP的所在位置。
/// IP定位:仅支持IPV4,不支持国外IP解析。
/// [key] 请求服务权限标识
/// [ip] ip地址(需要搜索的IP地址(仅支持国内)、若用户不填写IP,则取客户http之中的请求来进行定位)
/// [sig] 选择数字签名认证的付费用户必填
///
Future<IpConfigEntity> ipConfigAddress({
required String key,
String? ip,
String? sig,
});
Future<String?> addressToGps({
required String key,
String? address,
String? city,
String? sig,
});
///
/// 经纬度转地址
/// [key] 用户key
/// [location] 经纬度坐标(116.481488,39.990464)
///
Future<dynamic> geocodeAddress({String? key, String? location});
}
import 'package:life_repository/entity/app_nav_entity.dart';
import 'package:life_repository/entity/activity_config_entity.dart';
import './impl/app_nav_repository_impl.dart';
/// 获取砖石位配置信息
abstract class AppNavRepository {
static AppNavRepositoryImpl get() {
return AppNavRepositoryImpl();
}
///
/// [type] 广告位置 1 首页钻石位 2 app我的,3生活广场
Future<List<AppNavEntity>> getAppNavList(String type);
/// [location_type] 广告位置
/// 1首页顶部、2首页弹窗、3首页浮标、4首页通知、5首页中部、6免单页面、
/// 7品牌页面、8商品详情、9个人中心、10首页主会场、11首页分会场、12订单通知、
/// 13外卖返现、14我的浮标、15启动页面、16福利专区、17余额提现、18提现结果、19活动会场
/// 会根据需求增加或减少
Future<List<ActivityConfigEntity>> getActivityConfigList(String locationType);
}
import './impl/city_repository_impl.dart';
/// 根据城市名称获取城市id
abstract class CityRepository {
static CityRepositoryImpl get() {
return CityRepositoryImpl();
}
/// 根据城市名称获取城市id
/// [cityName] 城市名
Future<String?> getCityId(String cityName);
}
import './impl/filter_arepository_impl.dart';
import '../entity/filter_item_entity.dart';
import '../entity/search_tips_item.dart';
abstract class FilterArepository {
static FilterArepositoryImpl get() {
return FilterArepositoryImpl();
}
/// 获取筛选项列表
/// [cityId] 城市ID
Future<FilterObject?> getFilterList(String cityId);
/// 搜索智能提示
/// [city] 城市id
/// [lat] 纬度
/// [lng] 经度
/// [firstCateId] 一级类目id
/// [keywords] 检索词
Future<List<SearchTipsItem>> findSearchTips(
String cityId,
String lat,
String lng,
String firstCateId,
String keywords,
);
}
import 'package:dio/dio.dart';
import 'package:base_repository/base_repository.dart';
import 'package:life_repository/entity/ipconfig_entity.dart';
import 'package:life_repository/entity/poi2_map_entity.dart';
import 'package:life_repository/entity/tip_map_entity.dart';
import '../amap_repository.dart';
class AMapRepositoryImpl extends AMapRepository {
AMapRepositoryImpl.get();
static final AMapRepositoryImpl _instance = AMapRepositoryImpl.get();
factory AMapRepositoryImpl() {
return _instance;
}
@override
Future<List<MapTipEntity>> inputSearchTips({
String? key,
String? keywords,
String? type,
String? location,
String? city,
bool citylimit = false,
String datatype = 'all',
String? sig,
String output = 'JSON',
}) async {
Options options = Options(headers: {'base_url': 'AMap'});
Map<String, dynamic> parameters = {
'key': key,
'keywords': keywords,
'citylimit': citylimit,
'datatype': datatype,
'output': output,
};
if (city != null) {
parameters['city'] = city;
}
if (type != null) {
parameters['type'] = type;
}
if (location != null) {
parameters['location'] = location;
}
if (sig != null) {
parameters['sig'] = sig;
}
dynamic result = await DSDioUtil.getInstance().get(
'/v3/assistant/inputtips',
options: options,
queryParameters: parameters,
);
if (result['status'] == '1' && result['tips'] is List) {
List<dynamic> tips = List<dynamic>.from(result['tips']);
List<MapTipEntity> tipsEntity = List<MapTipEntity>.empty(growable: true);
for (dynamic item in tips) {
MapTipEntity entity = MapTipEntity(
id: (item['id'] is String) ? (item['id'] as String?) : '',
name: (item['name'] is String) ? (item['name'] as String?) : '',
district:
(item['district'] is String) ? (item['district'] as String?) : '',
adcode: (item['adcode'] is String) ? (item['adcode'] as String?) : '',
location:
(item['location'] is String) ? (item['location'] as String?) : '',
address:
(item['address'] is String) ? (item['address'] as String?) : '',
typecode:
(item['typecode'] is String) ? (item['typecode'] as String?) : '',
city: (item['city'] is List)
? (item['city'] as List?)
: ['${item['city']}'],
);
if (entity.id!.isNotEmpty && entity.address!.isNotEmpty) {
tipsEntity.add(entity);
}
}
return tipsEntity;
} else {
throw SysnetError(
code: -1,
message: '未发现数据',
type: SysnetErrorType.other,
exception: null,
);
}
}
@override
Future<List<Poi2MapEntity>> poi2AroundSearch({
String? key,
String? location,
String? keywords,
String? types,
String radius = '3000',
String sortrule = 'distance',
String? region,
String? showFields,
int pageSize = 10,
int pageNum = 1,
String? sig,
String output = 'json',
}) async {
Options options = Options(headers: {'base_url': 'AMap'});
Map<String, dynamic> parameters = {
'key': key,
'location': location,
'radius': radius,
'sortrule': sortrule,
'page_size': pageSize,
'page_num': pageNum,
'output': output,
};
if (keywords != null) {
parameters['keywords'] = keywords;
}
if (types != null) {
parameters['types'] = types;
}
if (region != null) {
parameters['region'] = region;
}
if (showFields != null) {
parameters['show_fields'] = showFields;
}
if (sig != null) {
parameters['sig'] = sig;
}
parameters['output'] = output;
dynamic result = await DSDioUtil.getInstance().get(
'/v5/place/around',
options: options,
queryParameters: parameters,
);
List<Poi2MapEntity> poisEntity = List<Poi2MapEntity>.empty(growable:true);
if (result['status'] == '1' && result['pois'] is List) {
List<dynamic> pois = List<dynamic>.from(result['pois']);
for (var item in pois) {
poisEntity.add(Poi2MapEntity(
name: item['name'],
id: item['id'],
location: item['location'],
type: item['type'],
typecode: item['typecode'],
pname: item['pname'],
cityname: item['cityname'],
adname: item['adname'],
address: item['address'],
pcode: item['pcode'],
citycode: item['citycode'],
adcode: item['adcode'],
));
}
}
return poisEntity;
}
@override
Future<IpConfigEntity> ipConfigAddress({
String? key,
String? ip,
String? sig,
}) async {
Options options = Options(headers: {'base_url': 'AMap'});
Map<String, dynamic> parameters = {
'key': key,
};
if (ip != null) {
parameters['ip'] = ip;
}
if (sig != null) {
parameters['sig'] = sig;
}
dynamic result = await DSDioUtil.getInstance().get(
'/v3/ip',
options: options,
queryParameters: parameters,
);
return IpConfigEntity(
status: result['status'],
info: result['info'],
infocode: result['infocode'],
province: result['province'],
city: result['city'],
adcode: result['adcode'],
rectangle: result['rectangle'],
);
}
@override
Future<String?> addressToGps(
{String? key, String? address, String? city, String? sig}) async {
Options options = Options(headers: {'base_url': 'AMap'});
Map<String, dynamic> parameters = {
'key': key,
};
if (city != null) {
parameters['city'] = city;
}
if (sig != null) {
parameters['sig'] = sig;
}
parameters['address'] = address;
dynamic result = await DSDioUtil.getInstance().get(
'/v3/geocode/geo',
options: options,
queryParameters: parameters,
);
if (result == null ||
result['geocodes'] == null ||
result['geocodes'].length == 0) {
return null;
}
return result['geocodes'][0]['location'];
}
@override
Future geocodeAddress({String? key, String? location}) async {
Options options = Options(headers: {'base_url': 'AMap'});
Map<String, dynamic> parameters = {
'key': key,
'location':location,
'extensions':'all',
'radius':'1000'
};
dynamic result = await DSDioUtil.getInstance().get(
'/v3/geocode/regeo',
options: options,
queryParameters:parameters,
);
return result;
}
}
import 'package:life_repository/life_repository.dart';
import 'package:life_repository/entity/app_nav_entity.dart';
class AppNavRepositoryImpl extends AppNavRepository {
AppNavRepositoryImpl.get();
static final AppNavRepositoryImpl _instance = AppNavRepositoryImpl.get();
factory AppNavRepositoryImpl() {
return _instance;
}
@override
Future<List<AppNavEntity>> getAppNavList(String type) async {
var result = await DSDioUtil.getInstance()
.get('/home.getAppNav', queryParameters: {"type": type});
var res =
DSResponseList<AppNavEntity>.fromJson(result, AppNavEntity.fromJson);
return res.data;
}
@override
Future<List<ActivityConfigEntity>> getActivityConfigList(
String locationType) async {
var result = await DSDioUtil.getInstance().get('/home.getActivityConfig',
queryParameters: {"location_type": locationType});
var res = DSResponseList<ActivityConfigEntity>.fromJson(
result, ActivityConfigEntity.fromJson);
return res.data;
}
}
import 'package:life_repository/life_repository.dart';
class CityRepositoryImpl extends CityRepository {
CityRepositoryImpl.get();
static final CityRepositoryImpl _instance = CityRepositoryImpl.get();
factory CityRepositoryImpl() {
return _instance;
}
@override
Future<String?> getCityId(String cityName) async {
var result = await DSDioUtil.getInstance().get('/lifeChannel.getCityId',
queryParameters: {"city_name": cityName});
var res = DSResponseObject<String?>.fromJson(result, (json) {
return json!['city_id'];
});
return res.data;
}
}
import 'package:life_repository/life_repository.dart';
class FilterArepositoryImpl extends FilterArepository {
FilterArepositoryImpl.get();
static final FilterArepositoryImpl _instance = FilterArepositoryImpl.get();
factory FilterArepositoryImpl() {
return _instance;
}
@override
Future<FilterObject?> getFilterList(String cityId) async {
var result = await DSDioUtil.getInstance()
.get('/lifeChannel.filterList', queryParameters: {"city_id": cityId});
var res =
DSResponseObject<FilterObject>.fromJson(result, FilterObject.fromJson);
return res.data;
}
@override
Future<List<SearchTipsItem>> findSearchTips(String cityId, String lat,
String lng, String firstCateId, String keywords) async {
var result = await DSDioUtil.getInstance()
.get('/lifeChannel.searchTips', queryParameters: {
"city_id": cityId,
"lat": lat,
"lng": lng,
"first_cate_id": firstCateId,
"keywords": keywords
});
var res = DSResponseList<SearchTipsItem>.fromJson(
result, SearchTipsItem.fromJson);
return res.data;
}
}
import 'package:life_repository/life_repository.dart';
class SecKillRepositoryImpl extends SecKillRepository {
SecKillRepositoryImpl.get();
static final SecKillRepositoryImpl _instance = SecKillRepositoryImpl.get();
factory SecKillRepositoryImpl() {
return _instance;
}
@override
Future<List<SeckillSession>> findSeckillSession(
String cityId, String source) async {
var result = await DSDioUtil.getInstance().get(
'/lifeChannel.seckillSession',
queryParameters: {"source": source, "city_id": cityId});
var res = DSResponseList<SeckillSession>.fromJson(
result, SeckillSession.fromJson);
return res.data;
}
@override
Future<List<SecKillGoods>> findSeckillGoodsList(
String cityId, String showId, String lat, String lng, int page) async {
var result = await DSDioUtil.getInstance()
.get('/lifeChannel.seckillItemList', queryParameters: {
"show_id": showId,
"city_id": cityId,
"lat": lat,
"lng": lng,
"page": page
});
print('==========cityId:$cityId ');
var res =
DSResponseList<SecKillGoods>.fromJson(result, SecKillGoods.fromJson);
return res.data;
}
@override
Future<bool> findSeckillSwitch() async {
var result = await DSDioUtil.getInstance()
.get('systemConfig.getConfig', queryParameters: {
"key_name": "mtSeckillSwitch",
});
var res = DSResponseObject<bool>.fromJson(result, (json) {
return json!['mtSeckillSwitch'] == '1';
});
return res.data ?? false;
}
}
import '../../life_repository.dart';
class ShopInfoRepositoryImpl extends ShopInfoRepository {
ShopInfoRepositoryImpl.get();
static final ShopInfoRepositoryImpl _instance = ShopInfoRepositoryImpl.get();
factory ShopInfoRepositoryImpl() {
return _instance;
}
@override
Future<ShopInfoEntity?> findShopDetail(String shopId, String lat, String lng,
[String source = "1"]) async {
var result = await DSDioUtil.getInstance().get('lifeChannel.shopDetail',
queryParameters: {
"shop_id": shopId,
"lat": lat,
"lng": lng,
"source": source
});
var res = DSResponseObject<ShopInfoEntity>.fromJson(
result, ShopInfoEntity.fromJson);
return res.data;
}
@override
Future<ShopOuterInfoEntity?> findShopOuterInfo(
String shopId, String firstCateId) async {
var result = await DSDioUtil.getInstance().get('lifeChannel.shopOther',
queryParameters: {"shop_id": shopId, "first_cate_id": firstCateId});
var res = DSResponseObject<ShopOuterInfoEntity>.fromJson(
result, ShopOuterInfoEntity.fromJson);
return res.data;
}
@override
Future<String?> getShareUrl(String shopId, String firstCateId) async {
var result = await DSDioUtil.getInstance().get('lifeChannel.shareLink',
queryParameters: {"shop_id": shopId, "first_cate_id": firstCateId});
var res = DSResponseObject<String?>.fromJson(result, (json) {
return json!['url'];
});
return res.data;
}
}
import 'package:life_repository/life_repository.dart';
class ShopListRepositoryImpl extends ShopListRepository {
ShopListRepositoryImpl.get();
static final ShopListRepositoryImpl _instance = ShopListRepositoryImpl.get();
factory ShopListRepositoryImpl() {
return _instance;
}
@override
Future<List<ShopItemEntity>> findComboList(
String cityId,
String lat,
String lng,
String page,
String firstCateId,
String keywords,
String secondCateId,
String regionId,
String sortType) async {
var result = await DSDioUtil.getInstance()
.get('/lifeChannel.comboList', queryParameters: {
"city_id": cityId,
"lat": lat,
"lng": lng,
"page": page,
"first_cate_id": firstCateId,
"keywords": keywords,
"second_cate_id": secondCateId,
"region_id": regionId,
"sort_type": sortType
});
var res = DSResponseList<ShopItemEntity>.fromJson(
result, ShopItemEntity.fromJson);
return res.data;
}
@override
Future<List<ShopItemEntity>> findRestaurantList(
String cityId,
String lat,
String lng,
String page,
String firstCateId,
String keywords,
String secondCateId,
String regionId,
String sortType) async {
var result = await DSDioUtil.getInstance()
.get('/lifeChannel.restaurantList', queryParameters: {
"city_id": cityId,
"lat": lat,
"lng": lng,
"page": page,
"first_cate_id": firstCateId,
"keywords": keywords,
"second_cate_id": secondCateId,
"region_id": regionId,
"sort_type": sortType
});
var res = DSResponseList<ShopItemEntity>.fromJson(
result, ShopItemEntity.fromJson);
return res.data;
}
}
import './impl/sec_kill_repository_impl.dart';
import 'package:life_repository/entity/sec_kill_session.dart';
import 'package:life_repository/entity/sec_kill_goods.dart';
abstract class SecKillRepository {
static SecKillRepositoryImpl get() {
return SecKillRepositoryImpl();
}
/// 获取秒杀场次
/// [cityId] 城市ID
/// [source] 来源,1本地生活主页,2秒杀列表
Future<List<SeckillSession>> findSeckillSession(String cityId, String source);
/// 获取秒杀商品列表
/// [cityId] 城市id
/// [showId] 秒杀场次Id
/// [lat] 纬度
/// [lng] 经度
/// [page] 页码
Future<List<SecKillGoods>> findSeckillGoodsList(
String cityId, String showId, String lat, String lng, int page);
Future<bool> findSeckillSwitch();
}
import '../entity/shop_info_entity.dart';
import '../entity/shop_outer_info_entity.dart';
import './impl/shop_info_repository_impl.dart';
abstract class ShopInfoRepository {
static ShopInfoRepositoryImpl get() {
return ShopInfoRepositoryImpl();
}
Future<ShopInfoEntity?> findShopDetail(String shopId, String lat, String lng,
[String source = "1"]);
Future<ShopOuterInfoEntity?> findShopOuterInfo(
String shopId, String firstCateId);
Future<String?> getShareUrl(String shopId, String firstCateId);
}
import 'package:life_repository/life_repository.dart';
import './impl/shop_list_repository_impl.dart';
abstract class ShopListRepository {
static ShopListRepositoryImpl get() {
return ShopListRepositoryImpl();
}
/// 美食餐厅列表
/// [city] 城市id
/// [lat] 纬度
/// [lng] 经度
/// [page]
/// [firstCateId] 一级类目id
/// [keywords] 检索词
/// [secondCateId] 二级类目id
/// [regionId] 商圈id
/// [sortType] 排序值
Future<List<ShopItemEntity>> findComboList(
String cityId,
String lat,
String lng,
String page,
String firstCateId,
String keywords,
String secondCateId,
String regionId,
String sortType,
);
Future<List<ShopItemEntity>> findRestaurantList(
String cityId,
String lat,
String lng,
String page,
String firstCateId,
String keywords,
String secondCateId,
String regionId,
String sortType,
);
}
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.8.1"
base_repository:
dependency: "direct main"
description:
path: "."
ref: null-safety
resolved-ref: "5b60d47410e4bb47d0e8f4fc8c6be00e28b2002d"
url: "git@git.xiaomanxiong.com:flutter-plugin/app-base-repository.git"
source: git
version: "1.0.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.15.0"
dio:
dependency: transitive
description:
name: dio
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"
name: life_repository
description: 生活模块网络.
version: 0.0.1
homepage:
publish_to: none
environment:
sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
base_repository: #基础网络模块
git:
url: 'git@git.xiaomanxiong.com:flutter-plugin/app-base-repository.git'
ref: 'null-safety'
dev_dependencies:
flutter_test:
sdk: flutter
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment