shish 6 роки тому
батько
коміт
e6f47a2690

+ 1 - 1
app/business/controllers/PicController.php

@@ -29,7 +29,7 @@ class PicController extends BaseController
 	public function actionAdd()
 	{
 		$img = '/uploads/201905/25/jpg/19052591518_12358.jpg';
-		$prefix = Yii::$app->params['imgUrl'];
+		$prefix = Yii::$app->params['imgHost'];
 		$url = $prefix . $img;
 		$merchantId = $this->merchantId;
 		$time = time();

+ 3 - 3
app/business/views/chat/index.php

@@ -15,7 +15,7 @@
                 case 'init':
                     clientId = data.client_id;
                     //当前发起的聊天会员与当前登陆用户绑定关系
-                    $.post('<?= Yii::$app->params['b'] ?>/chat/bind-merchant', {clientId: clientId}, function (data) {
+                    $.post('<?= Yii::$app->params['bHost'] ?>/chat/bind-merchant', {clientId: clientId}, function (data) {
 
                     }, 'json');
                 default :
@@ -26,7 +26,7 @@
     function closeMsg()
     {
         console.log(clientId);
-        $.post('<?= Yii::$app->params['b'] ?>/chat/close', {clientId: clientId}, function (data) {
+        $.post('<?= Yii::$app->params['bHost'] ?>/chat/close', {clientId: clientId}, function (data) {
 
         }, 'json');
     }
@@ -58,7 +58,7 @@
                 break;
             default:
         }
-        $.post('<?= Yii::$app->params['b'] ?>/chat/send', data, function (data) {
+        $.post('<?= Yii::$app->params['bHost'] ?>/chat/send', data, function (data) {
         }, 'json');
     }
 

+ 1 - 1
app/business/views/main/index.php

@@ -13,7 +13,7 @@
                 case 'init':
                     clientId = data.client_id;
                     //当前发起的会话与平台绑定关系
-                    $.post('<?= Yii::$app->params['b'] ?>/chat/bind-console', {clientId: clientId}, function (data) {
+                    $.post('<?= Yii::$app->params['bHost'] ?>/chat/bind-console', {clientId: clientId}, function (data) {
                     }, 'json');
                 case 'newMessage':
                     if (data.status == 1) {

+ 4 - 0
app/saas/controllers/MerchantController.php

@@ -12,6 +12,8 @@ use common\services\xhMerchantService;
 class MerchantController extends BaseController
 {
 
+	public $withoutLogin = ['bind-open'];
+	
 	//商家列表 shish 2019.12.20
 	public function actionList()
 	{
@@ -49,6 +51,8 @@ class MerchantController extends BaseController
 		if (empty($merchant)) {
 			util::fail('没有找到商家');
 		}
+		wxUtil::miniCommit($merchant,1);die;
+		
 		$wxAppId = $merchant['wxAppId'];
 		$miniAppId = $merchant['miniAppId'];
 		$openAppId = $merchant['openAppId'];

+ 4 - 4
app/www/controllers/WxOpenController.php

@@ -37,15 +37,15 @@ class WxOpenController extends PublicController
 		$oData['preAuthCodeTime'] = date("Y-m-d H:i:s");
 		//设置预授码过期,让下个用户可以获取新的预授码
 		xhWxOpenService::updateById($id, $oData);
-		$url = Yii::$app->params['w'] . '/wx-open/callback';
+		$url = Yii::$app->params['wHost'] . '/wx-open/callback';
 		$merchantId = $open['merchantId'];
 		//如果平台没有对应的商家,先去创建第一个商家并做关联
 		if (empty($merchantId)) {
-			$url = Yii::$app->params['w'] . '/wx-open/callback-create-first-merchant';
+			$url = Yii::$app->params['wHost'] . '/wx-open/callback-create-first-merchant';
 		}
 		echo "<a href='https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid={$appId}&pre_auth_code={$pre}&redirect_uri={$url}'>授权</a>";
 	}
-	
+
 	public function actionCheckMerchantName()
 	{
 		$get = Yii::$app->request->get();
@@ -56,7 +56,7 @@ class WxOpenController extends PublicController
 		}
 		util::successInfo();
 	}
-	
+
 	/**
 	 * 下载微信里的图片到服务器
 	 */

+ 2 - 2
biz/ad/classes/AdClass.php

@@ -31,7 +31,7 @@ class AdClass extends BaseClass
 		$data = self::getList('*', $where, 'inTurn DESC');
 		$list = $data['list'];
 		if (!empty($list)) {
-			$imgUrl = Yii::$app->params['imgUrl'];
+			$imgUrl = Yii::$app->params['imgHost'];
 			foreach ($list as $key => $val) {
 				//图片提供完整地址给前端,同时原有addImg字段不占用,定义新字段adImgUrl
 				$list[$key]['adImgUrl'] = $imgUrl . $val['adImg'];
@@ -67,7 +67,7 @@ class AdClass extends BaseClass
 	//组装通用的信息
 	public static function groupBaseInfo($list)
 	{
-		$imgUrl = Yii::$app->params['imgUrl'];
+		$imgUrl = Yii::$app->params['imgHost'];
 		foreach ($list as $key => $val) {
 			$style = $val['style'];
 			$url = $val['url'];

+ 1 - 1
biz/admin/classes/AdminClass.php

@@ -28,7 +28,7 @@ class AdminClass extends BaseClass
 		
 		$userInfo = UserClass::getByIds($userIdList, null, 'id');
 		$roleInfo = AdminRoleClass::getByIds($roleIdList, null, 'id');
-		$prefix = Yii::$app->params['imgUrl'];
+		$prefix = Yii::$app->params['imgHost'];
 		foreach ($list as $key => $val) {
 			$roleId = $val['roleId'];
 			$userId = $val['userId'];

+ 2 - 2
biz/goods/services/CategoryService.php

@@ -21,7 +21,7 @@ class CategoryService extends BaseService
 			return [];
 		}
 		//处理图片
-		$prefix = Yii::$app->params['imgUrl'];
+		$prefix = Yii::$app->params['imgHost'];
 		foreach ($cat as $key => $info) {
 			$cat[$key]['img'] = $prefix . $info['img'];
 		}
@@ -36,7 +36,7 @@ class CategoryService extends BaseService
 			return [];
 		}
 		//处理图片
-		$prefix = Yii::$app->params['imgUrl'];
+		$prefix = Yii::$app->params['imgHost'];
 		foreach ($cat as $key => $info) {
 			$cat[$key]['img'] = $prefix . $info['img'];
 		}

+ 1 - 1
biz/merchant/services/AdminService.php

@@ -42,7 +42,7 @@ class AdminService extends BaseService
 		if (empty($admin)) {
 			return $admin;
 		}
-		$imgPrefix = Yii::$app->params['imgUrl'];
+		$imgPrefix = Yii::$app->params['imgHost'];
 		foreach ($admin as $key => $val) {
 			$val = business::formatUserAvatar($val);
 			$admin[$key] = $val;

+ 1 - 1
biz/promote/services/GuaGuaWinService.php

@@ -79,7 +79,7 @@ class GuaGuaWinService extends BaseService
 				$prizeId = $val['prizeId'];
 				$userInfo = isset($userInfoList[$userId]) ? $userInfoList[$userId] : [];
 				$userName = isset($userInfo['userName']) ? stringUtil::replaceXH($userInfo['userName']) : '';
-				$avatar = isset($userInfo['avatar']) && !empty($userInfo['avatar']) ? Yii::$app->params['imgUrl'] . $userInfo['avatar'] : Yii::$app->params['imgUrl'] . '/unknowavatar.png';
+				$avatar = isset($userInfo['avatar']) && !empty($userInfo['avatar']) ? Yii::$app->params['imgHost'] . $userInfo['avatar'] : Yii::$app->params['imgHost'] . '/unknowavatar.png';
 				$avatar = 'http://img.huaml.com/weixinUserAvatar/2019/08/10/190810092812358125366301679.jpg';
 				$prizeName = isset($prizeList[$prizeId]['prizeName']) ? $prizeList[$prizeId]['prizeName'] : '';
 				$getTime = date("m-d H:i", $val['getTime']);

+ 9 - 9
common/components/business.php

@@ -56,7 +56,7 @@ class business
 		}
 		$imgList = [];
 		$smallImgList = [];
-		$prefixImgUrl = Yii::$app->params['imgUrl'];
+		$prefixImgUrl = Yii::$app->params['imgHost'];
 		$imageRoot = dirUtil::getImgUploadDir();
 		foreach ($arr as $imgUrl) {
 			$smallImg = self::getSmallImg($imgUrl);
@@ -92,7 +92,7 @@ class business
 		if (empty($imgUrl)) {
 			$info['img'] = '';
 		}
-		$prefixImgUrl = Yii::$app->params['imgUrl'];
+		$prefixImgUrl = Yii::$app->params['imgHost'];
 		$smallImg = self::getSmallImg($imgUrl);
 		$small = $prefixImgUrl . $smallImg;
 		$info['img'] = $small;
@@ -106,7 +106,7 @@ class business
 		if (empty($imgUrl)) {
 			$info['imgUrl'] = '';
 		}
-		$prefixImgUrl = Yii::$app->params['imgUrl'];
+		$prefixImgUrl = Yii::$app->params['imgHost'];
 		$smallImg = self::getSmallImg($imgUrl);
 		$small = $prefixImgUrl . $smallImg;
 		$info['imgUrl'] = $small;
@@ -120,7 +120,7 @@ class business
 		if (empty($imgUrl)) {
 			$info['imgUrl'] = '';
 		}
-		$prefixImgUrl = Yii::$app->params['imgUrl'];
+		$prefixImgUrl = Yii::$app->params['imgHost'];
 		$smallImg = self::getSmallImg($imgUrl);
 		$small = $prefixImgUrl . $smallImg;
 		$info['imgUrl'] = $small;
@@ -136,7 +136,7 @@ class business
 			$info['smallAvatarUrl'] = '';
 			return $info;
 		}
-		$prefixImgUrl = Yii::$app->params['imgUrl'];
+		$prefixImgUrl = Yii::$app->params['imgHost'];
 		$smallImg = self::getSmallImg($imgUrl);
 		$small = $prefixImgUrl . $smallImg;
 		$info['smallAvatarUrl'] = $small;
@@ -153,7 +153,7 @@ class business
 			$info['smallCoverUrl'] = '';
 			return $info;
 		}
-		$prefixImgUrl = Yii::$app->params['imgUrl'];
+		$prefixImgUrl = Yii::$app->params['imgHost'];
 		$smallImg = self::getSmallImg($imgUrl);
 		$small = $prefixImgUrl . $smallImg;
 		$info['smallCoverUrl'] = $small;
@@ -170,7 +170,7 @@ class business
 			$info['smallLogoUrl'] = '';
 			return $info;
 		}
-		$prefixImgUrl = Yii::$app->params['imgUrl'];
+		$prefixImgUrl = Yii::$app->params['imgHost'];
 		$smallImg = self::getSmallImg($imgUrl);
 		$small = $prefixImgUrl . $smallImg;
 		$info['smallLogoUrl'] = $small;
@@ -181,7 +181,7 @@ class business
 	//上传的图片进行转换 shish 2019.12.28
 	public static function formatUploadImg($imgUrl)
 	{
-		$prefix = Yii::$app->params['imgUrl'];
+		$prefix = Yii::$app->params['imgHost'];
 		$small = self::getSmallImg($imgUrl);
 		$url = $prefix . $imgUrl;
 		$smallUrl = $prefix . $small;
@@ -208,7 +208,7 @@ class business
 			$info['smallAvatarUrl'] = '';
 			return $info;
 		}
-		$prefixImgUrl = Yii::$app->params['imgUrl'];
+		$prefixImgUrl = Yii::$app->params['imgHost'];
 		$smallImg = self::getSmallImg($imgUrl);
 		$small = $prefixImgUrl . $smallImg;
 		$info['smallAvatarUrl'] = $small;

+ 7 - 13
common/components/wxUtil.php

@@ -1266,30 +1266,26 @@ class wxUtil
 		$accessToken = self::getMiniProgramAccessToken($merchant);
 		$url = 'https://api.weixin.qq.com/wxa/commit?access_token=' . $accessToken;
 		$curl = new curl\Curl();
-
+		$mUrl = Yii::$app->params['mHost'];
+		$imgUrl = Yii::$app->params['imgHost'];
 		$ext = [
 			'extAppid' => $merchant['miniAppId'],
 			'ext' => [
 				'account' => $merchant['id'],
-				'host' => Yii::$app->params['miniUrl'],
-				'miniUrl' => Yii::$app->params['miniUrl'],
-				'imgUrl' => Yii::$app->params['imgUrl'],
-				'test' => Yii::$app->params['imgUrl'],
+				'host' => $mUrl,
+				'mUrl' => $mUrl,
+				'imgUrl' => $imgUrl,
 				'merchantName' => $merchant['merchantName'],
 			],
 		];
-		
 		Yii::info("ext:" . json_encode($ext));
-		
 		$extJson = json_encode($ext);
-		
 		$data = [
 			"template_id" => $templateId,
 			"ext_json" => $extJson,
 			"user_version" => date("mdHis"),
 			"user_desc" => date("mdHis")
 		];
-		
 		$result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
 		$respond = Json::decode($result);
 		print_r($respond);
@@ -1303,11 +1299,9 @@ class wxUtil
 		$url = "https://api.weixin.qq.com/wxa/get_qrcode?access_token={$accessToken}&path=" . $path;
 		$curl = new curl\Curl();
 		$result = $curl->get($url);
-		
 		$file = util::getRootDir() . '/resource/images/miniExperience/' . $merchant['id'] . '.jpg';
-		
 		file_put_contents($file, $result);
-		echo "<img src='" . Yii::$app->params['imgUrl'] . "/miniExperience/" . $merchant['id'] . ".jpg' />";
+		echo "<img src='" . Yii::$app->params['imgHost'] . "/miniExperience/" . $merchant['id'] . ".jpg' />";
 	}
 	
 	//获取授权小程序帐号已设置的类目
@@ -1412,7 +1406,7 @@ class wxUtil
 		$result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
 		$file = util::getRootDir() . '/resource/images/miniExperience/' . $merchant['id'] . '_member.jpg';
 		file_put_contents($file, $result);
-		echo "<img src='" . Yii::$app->params['imgUrl'] . "/miniExperience/" . $merchant['id'] . "_member.jpg' />";
+		echo "<img src='" . Yii::$app->params['imgHost'] . "/miniExperience/" . $merchant['id'] . "_member.jpg' />";
 	}
 	
 	/**

+ 24 - 24
common/config/params.php

@@ -55,47 +55,47 @@ if (strpos($referrer, 'https') === true) {
 }
 
 if (getenv('YII_ENV') == 'local') {
-	$config['c'] = $prefixHttp . 'api.m.hhb.com';
-	$config['b'] = $prefixHttp . 'api.b.hhb.com';
+	$config['mHost'] = $prefixHttp . 'api.m.hhb.com';
+	$config['bHost'] = $prefixHttp . 'api.b.hhb.com';
 	if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
-		$config['b'] = $prefixHttp . 'api.h.hhb.com';
+		$config['bHost'] = $prefixHttp . 'api.h.hhb.com';
 	}
-	$config['s'] = $prefixHttp . 'api.s.hhb.com';
-	$config['w'] = $prefixHttp . 'api.w.hhb.com';
+	$config['sHost'] = $prefixHttp . 'api.s.hhb.com';
+	$config['wHost'] = $prefixHttp . 'api.w.hhb.com';
 	$config['host'] = 'hhb.com';
-	$config['imgUrl'] = $prefixHttp . 'img.hhb.com';
+	$config['imgHost'] = $prefixHttp . 'img.hhb.com';
 }
 if (getenv('YII_ENV') == 'test') {
-	$config['c'] = $prefixHttp . 'api.m.hzghd.com';
-	$config['b'] = $prefixHttp . 'api.b.hzghd.com';
+	$config['mHost'] = $prefixHttp . 'api.m.hzghd.com';
+	$config['bHost'] = $prefixHttp . 'api.b.hzghd.com';
 	if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
-		$config['b'] = $prefixHttp . 'api.h.hzghd.com';
+		$config['bHost'] = $prefixHttp . 'api.h.hzghd.com';
 	}
-	$config['s'] = $prefixHttp . 'api.s.hzghd.com';
-	$config['w'] = $prefixHttp . 'api.w.hzghd.com';
+	$config['sHost'] = $prefixHttp . 'api.s.hzghd.com';
+	$config['wHost'] = $prefixHttp . 'api.w.hzghd.com';
 	$config['host'] = 'hzghd.com';
-	$config['imgUrl'] = $prefixHttp . 'img.hzghd.com';
+	$config['imgHost'] = $prefixHttp . 'img.hzghd.com';
 }
 if (getenv('YII_ENV') == 'dev') {
-	$config['c'] = $prefixHttp . 'api.m.huaml.com';
-	$config['b'] = $prefixHttp . 'api.b.huaml.com';
+	$config['mHost'] = $prefixHttp . 'api.m.huaml.com';
+	$config['bHost'] = $prefixHttp . 'api.b.huaml.com';
 	if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
-		$config['b'] = $prefixHttp . 'api.h.huaml.com';
+		$config['bHost'] = $prefixHttp . 'api.h.huaml.com';
 	}
-	$config['s'] = $prefixHttp . 'api.s.huaml.com';
-	$config['w'] = $prefixHttp . 'api.w.huaml.com';
+	$config['sHost'] = $prefixHttp . 'api.s.huaml.com';
+	$config['wHost'] = $prefixHttp . 'api.w.huaml.com';
 	$config['host'] = 'huaml.com';
-	$config['imgUrl'] = $prefixHttp . 'img.huaml.com';
+	$config['imgHost'] = $prefixHttp . 'img.huaml.com';
 }
 if (getenv('YII_ENV') == 'production') {
-	$config['c'] = $prefixHttp . 'api.m.huahb.com';
-	$config['b'] = $prefixHttp . 'api.b.huahb.com';
+	$config['mHost'] = $prefixHttp . 'api.m.huahb.com';
+	$config['bHost'] = $prefixHttp . 'api.b.huahb.com';
 	if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
-		$config['b'] = $prefixHttp . 'api.h.huahb.com';
+		$config['bHost'] = $prefixHttp . 'api.h.huahb.com';
 	}
-	$config['s'] = $prefixHttp . 'api.s.huahb.com';
-	$config['w'] = $prefixHttp . 'api.w.huahb.com';
+	$config['sHost'] = $prefixHttp . 'api.s.huahb.com';
+	$config['wHost'] = $prefixHttp . 'api.w.huahb.com';
 	$config['host'] = 'huahb.com';
-	$config['imgUrl'] = $prefixHttp . 'img.huahb.com';
+	$config['imgHost'] = $prefixHttp . 'img.huahb.com';
 }
 return $config;