Files
spacestation/common/models/receiver/Receiver_customer_oplogs_model.php

88 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_customer_oplogs_model extends HD_Model
{
private $table_name = 'lc_receiver_customer_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;
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
/**
* Notes:类型
* Created on: 2022/4/12 16:51
* Created by: dengbw
* @param string $id
* @return array|mixed
*/
public function typeAry($id = '')
{
$arr = [0 => '小记', 1 => '发短信', 2 => '拨打电话', 3 => '新增', 4 => '到店', 5 => '试驾', 6 => '订单', 7 => '战败'
, 8 => '企微跟进', 9 => '系统', 10 => '加个微', self::TYPE_UNLOCK => '不解锁'];
if (strlen($id)) {
return $arr[$id];
} else {
return $arr;
}
}
/**
* 获取录音文件
* @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['rec_url'] = "拨打电话";
$rec_row['duration'] = 1;
$rec_row['rec_url'] = "拨打电话";
$rec_text = "拨打电话";
} else {
$rec_row = $this->receiver_yx_model->get(['id' => $row['log']], 'rec_url,duration');
$rec_row['rec_url'] && $record = get_yx_video($rec_row['rec_url']);
}
$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];
}
}