Kaynağa Gözat

开放平台与绑定关系

shish 6 yıl önce
ebeveyn
işleme
c1f87da587

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

@@ -67,12 +67,14 @@ class MerchantController extends BaseController
 			if ($return['errcode'] == 0) {
 				$openAppId = $return['open_appid'];
 				xhMerchantService::updateById($merchantId, ['openAppId' => $openAppId]);
+				MerchantExtendService::updateByCondition(['merchantId' => $merchantId], ['openAppId' => $openAppId,'openAppBind'=>1,'wxAuth'=>1]);
 			}
 		}
 		//将小程序绑定到平台
 		if ($id == 2) {
 			$openAppId = $merchant['openAppId'];
 			$r = wxUtil::bindOpenAccount($miniAppId, $openAppId, $merchant, true);
+			MerchantExtendService::updateByCondition(['merchantId' => $merchantId], ['openAppBind'=>3,'miniAuth'=>1]);
 			print_r($r);
 		}
 		//查询公众号 小程序的绑定情况

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

@@ -1,6 +1,7 @@
 <?php
 namespace saas\controllers;
 
+use biz\merchant\services\MerchantExtendService;
 use biz\merchant\services\MerchantService;
 use common\components\util;
 use Yii;
@@ -33,12 +34,14 @@ class WxOpenController extends BaseController
 			if ($return['errcode'] == 0) {
 				$openAppId = $return['open_appid'];
 				MerchantService::updateById($merchantId, ['openAppId' => $openAppId]);
+				MerchantExtendService::updateByCondition(['merchantId'=>$merchantId],['openAppId'=>$openAppId,'openAppBind'=>1,'wxAuth'=>1]);
 			}
 		}
 		//将小程序绑定到平台
 		if ($id == 2) {
 			$openAppId = $merchant['openAppId'];
 			$r = wxUtil::bindOpenAccount($miniAppId, $openAppId, $merchant, true);
+			MerchantExtendService::updateByCondition(['merchantId'=>$merchantId],['openAppBind'=>3]);
 			print_r($r);
 		}
 		//查询公众号 小程序的绑定情况
@@ -139,6 +142,7 @@ class WxOpenController extends BaseController
 		echo "<br />open_appid:" . $open_appid . "<br />";
 		if (!empty($open_appid)) {
 			xhMerchantService::updateById($merchantId, ['openAppId' => $open_appid]);
+			MerchantExtendService::updateByCondition(['merchantId'=>$merchantId],['openAppId'=>$open_appid,'openAppBind'=>3,'miniAuth'=>1]);
 			$r = wxUtil::bindOpenAccount($miniAppId, $open_appid, $merchant);
 			echo "绑定小程序结果:<br />";
 			print_r($r);