shish 6 жил өмнө
parent
commit
09709ed8ef

+ 20 - 0
app/saas/controllers/UserController.php

@@ -7,6 +7,8 @@ use biz\merchant\services\MerchantAssetService;
 use biz\merchant\services\ShopService;
 use biz\retail\services\RetailAssetService;
 use biz\user\services\UserService;
+use common\components\httpUtil;
+use common\components\qrCodeUtil;
 use common\components\util;
 use Yii;
 
@@ -72,4 +74,22 @@ class UserController extends BaseController
 		echo "<img width='300' src='{$url}' />";
 	}
 	
+	//收款码查看 shish 2020.2.20
+	public function actionGatheringCode()
+	{
+		$id = Yii::$app->request->get('id');
+		$shop = ShopService::getById($id);
+		$merchantId = isset($shop['merchantId']) ? $shop['merchantId'] : 0;
+		if (empty($merchantId)) {
+			util::fail('没有找到商家');
+		}
+		$url = Yii::$app->params['mDomain'] . "/#/pages/pay/index?account={$merchantId}&shopId=" . $id;
+		//强制转成https
+		$url = httpUtil::becomeHttps($url);
+
+		$logo = !empty($this->merchant['logo']) ? $webRoot . $this->merchant['logo'] : '';
+		$gatheringQrcodeUrl = qrCodeUtil::generate($url, $unique, $logo, 10);
+
+	}
+
 }

+ 1 - 1
biz/merchant/classes/MerchantExtendClass.php

@@ -30,5 +30,5 @@ class MerchantExtendClass extends BaseClass
 		}
 		return Yii::$app->params['imgHost'] . $imgUrl;
 	}
-	
+
 }

+ 12 - 2
common/components/httpUtil.php

@@ -104,7 +104,7 @@ class httpUtil
 		}
 		return false;
 	}
-
+	
 	//判断小程序 shish 2019.12.13
 	public static function isMiniProgram()
 	{
@@ -120,11 +120,21 @@ class httpUtil
 		}
 		return false;
 	}
-
+	
 	//获取ip shish 2019.12.18
 	public static function ip()
 	{
 		return Yii::$app->request->userIP;
 	}
 	
+	//变成https shish 2020.2.20
+	public static function becomeHttps($url)
+	{
+		$has = strpos($url, 'https');
+		if ($has !== false) {
+			return $url;
+		}
+		return str_replace('http', 'https', $url);
+	}
+	
 }