昨天有和大家讲到通过某个行业的评论触发的关键词获取客户信息,今天给大家讲讲通过同行账号下的评论获取用户信息,其道理都是一样的,都是通过你设置的匹配词去获取用户信息,只是同行账号是你多加的条件。话不多说给大家上前端页面和后端代码
这里我们在采集账号源填入你想要查询的同行账号主页分享链接填入,匹配词和ai关键词是一样的,把你认为潜在客户会说的话填入,然后通过我们后端去爬取数据。
/*
* 同行账号任务
*/
public function accountAction() {
if (empty($this->breadcrumbs)) {
//面包屑
$this->breadcrumbs = [
['title' => 'D询盘获客', 'link' => '#dyxphk'],
['title' => '同行账号任务', 'link' => '/task/account'],
];
}
$this->buildBreadcrumbs($this->breadcrumbs);
$time_range = $this->request->getStrParam('time_range');
$keyword = $this->request->getStrParam('keyword');
$status = $this->request->getStrParam('status',0);//全部状态
$page = $this->request->getIntParam('page');
$index = $page * $this->count;
$where = [
['name' => 't_ds_id', 'oper' => '=', 'value' => $this->sid],
['name' => 't_platform', 'oper' => '=', 'value' => $this->platform],//抖音平台
['name' => 't_type', 'oper' => '=', 'value' => 2],//关键词任务
];
if (!empty($time_range)) {
$add_time_range_arr = explode('~', $time_range);
$where[] = ['name' => 't_create_time', 'oper' => '>=', 'value' => strtotime($add_time_range_arr[0])];
$where[] = ['name' => 't_create_time', 'oper' => '<', 'value' => strtotime($add_time_range_arr[1]) + 86400];
}
if (!empty($keyword)) {
$where[] = ['name' => 't_name', 'oper' => 'like', 'value' => "%{$keyword}%"];
}
if (!empty($status)) {
$where[] = ['name' => 't_status', 'oper' => '=', 'value' => $status];
}
$sort = [
't_status' => 'ASC',
't_create_time' => 'DESC',
];
//获取账号列表
$task_model = new App_Model_Task_MysqlTaskStorage();
$account_list = $task_model->getList($where, $index, $this->count, $sort);
$monitor_model = new App_Model_Douyin_MysqlAccountMonitorStorage();
foreach ($account_list as &$item) {
$item['account'] = $monitor_model->getRowById($item['t_related_id']);
$item['account_link'] = $this->return_user_link($item['account']['am_user_secid']);
$item['area_scope'] = empty($item['t_range_city']) ? '--' : join('-', json_decode($item['t_range_city'], 1));
}
//计算分页
$all = $task_model->getCount($where);
$page_libs = new Libs_Pagination_Paginator($all, $this->count, 'jquery', TRUE);
$pageHtml = $page_libs->render();
//数据输出
$this->output['time_range'] = $time_range;
$this->output['keyword'] = $keyword;
$this->output['account_list'] = $account_list;
$this->output['pageHtml'] = $pageHtml;
$this->output['task_status'] = plum_parse_config('task_status', 'config');
$this->output['range_time'] = plum_parse_config('range_time', 'dydqt/project');
$this->output['range_sex'] = plum_parse_config('range_sex', 'dydqt/project');
$this->output_action_prefix();
$this->displaySmarty('dydqtshoppc/task/accountList.tpl');
}
把匹配到的用户信息填入我们的客户库里