Procházet zdrojové kódy

小程序头 account

shish před 6 roky
rodič
revize
77461d481e
1 změnil soubory, kde provedl 21 přidání a 8 odebrání
  1. 21 8
      app/client/controllers/PublicController.php

+ 21 - 8
app/client/controllers/PublicController.php

@@ -1,19 +1,32 @@
 <?php
+
 namespace client\controllers;
+
+use biz\merchant\services\MerchantService;
 use common\components\baseController;
+use common\components\httpUtil;
 
 /**
  * 前台公共类
  */
-class PublicController extends baseController{
-
-	public $webTitle				= '花卉宝';
-	public $webDescription			= '花卉宝';
-	public $webKeyword				= '花卉宝';
+class PublicController extends baseController
+{
+	
+	public $webTitle = '花卉宝';
+	public $webDescription = '花卉宝';
+	public $webKeyword = '花卉宝';
 	public $version;//公共静态文件版本号
-
-	public function beforeAction($action){
-		$this->version				= '1.0.0';
+	public $merchant, $merchantId;
+	
+	public function beforeAction($action)
+	{
+		$this->version = '1.0.0';
+		$header = httpUtil::getHeader();
+		$account = isset($header['account']) ? $header['account'] : 0;
+		if (!empty($account)) {
+			$this->merchantId = $account;
+			$merchant = MerchantService::getMerchantById($account);
+		}
 		return parent::beforeAction($action);
 	}
 }