function make_new_replace_list($replace_list, $users_list, $message_list, $posi_list) { $result = array(); foreach ($replace_list as $name => $task) { $target_device = @$task['target_device']; $target_messages = @$task['replace_msg']; if (empty($target_device)) { continue; } if (empty($target_messages)) { continue; } $new_target = get_user_selected($users_list, $target_device); $pick_message = get_user_selected($message_list, $target_messages); $new_message = []; foreach ($pick_message as &$item) { $item['text'] = onebox_cached($item['text']); if ($item['msgform'] === 'replace') { $item['position'] = md5($item['position']); $new_message[] = $item; } } $new = array(); $new['targets'] = $new_target; $new['messages'] = $new_message; $new_task = array_merge($task, $new); $new_task['start_time'] = trans_time($new_task['start_time']); $new_task['finish_time'] = trans_time($new_task['finish_time']); $new_task['times'] = intval($new_task['times']); $new_task['interval'] = intval($new_task['interval']); $new_task['interval_pre'] = intval($new_task['interval_pre']); $result[$name] = $new_task; } return $result; }
function make_popup_list($result) { $conf_popup_task = $result['popup-task']; $conf_users = $result['users']; $conf_messages = $result['messages']; $conf_keywords = $result['keywords']; $conf_positions = $result['positions']; $result = array(); foreach ($conf_popup_task as $name => $task) { $target_users = @$task['目标人群']; $target_messages = @$task['消息集合']; if (empty($target_messages)) { continue; } $new_target = get_user_selected($conf_users, $target_users); $pick_message = get_user_selected($conf_messages, $target_messages); foreach ($pick_message as $name => $msg) { if ($msg['消息形式'] === '弹出显示') { continue; } unset($pick_message[$name]); } $task['目标人群'] = format_targets($new_target, $conf_keywords); $task['消息集合'] = format_message($pick_message, $conf_positions); $task['运行状态'] = task_status($task['运行状态']); $task['消息样式'] = pop_style($task['消息样式']); $task['开始时间'] = trans_time($task['开始时间']); $task['结束时间'] = trans_time($task['结束时间']); $task['执行次数'] = intval($task['执行次数']); $task['间隔模式'] = internal_mode($task['间隔模式']); $task['每次间隔'] = intval($task['每次间隔']); $task['前距时间'] = intval($task['前距时间']); $task['消息顺序'] = pop_sequence($task['消息顺序']); $task['任务互斥'] = pop_repel($task['任务互斥']); $result[$name] = $task; } return $result; }