shish преди 6 години
родител
ревизия
a36237bd61

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

@@ -180,12 +180,12 @@ class WxOpenController extends PublicController
 			if (isset($open['merchantId']) && !empty($open['merchantId'])) {
 				xhWxOpenService::updateById($wxOpenId, ['merchantId' => $merchantId]);
 			}
-			
+
 			$data = ['merchantId' => $merchantId, 'platform' => 1];
 			$producer = Yii::$app->rabbitmq->getProducer('openShopInitProducer');
 			$msg = serialize($data);
 			$producer->publish($msg, 'openShopInitExchange', 'openShopInitRoute');
-			
+
 		} else {
 			
 			$cData = [];
@@ -408,9 +408,8 @@ class WxOpenController extends PublicController
 				$merchant = xhMerchantService::getByAppId($authorizeAppid);
 				if (!empty($merchant)) {
 					$merchantId = $merchant['id'];
-					xhMerchantService::updateById($merchantId, ['status' => 5]);//自主冻结
-					//删除模板消息
-					xhTMessageService::delTMessage($merchant);
+					//自主冻结
+					xhMerchantService::updateById($merchantId, ['status' => 5]);
 				}
 				break;
 			//授权成功通知

+ 10 - 7
biz/merchant/services/MerchantService.php

@@ -139,7 +139,7 @@ class MerchantService extends BaseService
 	{
 		return MerchantClass::getCurrentSetId($id);
 	}
-
+	
 	//开店公众号授权之后初始化 shish 2020.2.7
 	public static function openShopInit($data)
 	{
@@ -147,7 +147,7 @@ class MerchantService extends BaseService
 		$platform = $data['platform'];
 		$merchant = MerchantClass::getMerchantById($merchantId);
 		if (empty($merchant)) {
-		
+			return false;
 		}
 		$time = time();
 		$date = date("Y-m-d H:i:s");
@@ -180,7 +180,7 @@ class MerchantService extends BaseService
 				$roleReturn = AdminRoleClass::addAdminRole(['roleName' => '老板', 'merchantId' => $merchantId, 'auth' => '*']);
 				$roleId = $roleReturn['id'];
 			}
-
+			
 			if ($platform == 1) {
 				//平台使用的公众号创建指定管理员
 				$admin = AdminClass::getByCondition(['merchantId' => $merchantId, 'mobile' => 15280215347]);
@@ -200,15 +200,18 @@ class MerchantService extends BaseService
 					AdminClass::addAdmin($adminData);
 				}
 			}
-
+			
 			//模板消息
 			xhTMessageService::init($merchant);
-
+			
 			$transaction->commit();
-
+			return true;
+			
 		} catch (Exception $e) {
 			$transaction->rollBack();
+			return false;
 		}
+
 	}
-	
+
 }

+ 4 - 4
common/components/rabbitmq/consumer/openShopInitConsumer.php

@@ -22,12 +22,12 @@ class openShopInitConsumer implements ConsumerInterface
 		$data = unserialize($msg->body);
 		$merchantId = isset($data['merchantId']) ? $data['merchantId'] : 0;
 		$platform = isset($data['platform']) ? $data['platform'] : 0;
-		$return = MerchantService::setUpInit(['merchantId'=>$merchantId,'platform'=>$platform]);
-		if (empty($merchantId)) {
-			return ConsumerInterface::MSG_ACK;
+		$return = MerchantService::openShopInit(['merchantId' => $merchantId, 'platform' => $platform]);
+		if ($return == false) {
+			//短信通知管理员
 		}
 		return ConsumerInterface::MSG_ACK;
-		return ConsumerInterface::MSG_REQUEUE;
+		//return ConsumerInterface::MSG_REQUEUE;
 	}
 
 }