|
|
@@ -676,12 +676,7 @@ class CustomController extends BaseController
|
|
|
foreach ($arr as $item) {
|
|
|
$name = $item['name'] ?? '';
|
|
|
$mobile = $item['mobile'] ?? '';
|
|
|
-
|
|
|
- //队列方式去处理
|
|
|
-// $customerCachedKey = 'batch_create_customer_list';
|
|
|
-// $value = $name . '_' . $mobile . '_' . $this->sjId . '_' . $this->shop->id . '_' . $this->sj->name . '_' . $this->shopAdminId;
|
|
|
-// Yii::$app->redis->executeCommand('LPUSH', [$customerCachedKey, $value]);
|
|
|
-
|
|
|
+ //使用消息队列处理
|
|
|
try {
|
|
|
$producer = Yii::$app->rabbitmq->getProducer('customProducer');
|
|
|
$msg = serialize(['type' => 'add_custom', 'name' => $name, 'mobile' => $mobile, 'sjId' => $this->sjId,
|
|
|
@@ -692,7 +687,6 @@ class CustomController extends BaseController
|
|
|
$remind = "供货商创建新客户,生产消息报错 {$name} {$mobile} {$this->sj->name} {$msg}";
|
|
|
noticeUtil::push($remind, '15280215347');
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
util::complete('已提交,15秒后生效');
|
|
|
}
|
|
|
@@ -724,10 +718,19 @@ class CustomController extends BaseController
|
|
|
if ($toSjId != $fromSjId) {
|
|
|
util::fail('不是您的门店');
|
|
|
}
|
|
|
- $cachedKey = 'copy_other_shop_customers';
|
|
|
- Yii::$app->redis->executeCommand('LPUSH', [$cachedKey, $toShopId . '_' . $fromShopId]);
|
|
|
- Yii::info("从其他门店同步客户:目标门店id = " . $toShopId . ' 来源门店id = ' . $fromShopId);
|
|
|
- util::complete('已提交,1分钟后生效');
|
|
|
+
|
|
|
+ //使用消息队列处理 ssh 20251204
|
|
|
+ try {
|
|
|
+ $producer = Yii::$app->rabbitmq->getProducer('customProducer');
|
|
|
+ $msg = serialize(['type' => 'pull_custom_from_other_shop', 'toShopId' => $toShopId, 'fromShopId' => $fromShopId]);
|
|
|
+ $producer->publish($msg, 'customExchange', 'customRoute');
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ $msg = $e->getMessage();
|
|
|
+ $remind = "供货商拉取其他门店客户,生产消息报错 {$toShopId} {$fromShopId} {$msg}";
|
|
|
+ noticeUtil::push($remind, '15280215347');
|
|
|
+ }
|
|
|
+
|
|
|
+ util::complete('已拉取');
|
|
|
}
|
|
|
|
|
|
//客户列表 ssh 2021.7.8
|