Commit 09a7debfa21b924de4e59c31ce5e0a8e1b0c40cd

Authored by wdn127929
1 parent c52d485c

线上券---编辑时,删除七牛云图片 OK

... ... @@ -57,7 +57,7 @@ PODS:
- Flutter
- flutter_downloader (0.0.1):
- Flutter
- flutter_image_compress (1.0.0):
- flutter_image_compress_common (1.0.0):
- Flutter
- Mantle
- SDWebImage
... ... @@ -129,10 +129,10 @@ PODS:
- Flutter
- FlutterMacOS
- Reachability (3.2)
- SDWebImage (5.18.0):
- SDWebImage/Core (= 5.18.0)
- SDWebImage/Core (5.18.0)
- SDWebImageWebPCoder (0.13.0):
- SDWebImage (5.19.2):
- SDWebImage/Core (= 5.19.2)
- SDWebImage/Core (5.19.2)
- SDWebImageWebPCoder (0.14.6):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.17)
- sendsms (0.0.1):
... ... @@ -184,7 +184,7 @@ DEPENDENCIES:
- flutter_app_update (from `.symlinks/plugins/flutter_app_update/ios`)
- flutter_bugly (from `.symlinks/plugins/flutter_bugly/ios`)
- flutter_downloader (from `.symlinks/plugins/flutter_downloader/ios`)
- flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`)
- flutter_image_compress_common (from `.symlinks/plugins/flutter_image_compress_common/ios`)
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_native_image (from `.symlinks/plugins/flutter_native_image/ios`)
... ... @@ -273,8 +273,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_bugly/ios"
flutter_downloader:
:path: ".symlinks/plugins/flutter_downloader/ios"
flutter_image_compress:
:path: ".symlinks/plugins/flutter_image_compress/ios"
flutter_image_compress_common:
:path: ".symlinks/plugins/flutter_image_compress_common/ios"
flutter_inappwebview:
:path: ".symlinks/plugins/flutter_inappwebview/ios"
flutter_keyboard_visibility:
... ... @@ -357,7 +357,7 @@ SPEC CHECKSUMS:
flutter_app_update: 65f61da626cb111d1b24674abc4b01728d7723bc
flutter_bugly: c9800f4d5bc5bdc27ffdde3417a26ba44266e0c3
flutter_downloader: b7301ae057deadd4b1650dc7c05375f10ff12c39
flutter_image_compress: 5a5e9aee05b6553048b8df1c3bc456d0afaac433
flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e
flutter_inappwebview: 3d32228f1304635e7c028b0d4252937730bbc6cf
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_native_image: 9c0b7451838484458e5b0fae007b86a4c2d4bdfe
... ... @@ -382,8 +382,8 @@ SPEC CHECKSUMS:
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
photo_manager: 4f6810b7dfc4feb03b461ac1a70dacf91fba7604
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
SDWebImage: 182830bcddc30cde95fbc60dfe4badc3553d94ba
SDWebImageWebPCoder: af09429398d99d524cae2fe00f6f0f6e491ed102
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
sendsms: 4065f76018b22a3e6987b4630f161feab95cef23
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
... ...
... ... @@ -347,7 +347,7 @@
"${BUILT_PRODUCTS_DIR}/flutter_app_badger/flutter_app_badger.framework",
"${BUILT_PRODUCTS_DIR}/flutter_app_update/flutter_app_update.framework",
"${BUILT_PRODUCTS_DIR}/flutter_downloader/flutter_downloader.framework",
"${BUILT_PRODUCTS_DIR}/flutter_image_compress/flutter_image_compress.framework",
"${BUILT_PRODUCTS_DIR}/flutter_image_compress_common/flutter_image_compress_common.framework",
"${BUILT_PRODUCTS_DIR}/flutter_inappwebview/flutter_inappwebview.framework",
"${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework",
"${BUILT_PRODUCTS_DIR}/flutter_native_image/flutter_native_image.framework",
... ... @@ -396,7 +396,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_app_badger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_app_update.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_downloader.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_image_compress.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_image_compress_common.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_native_image.framework",
... ... @@ -548,7 +548,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 529;
CURRENT_PROJECT_VERSION = 5293;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_MODE = release;
... ... @@ -696,7 +696,7 @@
CODE_SIGN_ENTITLEMENTS = "Runner/一键订Debug.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 529;
CURRENT_PROJECT_VERSION = 5293;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_MODE = release;
... ... @@ -732,7 +732,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 529;
CURRENT_PROJECT_VERSION = 5293;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_MODE = release;
... ...
... ... @@ -31,6 +31,7 @@ class Constant {
*
* */
static const String qiniuUrl = 'https://qn.colorcun.com/';
static const Map<String, List<String>> authorityConfig = {
'充值短信': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
... ... @@ -211,7 +212,9 @@ class Constant {
'前台',
],
'设置服务人员':[ '管理员',
'店长',]
'设置服务人员': [
'管理员',
'店长',
]
};
}
... ...
... ... @@ -562,5 +562,7 @@ class HttpUrl {
"?service=Android.Reserve.GetReserveDetailDataSet"; // 获取预订详情所需数据集合
static const String get_reserve_detail_relation_data =
"?service=Android.Reserve.GetReserveDetailRelationData"; // 获取预订详情所需其他附属信息
static const String qiniu_delete_img =
"?service=App.Qiniu.DeleteImg"; // 删除七牛图片资源
}
... ...
... ... @@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_picker/flutter_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
... ... @@ -89,6 +90,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
UploadImageProvider _uploadImageProvider;
List<UploadImgModel> img = [];
List<String> imgAll = [];
@override
void initState() {
super.initState();
... ... @@ -200,6 +203,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
uploadImgModel.qiniuUrl = element;
uploadImgModel.process = 1;
img.add(uploadImgModel);
imgAll.add(element); //初始化数据,同步数据库数据
});
}
... ... @@ -293,17 +297,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
"status": swichState ? "1" : "0",
'is_type': widget.isMine ? "2" : "1"
};
List<String> images = [];
if (!widget.isMine) {
params['is_examine'] = swichHexiao ? "1" : "0";
params['uid_list'] = uids;
params['price'] =
_priceControl.text.trim().length == 0 ? '0' : _priceControl.text;
List<String> images = [];
if (img.length > 0) {
img.forEach((value) {
images.add(value.qiniuUrl);
});
}
Map use = {
'is_cash': money ? '1' : '0',
'is_discount': discount ? '1' : '0',
... ... @@ -333,6 +339,17 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
bool isSuccess =
await couponProvider.createCustomerActivity(context, params);
if (isSuccess) {
if (!widget.isMine) {
// imgAll和images 比较,挑出不一样的,删除七牛云
Set<String> difference = Set.from(imgAll)..removeAll(images);
List<String> differenceList = difference.toList(); //需要删除的图片
if (differenceList.length > 0) {
String delImgs = Utils.listToStringEnglish(differenceList);
delImgs = delImgs.replaceAll(Constant.qiniuUrl, '');
_uploadImageProvider.deleteImg(context, {'url': delImgs},
needToast: false);
}
}
//成功之后跳回前一个页面
// bus.emit('refresh_coupon_list');
EventBus().emit('refresh_coupon_invitation');
... ... @@ -340,7 +357,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
// bus.emit('refresh_marketting_page');
bus.emit('refresh_table_m_coupon');
bus.emit('refresh_wine_msg');
bus.emit('refresh_wine_msg');
Navigator.pop(context, true);
}
}
... ... @@ -374,7 +391,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
inputFormatters:title== '券名称' ? [LengthLimitingTextInputFormatter(15)]:[],
inputFormatters: title == '券名称'
? [LengthLimitingTextInputFormatter(15)]
: [],
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
... ... @@ -990,6 +1009,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
setState(() {});
},
callback: () {
imgAll.add(img.last.qiniuUrl);
print('完成');
// for (UploadImgModel item
// in _uploadImageProvider
// .tableImageList) {
... ...
... ... @@ -40,17 +40,17 @@ class UploadImageProvider extends ChangeNotifier {
UploadImgModel storeImage3 = UploadImgModel(); //预订安排介绍
UploadImgModel storeImage4 = UploadImgModel(); //预订安排介绍
UploadImgModel storeImage5 = UploadImgModel(); //预订安排介绍
UploadImgModel storeImage6 = UploadImgModel(); //预订安排介绍
UploadImgModel storeImage6 = UploadImgModel(); //预订安排介绍
// List<UploadImgModel> wineImageList = []; //新建存酒
int countUpload = 0;
Map<String, UploadImgModel> _data = {};
Map<String, UploadImgModel> _data = {};
void setDynamicValue(String key, UploadImgModel value) {
_data[key] = value;
}
UploadImgModel getDynamicValue(String key) {
return _data[key];
}
... ... @@ -61,7 +61,34 @@ class UploadImageProvider extends ChangeNotifier {
dish.process = 0.01;
}
/// 删除七牛图片资源
Future<QiniuInfoSunModel> deleteImg(
BuildContext context, Map<String, String> params,
{isShowLoading = true, bool needToast = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.qiniu_delete_img,
data: params, showLoading: false)
.catchError((error) {});
if (baseResp.code == Constant.status_success) {
if (baseResp.data is List) {
if (baseResp.data[0]['code'] == 200) {
if (needToast) {
Utils.showToast('删除成功!');
}
} else {
if (needToast) {
Utils.showToast('${baseResp.data[0]['data']}');
}
}
}
} else {
if (baseResp != null) {
if (needToast) {
Utils.showToast("删除失败!");
}
}
}
}
/// 获取七牛上传token信息
Future<QiniuInfoSunModel> getQiniuInfo(
... ...
... ... @@ -204,6 +204,7 @@ class UploadImageUtil {
//新建优惠券
imageList[index].process = 1;
imageList[index].qiniuUrl = imgUrl;
callback();
} else if (uploadType == UploadType.RemarkImagesType) {
//备注图片
imageList[index].process = 1;
... ...