86 lines
3.3 KiB
PHP
86 lines
3.3 KiB
PHP
<?php
|
|
/**
|
|
* Created by Vim
|
|
* User: lcc
|
|
* Date: 2021/06/29
|
|
* Time: 13:47
|
|
*/
|
|
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Receiver_clue_oplogs_model extends HD_Model
|
|
{
|
|
private $table_name = 'lc_receiver_clue_oplogs';
|
|
const SUB_TYPE_XZ = 'xz';
|
|
const SUB_TYPE_AUTO_CALL_OUT = 'call_out'; //平安外呼(平安后台)
|
|
const SUB_TYPE_AUTO_CALL_OUT_WECHAT = 'call_out_wechat'; //平安外呼 小程序和sadmin后台
|
|
|
|
//type状态值11不解锁
|
|
const TYPE_UNLOCK = 11;
|
|
|
|
//消息来源
|
|
const CF_PLATFORM_ADMIN = 'admin';
|
|
const CF_PLATFORM_WXAPP = 'wxapp';
|
|
const CF_PLATFORM_PINGAN_ADMIN = 'pingan_admin';
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct($this->table_name, 'default');
|
|
}
|
|
|
|
/**
|
|
* Notes:类型
|
|
* Created on: 2021/7/27 10:31
|
|
* Created by: dengbw
|
|
* @return array
|
|
*/
|
|
public function typeAry()
|
|
{
|
|
//4 汽车之家外呼拨打拨打电话
|
|
return array(0 => '小记', 1 => '发短信', 2 => '拨打电话', 3 => '新增', 4 => '拨打电话', 9 => '系统', self::TYPE_UNLOCK => '不解锁');
|
|
}
|
|
|
|
/**
|
|
* 获取录音文件
|
|
* @param $id
|
|
* @return array
|
|
*/
|
|
public function getRecordUrl($id)
|
|
{
|
|
$this->load->model('receiver/receiver_yx_model');
|
|
$this->load->model('receiver/receiver_xz_model');
|
|
$this->load->model('receiver/receiver_call_wechat_model');
|
|
$this->load->model('receiver/receiver_call_model');
|
|
$row = $this->get(['id' => $id]);
|
|
$duration = $rec_text = $rec_url = '';
|
|
if ($row['type'] == 2) {
|
|
$record = '';
|
|
if ($row['sub_type'] == self::SUB_TYPE_XZ) {
|
|
$rec_row = $this->receiver_xz_model->get(['id' => $row['log']], 'rec_url,duration');
|
|
$rec_row['rec_url'] && $record = $rec_row['rec_url'];
|
|
$rec_row['duration'] = intval($rec_row['duration'] / 1000);
|
|
} elseif ($row['sub_type'] == self::SUB_TYPE_AUTO_CALL_OUT_WECHAT) {
|
|
$rec_row = $this->receiver_call_wechat_model->get(['id' => $row['log']], 'recordUrl as rec_url,telDuration as duration');
|
|
$rec_row['rec_url'] && $record = $rec_row['rec_url'];
|
|
} elseif ($row['sub_type'] == self::SUB_TYPE_AUTO_CALL_OUT) { //暂时没办法获取录音文件
|
|
// $rec_row = $this->receiver_call_model->get(['id' => $row['log']], 'telDuration as duration');
|
|
$rec_row['duration'] = 1;
|
|
$rec_row['rec_url'] = "拨打电话";
|
|
$rec_text = "拨打电话";
|
|
} else {
|
|
$rec_row = $this->receiver_xz_model->get(['id' => $row['log']], 'rec_url,duration');
|
|
$rec_row['rec_url'] && $record = $rec_row['rec_url'];
|
|
$rec_row['duration'] = intval($rec_row['duration'] / 1000);
|
|
}
|
|
$duration = $rec_row['duration'];
|
|
if ($rec_row['duration']) {
|
|
$record && $rec_url = $record;
|
|
!$rec_row['rec_url'] && $rec_text = '录音暂未生成';
|
|
} else {
|
|
$rec_text = '未接通';
|
|
}
|
|
}
|
|
return [$rec_url, $rec_text, $duration];
|
|
}
|
|
}
|