75 lines
3.1 KiB
PHP
75 lines
3.1 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Notice extends CI_Controller
|
|
{
|
|
private $log_dir = 'plan_notice';
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('receiver/receiver_clues_model', 'clues_model');
|
|
$this->load->model('receiver/receiver_clues_notice_model', 'clues_notice_model');
|
|
$this->load->model('sys/sys_notice_model');
|
|
$this->load->model('sys/Sys_admin_model', 'sysAdmin');
|
|
}
|
|
|
|
/**
|
|
* 线索通知
|
|
* @return void
|
|
*/
|
|
public function clues()
|
|
{
|
|
$logPath = "clues.txt";
|
|
$cluseNoticeRow = $this->clues_notice_model->select([], 'clue_id desc', 1, 1);
|
|
$where = [
|
|
'app_id' => Receiver_clues_model::APP_ID_ACTIVITY
|
|
];
|
|
if ($cluseNoticeRow[0]) {
|
|
$where['id>'] = $cluseNoticeRow[0]['clue_id'];
|
|
}
|
|
$cluesRow = $this->clues_model->select($where, 'id asc', 1, 20);
|
|
if ($cluesRow) {
|
|
$noticeAdmins = $this->sysAdmin->select(['role_id' => 2, 'status' => 1], '', 0, 0, 'id,other_json');
|
|
foreach ($cluesRow as $item) {
|
|
debug_log("开始处理线: {$item['id']}", $logPath);
|
|
$mobile = substr($item['mobile'], -4);
|
|
$content = "超级车补新增了一条线索,尾号{$mobile},请及时查看处理。";
|
|
//推送消息给中台客服
|
|
if ($noticeAdmins) {
|
|
foreach ($noticeAdmins as $noticeAdmin) {
|
|
$otherJson = json_decode($noticeAdmin['other_json'], true);
|
|
if ($item['belong_id'] && $item['belong_id'] != $otherJson['belong_id']) {
|
|
continue;
|
|
}
|
|
$params = [
|
|
'platform' => Sys_notice_model::PLAT_FORM_ADMIN,
|
|
'uid' => $noticeAdmin['id'],
|
|
'content' => $content,
|
|
'url' => '/receiver/clues/get?id=' . $item['id'],
|
|
];
|
|
$sendPlatform = Sys_notice_model::PLAT_FORM_SYS_H5;
|
|
$this->sys_notice_model->addNotice($params, $sendPlatform);
|
|
}
|
|
}
|
|
if ($item['pingan_user_id']) {
|
|
$params = [
|
|
'platform' => Sys_notice_model::PLAT_FORM_PINGAN,
|
|
'uid' => $item['pingan_user_id'],
|
|
'content' => $content,
|
|
'url' => '/receiver/clues/detail?id=' . $item['id'],
|
|
];
|
|
$sendPlatform = Sys_notice_model::PLAT_FORM_SYS_H5;
|
|
$this->sys_notice_model->addNotice($params, $sendPlatform);
|
|
}
|
|
$this->clues_notice_model->add([
|
|
'clue_id' => $item['id'],
|
|
'c_time' => time(),
|
|
]);
|
|
debug_log("处理完成线: {$item['id']}", $logPath);
|
|
}
|
|
} else {
|
|
echo '没有新线索';
|
|
}
|
|
}
|
|
} |