diff --git a/app/process/InquiryAutoProcess.php b/app/process/InquiryAutoProcess.php index 3b8eec1..54b9e0a 100644 --- a/app/process/InquiryAutoProcess.php +++ b/app/process/InquiryAutoProcess.php @@ -2,6 +2,8 @@ namespace app\process; +use app\common\model\UserGroup; +use app\common\model\UserGroupMembers; use app\inquiry\service\FbFileImportService; use app\inquiry\service\FbLeadSyncService; use app\inquiry\service\InquiryAssignService; @@ -55,11 +57,18 @@ class InquiryAutoProcess protected function runForChannel(string $channelKey, array $cfg) { $watchDir = public_path($cfg['watch_dir'] ?? 'excel'); - $enterUserId = (int)($cfg['enter_user_id'] ?? 0); + // $enterUserId = (int)($cfg['enter_user_id'] ?? 0); $channelId = (int)($cfg['channel_id'] ?? 0); - $salesUserIds = $cfg['sales_user_ids'] ?? []; + // $salesUserIds = $cfg['sales_user_ids'] ?? []; $roundRobinKey = $cfg['round_robin_key'] ?? $channelKey; + // 查分组 + $group = UserGroup::where('scenario_code', $cfg['group_key'])->where('status', 1)->first(); + // 查组长 + $enterUserId = UserGroupMembers::where('group_id', $group->id)->where('is_leader', 1)->where('status', 1)->value('user_id'); + // 查分组成员 + $salesUserIds = UserGroupMembers::where('group_id', $group->id)->where('is_leader', 0)->where('status', 1)->pluck('user_id')->toArray(); + if ($enterUserId <= 0 || $channelId <= 0) { Log::error("InquiryAutoProcess: 渠道 {$channelKey} 配置缺少正确的 enter_user_id 或 channel_id,已跳过"); return; diff --git a/config/inquiry_channel.php b/config/inquiry_channel.php index dff4ac0..84aa1fc 100644 --- a/config/inquiry_channel.php +++ b/config/inquiry_channel.php @@ -12,19 +12,7 @@ return [ // 参与轮询分配的业务员 ID 列表 'sales_user_ids' => [ - 63, - 67, - 93, - 108, - 132, - 143, - 145, - 157, - 160, - 168, - 172, - 191, - 194 + 63, 67, 93, 108, 132, 143, 145, 157, 160, 168, 172, 191, 194 ], // 轮询用的分组 key(Redis 记指针用) @@ -39,6 +27,8 @@ return [ 'round_robin_key' => 'fb_paika_shemei_gh', ] ], + + 'group_key' => 'paika_inquiry' ], // 合塑社媒 @@ -59,5 +49,7 @@ return [ 'round_robin_key' => 'fb_hesu_shemei_gh', ] ], - ], + + 'group_key' => 'hesu_inquiry' + ] ];