shish 6 лет назад
Родитель
Сommit
f2d28b587e
1 измененных файлов с 18 добавлено и 0 удалено
  1. 18 0
      biz/merchant/classes/ShopClass.php

+ 18 - 0
biz/merchant/classes/ShopClass.php

@@ -104,6 +104,7 @@ class ShopClass extends BaseClass
 			$img = wxUtil::generateMemberCode($merchant, $path);
 			self::updateById($id, ['applyMemberCode' => $img]);
 		}
+		
 	}
 	
 	//商家所有门店生成注册会员码 shish 2020.3.9
@@ -124,4 +125,21 @@ class ShopClass extends BaseClass
 		MerchantInitClass::updateByMerchantId($merchantId, ['memberCodeInit' => 1]);
 	}
 	
+	//生成收款码 shish 2020.3.9
+	public static function generateGatheringCode($id)
+	{
+		$shop = ShopService::getById($id);
+		$merchantId = isset($shop['merchantId']) ? $shop['merchantId'] : 0;
+		$gatheringCode = isset($shop['gatheringCode']) ? $shop['gatheringCode'] : '';
+		$file = dirUtil::getImgDir() . $gatheringCode;
+		$url = Yii::$app->params['mDomain'] . "/#/pages/pay/index?account={$merchantId}&shopId=" . $id;
+		//强制转成https
+		$url = httpUtil::becomeHttps($url);
+		if (empty($gatheringCode) || file_exists($file) == false) {
+			$gatheringCode = qrCodeUtil::generateGatheringQrCode($url, $merchantId, $id, '', 10);
+			ShopService::updateById($id, ['gatheringCode' => $gatheringCode]);
+		}
+		return true;
+	}
+
 }