shish 5 лет назад
Родитель
Сommit
8012413d41
2 измененных файлов с 11 добавлено и 13 удалено
  1. 10 10
      app/ghs/controllers/UploadController.php
  2. 1 3
      biz-ghs/custom/services/CustomService.php

+ 10 - 10
app/ghs/controllers/UploadController.php

@@ -28,7 +28,7 @@ class UploadController extends BaseController
 		if (!empty($categoryIds)) {
 			$categoryList = CategoryService::getByIds($categoryIds);
 			foreach ($categoryList as $cat) {
-				if ($cat['merchantId'] != $this->merchantId) {
+				if ($cat['ghsId'] != $this->ghsId) {
 					util::fail('请选择自己的分类');
 				}
 			}
@@ -37,10 +37,10 @@ class UploadController extends BaseController
 		//匹配出图片的格式
 		if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_image_content, $result)) {
 			$type = $result[2];
-			$merchantId = $this->merchantId;
+			$ghsId = $this->ghsId;
 			$month = date("Ym");
 			$date = date("d");
-			$path = dirUtil::getImgUploadDir() . "/{$merchantId}/{$month}/{$date}/";
+			$path = dirUtil::getImgUploadDir() . "/{$ghsId}/{$month}/{$date}/";
 			if (!file_exists($path)) {
 				//检查是否有该文件夹,如果没有就创建,并给予最高权限
 				mkdir($path, 0700, true);
@@ -51,7 +51,7 @@ class UploadController extends BaseController
 			if (file_put_contents($fullPathFile, base64_decode(str_replace($result[1], '', $base64_image_content))) == false) {
 				util::fail('上传失败!!');
 			}
-			$img = "/uploads/{$merchantId}/{$month}/{$date}/" . $newFile;
+			$img = "/uploads/{$ghsId}/{$month}/{$date}/" . $newFile;
 			$imgInfo = getimagesize($fullPathFile);
 			$width = $imgInfo[0];
 			$height = $imgInfo[1];
@@ -66,7 +66,7 @@ class UploadController extends BaseController
 				Image::thumbnail($fullPathFile, $newWidth, $newHeight)->save($newFullPathFile, ['quality' => 100]);
 				$width = $newWidth;
 				$height = $newHeight;
-				$img = "/uploads/{$merchantId}/{$month}/{$date}/" . $newFile;
+				$img = "/uploads/{$ghsId}/{$month}/{$date}/" . $newFile;
 				unlink($fullPathFile);
 				$fullPathFile = $newFullPathFile;
 			}
@@ -81,12 +81,12 @@ class UploadController extends BaseController
 
 			if (!empty($categoryIds)) {
 				$time = time();
-				$data = ['img' => $img, 'merchantId' => $merchantId, 'name' => '未命名', 'addTime' => $time];
+				$data = ['img' => $img, 'ghsId' => $ghsId, 'name' => '未命名', 'addTime' => $time];
 				$pic = PicService::add($data);
 				$currentId = $pic['id'];
 				$add = [];
 				foreach ($categoryIds as $cat) {
-					$add[] = ['categoryId' => $cat, 'picId' => $currentId, 'merchantId' => $this->merchantId];
+					$add[] = ['categoryId' => $cat, 'picId' => $currentId, 'ghsId' => $this->ghsId];
 				}
 				PicCategoryService::batchAdd($add);
 			}
@@ -105,10 +105,10 @@ class UploadController extends BaseController
 		//匹配出图片的格式
 		if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_image_content, $result)) {
 			$type = $result[2];
-			$merchantId = 12358;
+			$ghsId = 12358;
 			$month = date("Ym");
 			$date = date("d");
-			$path = dirUtil::getImgUploadDir() . "/{$merchantId}/{$month}/{$date}/";
+			$path = dirUtil::getImgUploadDir() . "/{$ghsId}/{$month}/{$date}/";
 			if (!file_exists($path)) {
 				//检查是否有该文件夹,如果没有就创建,并给予最高权限
 				mkdir($path, 0700, true);
@@ -119,7 +119,7 @@ class UploadController extends BaseController
 			if (file_put_contents($fullPath, base64_decode(str_replace($result[1], '', $base64_image_content))) == false) {
 				util::fail('上传失败');
 			}
-			$img = "/uploads/{$merchantId}/{$month}/{$date}/" . $newFile;
+			$img = "/uploads/{$ghsId}/{$month}/{$date}/" . $newFile;
 			$data = business::formatUploadImg($img);
 			$data['shortUrl'] = $img;
 			util::success($data);

+ 1 - 3
biz-ghs/custom/services/CustomService.php

@@ -25,7 +25,7 @@ class CustomService extends BaseService
 		$data['allNum'] = 80;
 		return $data;
 	}
-	
+
 	//获取客户信息 shish 2021.1.8
 	public static function getFullInfo($ghsId, $shopId)
 	{
@@ -36,10 +36,8 @@ class CustomService extends BaseService
 		$list = CustomClass::groupBaseInfo([$custom]);
 		$custom = current($list);
 		$custom['no'] = 1254358;
-		
 		$shopInfo = ShopClass::getAddressAndManager($shopId);
 		$custom['shopInfo'] = $shopInfo;
-		
 		return $custom;
 	}