工作台及场景获客字段同步
This commit is contained in:
@@ -58,8 +58,8 @@ class ContentLibraryController extends Controller
|
||||
$data = [
|
||||
'name' => $param['name'],
|
||||
// 数据来源配置
|
||||
'sourceFriends' => $sourceType == 1 ? json_encode($param['friends']) : json_encode([]), // 选择的微信好友
|
||||
'sourceGroups' => $sourceType == 2 ? json_encode($param['groups']) : json_encode([]), // 选择的微信群
|
||||
'sourceFriends' => $sourceType == 1 ? json_encode($param['friendsGroups']) : json_encode([]), // 选择的微信好友
|
||||
'sourceGroups' => $sourceType == 2 ? json_encode($param['wechatGroups']) : json_encode([]), // 选择的微信群
|
||||
'groupMembers' => $sourceType == 2 ? json_encode($param['groupMembers']) : json_encode([]), // 群组成员
|
||||
// 关键词配置
|
||||
'keywordInclude' => $keywordInclude, // 包含的关键词
|
||||
@@ -220,11 +220,12 @@ class ContentLibraryController extends Controller
|
||||
}
|
||||
|
||||
// 处理JSON字段转数组
|
||||
$library['sourceFriends'] = json_decode($library['sourceFriends'] ?: '[]', true);
|
||||
$library['sourceGroups'] = json_decode($library['sourceGroups'] ?: '[]', true);
|
||||
$library['friendsGroups'] = json_decode($library['sourceFriends'] ?: '[]', true);
|
||||
$library['wechatGroups'] = json_decode($library['sourceGroups'] ?: '[]', true);
|
||||
$library['keywordInclude'] = json_decode($library['keywordInclude'] ?: '[]', true);
|
||||
$library['keywordExclude'] = json_decode($library['keywordExclude'] ?: '[]', true);
|
||||
$library['groupMembers'] = json_decode($library['groupMembers'] ?: '[]', true);
|
||||
unset($library['sourceFriends'],$library['sourceGroups']);
|
||||
|
||||
// 将时间戳转换为日期格式(精确到日)
|
||||
if (!empty($library['timeStart'])) {
|
||||
@@ -235,8 +236,8 @@ class ContentLibraryController extends Controller
|
||||
}
|
||||
|
||||
// 获取好友详细信息
|
||||
if (!empty($library['sourceFriends'])) {
|
||||
$friendIds = $library['sourceFriends'];
|
||||
if (!empty($library['friendsGroups'])) {
|
||||
$friendIds = $library['friendsGroups'];
|
||||
$friendsInfo = [];
|
||||
|
||||
if (!empty($friendIds)) {
|
||||
@@ -249,12 +250,14 @@ class ContentLibraryController extends Controller
|
||||
}
|
||||
|
||||
// 将好友信息添加到返回数据中
|
||||
$library['selectedFriends'] = $friendsInfo;
|
||||
$library['friendsGroupsOptions'] = $friendsInfo;
|
||||
}else{
|
||||
$library['friendsGroupsOptions'] = [];
|
||||
}
|
||||
|
||||
// 获取群组详细信息
|
||||
if (!empty($library['sourceGroups'])) {
|
||||
$groupIds = $library['sourceGroups'];
|
||||
if (!empty($library['wechatGroups'])) {
|
||||
$groupIds = $library['wechatGroups'];
|
||||
$groupsInfo = [];
|
||||
|
||||
if (!empty($groupIds)) {
|
||||
@@ -267,7 +270,9 @@ class ContentLibraryController extends Controller
|
||||
}
|
||||
|
||||
// 将群组信息添加到返回数据中
|
||||
$library['selectedGroups'] = $groupsInfo;
|
||||
$library['wechatGroupsOptions'] = $groupsInfo;
|
||||
}else{
|
||||
$library['wechatGroupsOptions'] = [];
|
||||
}
|
||||
|
||||
return json([
|
||||
@@ -319,8 +324,8 @@ class ContentLibraryController extends Controller
|
||||
// 更新内容库基本信息
|
||||
$library->name = $param['name'];
|
||||
$library->sourceType = isset($param['sourceType']) ? $param['sourceType'] : 1;
|
||||
$library->sourceFriends = $param['sourceType'] == 1 ? json_encode($param['friends']) : json_encode([]);
|
||||
$library->sourceGroups = $param['sourceType'] == 2 ? json_encode($param['groups']) : json_encode([]);
|
||||
$library->sourceFriends = $param['sourceType'] == 1 ? json_encode($param['friendsGroups']) : json_encode([]);
|
||||
$library->sourceGroups = $param['sourceType'] == 2 ? json_encode($param['wechatGroups']) : json_encode([]);
|
||||
$library->groupMembers = $param['sourceType'] == 2 ? json_encode($param['groupMembers']) : json_encode([]);
|
||||
$library->keywordInclude = $keywordInclude;
|
||||
$library->keywordExclude = $keywordExclude;
|
||||
|
||||
Reference in New Issue
Block a user