Browse Source

照片和名称增加安全检测

htc 8 months ago
parent
commit
a24a39a062
1 changed files with 26 additions and 17 deletions
  1. 26 17
      pagesHouse/Mine/PersonalEditing/PersonalEditing.vue

+ 26 - 17
pagesHouse/Mine/PersonalEditing/PersonalEditing.vue

@@ -123,19 +123,23 @@
 					sourceType: ['album'], //从相册选择
 					success: chooseImageRes => {
 						const tempFilePaths = chooseImageRes.tempFilePaths;
-						uni.uploadFile({
-							url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
-							filePath: tempFilePaths[0],
-							name: 'file',
-							header: {
-								token: wx.getStorageSync('access_token')
-							},
-							success: res => {
-								let data = JSON.parse(res.data);
-								this.dto.shopSign = data.data.url;
-								this.save();
-							}
-						});
+						this.$api.detectionContent(tempFilePaths[0], 2).then(result => {
+							if (result.code === 0) {
+								uni.uploadFile({
+									url: 'https://i.ringzle.com/island-cloud-server/oss/file/upload', // 仅为示例,非真实的接口地址
+									filePath: tempFilePaths[0],
+									name: 'file',
+									header: {
+										token: wx.getStorageSync('access_token')
+									},
+									success: res => {
+										let data = JSON.parse(res.data);
+										this.dto.shopSign = data.data.url;
+										this.save();
+									}
+								});
+							} else this.$showToast(result.msg)
+						})
 					},
 					fail: err => {
 						this.myToast('图片上传失败', 'none');
@@ -162,10 +166,15 @@
 				this.dto.areaDetail = this.list.areaDetail
 				this.dto.id = uni.getStorageSync('merchantId')
 				this.dto.id = uni.getStorageSync('merchantId')
-				this.$api.put('/api/merchant/food/updateMerchantInfo', this.dto).then(res => {
-					if (res.data.code == 0) {
-						this.$showToast('保存成功');
-					}
+				
+				this.$api.detectionContent(this.dto.name).then(result => {
+					if (result.code !== 0) return this.$showToast('店铺名称包含敏感违规信息');
+					
+					this.$api.put('/api/merchant/food/updateMerchantInfo', this.dto).then(res => {
+						if (res.data.code == 0) {
+							this.$showToast('保存成功');
+						}
+					})
 				})
 			}
 		}