完成通话记录功能、通时统计功能移植

dev
曾超新 5 years ago
parent 92f9340b2b
commit 22c26ef453
  1. 4
      frontend/controllers/CommonController.php
  2. 183
      frontend/controllers/PhoneCenterController.php
  3. 335
      frontend/views/common/call-phone.php
  4. 1
      frontend/views/common/update-pwd.php
  5. 162
      frontend/views/phone-center/assign-phone.php
  6. 308
      frontend/views/phone-center/call-records.php
  7. 104
      frontend/views/phone-center/edit.php
  8. 91
      frontend/views/phone-center/sub-edit.php
  9. 180
      frontend/views/phone-center/sub-index.php
  10. 448
      frontend/views/phone-center/usercall-index.php

@ -381,4 +381,8 @@ class CommonController extends \yii\web\Controller
}
return $data;
}
public function actionCallPhone() {
return $this->render('call-phone');
}
}

@ -45,8 +45,13 @@ use common\models\CompanyT;
class PhoneCenterController extends BaseController
{
public $enableCsrfValidation = false;
public $layout = 'blue-main';
public function actionCallRecords() {
return $this->render('call-records');
}
public function actionCallRecordsJson(){
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$begin_time = $request->get('begin_time',date('Y-m-d'));
$end_time = $request->get('end_time',date('Y-m-d'));
@ -57,7 +62,8 @@ class PhoneCenterController extends BaseController
$duration_end = $request->get('duration_end','');
$call_result = $request->get('call_result','');
$is_called = $request->get('is_called','');
$page = $request->get('page',0);
$offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$company_type = $request->get('company_type',0);//0显示全部,1只显示江西,2只显示湖北
@ -71,79 +77,62 @@ class PhoneCenterController extends BaseController
->leftJoin('user_t','user_t.id=network_phone_t.user_id')
->where('user_t.is_delete=0 and user_t.is_leave=0');
if($company_type == 3){
$query = $query->andWhere('user_t.id="'.$this->my->id.'"');
$query->andWhere('user_t.id="'.$this->my->id.'"');
}
if($begin_time != ''){
$query = $query->andWhere('network_phone_t.begin_date>="'.$begin_time.'"');
$query->andWhere('network_phone_t.begin_date>="'.$begin_time.'"');
}
if($end_time != ''){
$query = $query->andWhere('network_phone_t.begin_date<="'.$end_time.'"');
$query->andWhere('network_phone_t.begin_date<="'.$end_time.'"');
}
if($caller != ''){
$query = $query->andWhere('network_phone_t.caller='.$caller);
$query->andWhere('network_phone_t.caller='.$caller);
}
if($called != ''){
$query = $query->andWhere('network_phone_t.called='.$called);
$query->andWhere('network_phone_t.called='.$called);
}
if($duration_begin != ''){
$query = $query->andWhere('network_phone_t.call_duration>='.$duration_begin);
$query->andWhere('network_phone_t.call_duration>='.$duration_begin);
}
if($duration_end != ''){
$query = $query->andWhere('network_phone_t.call_duration<='.$duration_end);
$query->andWhere('network_phone_t.call_duration<='.$duration_end);
}
if($call_result != ''){
$query = $query->andWhere('network_phone_t.call_result="'.$call_result.'"');
$query->andWhere('network_phone_t.call_result="'.$call_result.'"');
}
if($is_called == 1){
$query = $query->andWhere('network_phone_t.is_called=1');
$query->andWhere('network_phone_t.is_called=1');
}elseif ($is_called ==2){
$query = $query->andWhere('network_phone_t.is_called=0 or network_phone_t.is_called is null');
$query->andWhere('network_phone_t.is_called=0 or network_phone_t.is_called is null');
}
if($username != ''){
$query = $query->andWhere('user_t.username="'.$username.'"');
$query->andWhere('user_t.username="'.$username.'"');
}
if($company_id > 0) {
$query = $query->andWhere('user_t.company_id='.$company_id);
$query->andWhere('user_t.company_id='.$company_id);
}
$company_items = CompanyT::find()->all();
$total = $query->count();
$pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]);
$pagination->setPage($page-1);
$query = $query->offset($pagination->offset)->limit($pagination->limit);
$page_info = MyLib::getPageInfo($pagination);
$query->offset($offset)->limit($limit);
$record_items = $query->orderBy('network_phone_t.id desc')
->all();
return $this->render('call-records',[
'record_items' => $record_items,
'begin_time' => $begin_time,
'end_time' => $end_time,
'is_called' => $is_called,
'username' => $username,
'caller' => $caller,
'called' => $called,
'duration_begin' => $duration_begin,
'duration_end' => $duration_end,
'call_result' => $call_result,
'page_info' => $page_info,
'company_items'=>$company_items,
'company_type'=>$company_type
]);
$data = [];
$data['total'] = $total;
$data['rows'] = [];
foreach($record_items as $item) {
$row = $item->toArray();
$row['username'] = $item->user ? $item->user->getShowName():'';
$row['call_duration'] = MyLib::HMSByTime($item->call_duration);
$row['call_result'] = MyLib::phoneCenterStatus($item->call_result);
$data['rows'][] = $row;
}
return $data;
}
public function actionDownloadFile(){
@ -238,6 +227,15 @@ public function actionDownload(){
public function actionAssignPhone(){
return $this->render('assign-phone');
}
public function actionAssignPhoneJson(){
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$offset = $request->get('offset',0);
$limit = $request->get('limit', 10);
$user_items = UserT::find()->orderBy('username')->all();
$phone_items = NetworkPhoneAssignT::find()
@ -245,25 +243,49 @@ public function actionAssignPhone(){
->orderBy('user_t.username')
->all();
return $this->render('assign-phone',[
'user_items' => $user_items,
'phone_items' => $phone_items
]);
$data = [];
$data['total'] = count($phone_items);
$data['rows'] = [];
foreach($phone_items as $item) {
$row = $item->toArray();
$row['username'] = $item->user->getShowName();
$data['rows'][] = $row;
}
return $data;
}
public function actionSubIndex(){
$request = Yii::$app->request;
$id = $request->get('id',0);
$id = $request->get('phone_id',0);
$assign_info = NetworkPhoneAssignT::findOne($id);
$sub_items = NetworkPhoneSubT::find()->where('assign_id='.$assign_info->id)->all();
return $this->render('sub-index',[
'assign_info' => $assign_info,
'sub_items' => $sub_items
'assign_info' => $assign_info
]);
}
public function actionSubIndexJson(){
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$id = $request->get('phone_id',0);
$offset = $request->get('offset', 0);
$limit = $request->get('limit', 10);
$assign_info = NetworkPhoneAssignT::findOne($id);
$sub_items = NetworkPhoneSubT::find()->where('assign_id='.$assign_info->id)->all();
$data = [];
$data['total'] = count($sub_items);
$data['rows'] = [];
foreach($sub_items as $item) {
$row = $item->toArray();
$data['rows'][] = $row;
}
return $data;
}
public function actionEdit()
{
@ -328,16 +350,18 @@ public function actionAssignPhone(){
}
$row->user_id = $user_id;
$row->phone = $phone;
$row->save();
$tran->commit();
} catch(\Exception $e) {
$tran->rollBack();
throw $e;
if(!$row->save()) {
throw new \Exception(print_r($row->getErrors(), true));
}
$tran->commit();
$result['success'] = true;
$result['msg'] = '保存成功';
} catch(\Exception $e) {
$tran->rollBack();
$result['msg'] = $e->getMessage();
}
}
return $result;
}
@ -485,9 +509,11 @@ public function actionAssignPhone(){
return $result;
}
public function actionUsercallIndex() {
return $this->render('usercall-index');
}
public function actionUsercallIndexJson(){
Yii::$app->response->format = Response::FORMAT_JSON;
set_time_limit(0);
ini_set('memory_limit', '3072M');
@ -497,8 +523,8 @@ public function actionAssignPhone(){
$caller = $request->get('caller','');
$company_id = $request->get('company_id',0);
$company_type = $request->get('company_type',0);//0显示全部,1只显示江西,2只显示湖北,3只显示个人
$page = $request->get('page', 1);
$offset = $request->get('offset', 0);
$limit = $request->get('limit', 10);
$user_id = 0;
@ -513,17 +539,17 @@ public function actionAssignPhone(){
if($company_type == 3){
$query = $query->andWhere('user_t.id="'.$this->my->id.'"');
$query->andWhere('user_t.id="'.$this->my->id.'"');
}
if($caller != ''){
$query = $query->andWhere('user_t.username="'.$caller.'"');
$query->andWhere('user_t.username="'.$caller.'"');
}
if($company_id > 0) {
$query = $query->andWhere('user_t.company_id='.$company_id);
$query->andWhere('user_t.company_id='.$company_id);
}
$query = $query->andWhere('user_t.is_delete=0 and user_t.is_leave=0')->orderBy('user_t.username');
$query->andWhere('user_t.is_delete=0 and user_t.is_leave=0')->orderBy('user_t.username');
if($caller != ''){
$query1 = clone $query;
@ -545,28 +571,19 @@ public function actionAssignPhone(){
// dd($items);
// die;
$pagination = new Pagination(['totalCount' => $total, 'pageSize' => 20]);
$pagination->setPage($page - 1);
$query = $query->offset($pagination->offset)->limit($pagination->limit);
$query = $query->offset($offset)->limit($limit);
$items = $query->all();
$page_info = MyLib::getPageInfo($pagination);
$company_items = CompanyT::find()->all();
$data = [];
$data['total'] = $total;
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$data['rows'][] = $row;
}
return $this->render('usercall-index',[
'items' => $items,
'begin_date' => $begin_date,
'end_date' => $end_date,
'caller' => $caller,
'company_items'=>$company_items,
'company_id'=>$company_id,
'company_type'=>$company_type,
'page_info'=>$page_info,
'page'=>$page,
'user_id'=>$user_id
]);
return $data;
}
public function actionUsercallIndexbak(){

@ -0,0 +1,335 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/iCheck/custom.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<input id="serverInfo" type="hidden" value="ws://127.0.0.1:8800/" size="40"/>
<div id="txt-e" style=" color: red; font-size: 18px; display: none;"></div>
<div id="txt-ok" style=" color: green; font-size: 18px; display: none;"></div>
<input id="sendMsg" type="hidden" value='{"cmd":"LINK"}' style="width: 500px;" >
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>呼叫电话</h5>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="id" value="<?=$user_info->id?>">
<div class="form-group">
<label class="col-md-2 control-label">呼叫电话</label>
<div class="col-md-5">
<input type="text" name="phone" id="phone" value="" class="form-control" autocomplete="off">
</div>
</div>
<div>
<div class="row">
<div class="col-md-5 col-md-offset-3">
<button class="btn btn-primary btn-call" type="button">
<strong>呼叫</strong>
</button>
<button class="btn btn-primary btn-stop" type="button">
<strong>挂断</strong>
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
$(function () {
//提交按钮
$(".btn-call").click(function(){
var phone = $('#phone').val();
sendMsg('ATD',phone);
});
$(".btn-stop").click(function(){
sendMsg('ATH');
});
})
</script>
<script>
var ws;
function wsInit(val){
//重连先关闭
if(val=='reConn'){
ws.close();
}
document.getElementById("txt-ok").innerText="";
document.getElementById("txt-e").innerText="";
if("WebSocket" in window) {
var serverInfo = document.getElementById("serverInfo").value;
// 打开一个 web socket,全局共用一个
ws = new WebSocket(serverInfo);
console.log("已连接"+serverInfo);
ws.onopen = function() {
setTimeout(function(){
sendMsg('link')
},100);
showResult('ok');
};
ws.onmessage = function(evt) {
document.getElementById("recMsg").value=evt.data;
var data = JSON.parse(evt.data);
//console.log(data);
switch(data['cmd']) {
// 服务端ping客户端
case 'USB':
ws.send('{"cmd":"USB","connected":"true","success":"true","message":"成功"}');
break;
case 'CORG':
ws.send('{"cmd":"CORG","number":"10010","success":"true","message":"成功"}');
break;
case 'CALLING':
ws.send('{"cmd":"CALLING","number":"10010","success":"true","message":"成功"}');
break;
case 'CBEGIN':
ws.send('{"cmd":"CBEGIN","success":"true","message":"成功"}');
break;
case 'ALERT':
ws.send('{"cmd":"ALERT","success":"true","message":"成功"}');
break;
case 'CEND':
ws.send('{"cmd":"CEND","success":"true","message":"成功"}');
break;
}
};
//出现错误
ws.onerror = function(evt){
//console.log(evt);
}
//连接断开
ws.onclose = function(evt){
//console.log(evt)
showResult('error');
}
} else {
// 浏览器不支持 WebSocket
alert("您的浏览器不支持 WebSocket!");
}
}
function showResult(val){
var serverInfo = document.getElementById("serverInfo").value;
var okText = serverInfo + "连接成功";
var errText = serverInfo + "连接失败,请检查window服务、IP和端口安装并配置正确";
if(val=='ok'){
document.getElementById("txt-ok").innerText = okText;
document.getElementById("txt-ok").style.display="none";
document.getElementById("txt-e").style.display="none";
}else{
//console.log(errText)
document.getElementById("txt-e").innerText = errText;
document.getElementById("txt-ok").style.display="none";
document.getElementById("txt-e").style.display="none";
}
}
function reConn(){
ws = new WebSocket(serverInfo);
}
function sendMsg(val,phone){
// Web Socket 已连接上,使用 send() 方法发送数据
if(ws === undefined) {
parent.layer.msg('控件无效,请重新安装');
return;
}
var state=ws.readyState;
console.log("readyState:"+state);
if(state!=1){
document.getElementById("txt-e").style.display="block";
//location.reload();
return;
}else{
document.getElementById("txt-e").style.display="none";
}
if(val=="link"){
val = '{"cmd":"LINK"}';
}
/*if(val=="USB"){
val = '{"cmd":"USB","connected":"true","success":"true","message":"成功"}';
}*/
if(val=="ATD"){
function getRadioLValue(haoma){
var obj = document.getElementsByName(haoma);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
// var sendhaoma = getRadioLValue("sendhaoma");
var sendhaoma = 0;
var number_one = phone;
$.get('/phone/ax-out',{'phone':number_one,'user_id':'1'},function(obj){
if(obj.success) {
var number = obj.msg;
val = '{"cmd":"ATD","number":"'+number+'","hidden":"'+sendhaoma+'"}';
document.getElementById("sendMsg").value=val;
ws.send(val);
console.log("数据已发送");
} else {
alert(obj.msg);
}
},'json');
}
if(val=="ATH"){
val = '{"cmd":"ATH"}';
}
if(val=="ATA"){
val = '{"cmd":"ATA"}';
}
if(val=="READIMEI"){
val = '{"cmd":"READIMEI"}';
}
if(val=="READVER"){
val = '{"cmd":"READVER"}';
}
if(val=="READSTATUS"){
val = '{"cmd":"READSTATUS"}';
}
if(val=="startrecord"){
function getLocalTime(nS) {
return new Date(parseInt(nS) * 1000).Format("yyyyMMddhhmmss");
}
Date.prototype.Format = function(fmt) {//author: meizz
var o = {
"M+" : this.getMonth() + 1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth() + 3) / 3), //季度
"S" : this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
//E:\\qtproject\\PhoneService\\kaerHjSDK\\recordfile\\20180514.mp3
var time= Math.round(new Date() / 1000) ;
var times =(getLocalTime(time));
console.log(time);
var filename= "E:/qtproject/PhoneService/kaerHjSDK/recordfile/"+times+".mp3";
val = '{"cmd":"startrecord","filename":"'+filename+'"}';
//alert(filename);
}
if(val=="stoprecord"){
val = '{"cmd":"stoprecord"}';
}
if(val=="HIDENUMBER"){
function getRadioValue(laidian){
var obj = document.getElementsByName(laidian);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
function getRadioLValue(haoma){
var obj = document.getElementsByName(haoma);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
var type=getRadioValue('laidian');
var hidden=getRadioLValue('haoma');
//console.log(type);
//console.log('号码'+hidden);
val = '{"cmd":"HIDENUMBER","type":"'+type+'","hidden":"'+hidden+'"}';
}
if(val=="GETNUMBERHIDEN"){
function getRadioDqValue(duqvhj){
var obj = document.getElementsByName(duqvhj);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
var type=getRadioDqValue('duqvhj');
val = '{"cmd":"GETNUMBERHIDEN","type":"'+type+'"}';
}
if(val=="SETRECORDVOICE"){
var voice= document.getElementById("voice").value;
val = '{"cmd":"SETRECORDVOICE","voice":"'+voice+'"}';
}
if(val=="SETMODE"){
function getRadioHpValue(headsetProfile){
var obj = document.getElementsByName(headsetProfile);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
var mode=getRadioHpValue('headsetProfile');
val = '{"cmd":"SETMODE","mode":"'+mode+'"}';
}
if(val=="GETMODE"){
val = '{"cmd":"GETMODE"}';
}
if(val=="SETUOC"){
function getRadioHpValue(headsetProfileRadio){
var obj = document.getElementsByName(headsetProfileRadio);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
var mode=getRadioHpValue('headsetProfileRadio');
val = '{"cmd":"SETUOC","UOC":"'+mode+'"}';
}
if(val=="GETUOC"){
val = '{"cmd":"GETUOC"}';
}
if(val=="UPPARAM"){//设置通话记录传平台的参数
var upparamurl = document.getElementById("upparamurl").value;//坐席工号
var agent = document.getElementById("agent").value;//坐席工号
var company =document.getElementById("company").value;//计费账号
var thismobile =document.getElementById("thismobile").value;//本机号码
val = '{"cmd":"UPPARAM","url":"'+upparamurl+'","agent":"'+agent+'","company":"'+company+'","thismobile":"'+thismobile+'"}';
}
document.getElementById("sendMsg").value=val;
ws.send(val);
console.log("数据已发送");
}
</script>
<?php $this->endBlock('footer_js'); ?>

@ -2,7 +2,6 @@
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/iCheck/custom.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">

@ -1,89 +1,107 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script><script >
$(document).bind("ajaxSend",function(elm,xhr,s) {
var csrf_param = $('meta[name=csrf-param]').prop('content');
var csrf_token = $('meta[name=csrf-token]').prop('content');
if(s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Param',csrf_param);
xhr.setRequestHeader('X-CSRF-Token',csrf_token);
}
});
</script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>号码分配</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="username">人员名称</th>
<th data-field="phone">电话号码</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
opStr.push('<i class="fa fa-edit" title="编辑"></i>');
opStr.push('</a>');
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">');
opStr.push('<i class="fa fa-trash" title="删除"></i>');
opStr.push('</a>');
opStr.push('<a href="javascript:void(0);" onclick="sub(' + row.id + ')">');
opStr.push('<i class="fa fa-phone" title="小号"></i>');
opStr.push('</a>');
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script><script >
$(document).bind("ajaxSend",function(elm,xhr,s) {
var csrf_param = $('meta[name=csrf-param]').prop('content');
var csrf_token = $('meta[name=csrf-token]').prop('content');
if(s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Param',csrf_param);
xhr.setRequestHeader('X-CSRF-Token',csrf_token);
return opStr.join(' ');
}
function create() {
title = '新增号码';
layer_show(title, '/phone-center/edit?id=0');
}
});
</script>
<link rel="stylesheet" href="../Myfile/css/font.css?v=20190611">
<link rel="stylesheet" href="../Myfile/css/xadmin.css?v=20190605">
<link rel="stylesheet" href="../Myfile/css/theme274.min.css?v=20190605">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="../Myfile/lib/layui/layui.js?v=20190611" charset="utf-8"></script>
<script type="text/javascript" src="../Myfile/js/xadmin.js?v=20190612"></script><script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
//修改
function edit(id) {
window.location.href = '/phone-center/edit?id=' + id;
var title = '编辑号码';
layer_show(title, '/phone-center/edit?id=' + id);
}
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/phone-center/delete',{id:id},function(obj){
if(obj.success) {
window.location.reload();
} else {
alert(obj.msg);
function sub(id) {
window.location.href = '/phone-center/sub-index?phone_id=' + id;
}
function del(id) {
parent.layer.confirm('是否确认删除?', {
btn: ['删除','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/phone-center/delete',{id:id},function(data) {
parent.layer.msg(data.msg);
refreshList();
}, 'json');
}, function(){
//
});
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function sub(id) {
window.location.href = '/phone-center/sub-index?id=' + id;
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/phone-center/assign-phone-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.type_id = $('#type_id').val();
params.name = $('#name').val();
return params;
}
});
return false;
}
$(function() {
$('#add-btn').click(function(){
edit(0);
});
search();
});
</script>
<table style="width:98%;" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="searchForm">
<tr>
<td class="td_bg">
<input type="button" class="act_btn" id="add-btn" name="search-btn" value="添加">
</td>
</tr>
</form>
</table>
<table width="98%" align="center" cellpadding="3" cellspacing="1" class="table">
<tr>
<td width="" align="center" class="bg_tr">人员名称</td>
<td width="" align="center" class="bg_tr">电话号码</td>
<td width="" align="center" class="bg_tr">操作</td>
</tr>
<form id="theFrm">
<?php
foreach($phone_items as $item) {
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg" nowrap><?= $item->user->showName ?></td>
<td align="center" class="td_bg" nowrap><?= $item->phone?></td>
<td align="center" class="td_bg" nowrap>
[<a href="javascript:void(0);" onclick="edit(<?= $item['id'] ?>)">修改</a>]
[<a href="javascript:void(0);" onclick="del(<?= $item['id'] ?>)">删除</a>]
[<a href="javascript:void(0);" onclick="sub(<?= $item['id'] ?>)">小号</a>]
</td>
</tr>
<?php } ?>
</form>
</table>
<?php $this->endBlock(); ?>

@ -1,104 +1,47 @@
<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script><script >
$(document).bind("ajaxSend",function(elm,xhr,s) {
var csrf_param = $('meta[name=csrf-param]').prop('content');
var csrf_token = $('meta[name=csrf-token]').prop('content');
if(s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Param',csrf_param);
xhr.setRequestHeader('X-CSRF-Token',csrf_token);
}
});
</script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script><script >
$(document).bind("ajaxSend",function(elm,xhr,s) {
var csrf_param = $('meta[name=csrf-param]').prop('content');
var csrf_token = $('meta[name=csrf-token]').prop('content');
if(s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Param',csrf_param);
xhr.setRequestHeader('X-CSRF-Token',csrf_token);
}
});
</script>
<link rel="stylesheet" href="../Myfile/css/font.css?v=20190611">
<link rel="stylesheet" href="../Myfile/css/xadmin.css?v=20190605">
<link rel="stylesheet" href="../Myfile/css/theme274.min.css?v=20190605">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="../Myfile/lib/layui/layui.js?v=20190611" charset="utf-8"></script>
<script type="text/javascript" src="../Myfile/js/xadmin.js?v=20190612"></script><script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="/copy/css/jquery.dialog.css" />
<script type="text/javascript" src="/copy/js/core.js"></script>
<script type="text/javascript" src="/copy/js/jquery.dialog.js"></script>
<script type="text/javascript" language="javascript">
//修改
function edit(id) {
window.location.href = '/fix-project/edit?id=' + id;
}
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/fix-project/delete',{id:id},function(obj){
if(obj.success) {
window.location.reload();
} else {
alert(obj.msg);
}
},'json');
}
}
$(function(){
$('#add-btn').click(function(){
edit(0);
});
$("#search-btn").click(function(){
var params = $('#searchForm').serialize();
window.location.href = "/phone-center/call-records?" + params;
});
$('.exitDialog').Dialog({
title:'预约',
autoOpen: false,
width:400,
height:250
});
$('.exit').click(function(){
$('.exitDialog').Dialog('open');
var url = $(this).attr('record_url');
$("#play_url").attr('src',url);
});
$('.exitDialog input[type=button]').click(function(e) {
if($(this).hasClass('normal')){
}
});
});
</script>
<table style="width:98%;" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="searchForm">
<tr>
<td class="td_bg">
通话时间:从<input name="begin_time" type="text" value="<?=$begin_time?>" style="width:150px;" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss'})"><input name="end_time" type="text" value="<?=$end_time?>" style="width:150px;" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss'})">截止
主叫电话:<input name="caller" type="text" value="<?=$caller?>" style="width: 100px;">
被叫电话:<input name="called" type="text" value="<?=$called?>" style="width: 100px;">
通话状态:
<select name="call_result">
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>通话记录</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" class="form-inline" onsubmit="return search();">
<div class="form-group" style="margin-bottom: 8px;">
<label for="username">工号</label>
<input type="text" id="username" name="username" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="datepicker">通话时间</label>
<div class="input-group" id="datepicker">
<input type="text" class="form-control" id="begin_time" name="begin_time" value="" autocomplete="off" />
<span class="input-group-addon"></span>
<input type="text" class="form-control" id="end_time" name="end_time" value="" autocomplete="off" />
</div>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="caller">主叫电话</label>
<input type="text" id="caller" name="caller" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="called">被叫电话</label>
<input type="text" id="called" name="called" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="call_result">通话状态</label>
<select name="call_result" id="call_result" class="form-control">
<option value="">请选择</option>
<option value="ANSWERED" <?= $call_result == 'ANSWERED'? 'selected':''?> >通话成功</option>
<option value="ANSWERED">通话成功</option>
<option value="BUSY">被叫忙</option>
<option value="NO_ANSWER">被叫无应答</option>
<option value="REJECT">被叫拒接</option>
@ -115,66 +58,123 @@ use \common\libs\MyLib;
<option value="CALL_FORWARD">呼叫转移</option>
<option value="OTHER">其他失败情形</option>
</select>
通话时长:从<input name="duration_begin" type="text" value="<?=$duration_begin?>" style="width:100px;" ><input name="duration_end" type="text" value="<?=$duration_end?>" style="width:100px;" >截止
(秒为单位)
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
</td>
</tr>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="duration">通话时长</label>
<div class="input-group" id="duration">
<input type="text" id="duration_begin" name="duration_begin" class="form-control" size="3">
<span class="input-group-addon"></span>
<input type="text" id="duration_end" name="duration_end" class="form-control" size="3">
<span class="input-group-addon">截止(秒为单位)</span>
</div>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label class="control-label">客户来电</label>
<select name="is_called" name="is_called" class="form-control">
<option value="0">全部</option>
<option value="1" ></option>
<option value="2" ></option>
</select>
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
</table>
<table width="98%" align="center" cellpadding="3" cellspacing="1" class="table">
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<td width="" align="center" class="bg_tr">序号</td>
<td width="" align="center" class="bg_tr">坐席人员</td>
<td width="" align="center" class="bg_tr">通话时间</td>
<td width="" align="center" class="bg_tr">主叫真实号码</td>
<td width="" align="center" class="bg_tr">被叫真实号码</td>
<td width="" align="center" class="bg_tr">主叫分配号码</td>
<td width="" align="center" class="bg_tr">被叫分配号码</td>
<td width="" align="center" class="bg_tr">通话时长</td>
<td width="" align="center" class="bg_tr">通话状态</td>
<td width="" align="center" class="bg_tr">语音</td>
<th data-field="id">ID</th>
<th data-field="username">坐席人员</th>
<th data-field="begin_time">通话时间</th>
<th data-field="caller">主叫真实号码</th>
<th data-field="called">被叫真实号码</th>
<th data-field="caller_show">主叫分配号码</th>
<th data-field="called_show">被叫分配号码</th>
<th data-field="call_duration">通话时长</th>
<th data-field="call_result">通话状态</th>
<th data-formatter="opFormatter">语音</th>
</tr>
<form id="theFrm">
<?php
foreach($record_items as $item) {
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg" nowrap><?= $item->id ?></td>
<td align="center" class="td_bg" nowrap><?= $item->user?$item->user->showName:'' ?></td>
<td align="center" class="td_bg" nowrap><?= $item->begin_time ?></td>
<td align="center" class="td_bg" nowrap><?= $item->caller ?></td>
<td align="center" class="td_bg" nowrap><?= $item->called ?></td>
<td align="center" class="td_bg" nowrap><?= $item->caller_show ?></td>
<td align="center" class="td_bg" nowrap><?= $item->called_show ?></td>
<td align="center" class="td_bg" nowrap><?= MyLib::HMSByTime($item->call_duration)?></td>
<td align="center" class="td_bg" nowrap><?= MyLib::phoneCenterStatus($item->call_result) ?></td>
<td align="center" class="td_bg" nowrap>
<?php if($item->record_file_url):?>
<a class="exit" record_url="<?=$item->record_file_url?>" href="javascript:void()">播放</a>
<?php endif;?>
</td>
</tr>
<?php } ?>
</form>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="player" class="hidden">
<audio controls>
<!-- Audio files -->
<source src="http://music.baidu.com/cms/app/muplayer/test_mp3/1.mp3" type="audio/mp3">
<!-- Fallback for browsers that don't support the <audio> element -->
您的浏览器不支持在线播放,请<a href="http://music.baidu.com/cms/app/muplayer/test_mp3/1.mp3">下载</a>
</audio>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/assets/js/plugins/layer/laydate/laydate.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="play(' + row.record_file_url + ')">');
opStr.push('<i class="fa fa-play" title="播放"></i>');
opStr.push('</a>');
return opStr.join(' ');
}
function play(url) {
var body = '<audio controls>';
body += '<source src="http://music.baidu.com/cms/app/muplayer/test_mp3/1.mp3" type="audio/mp3">';
body += '您的浏览器不支持在线播放,请<a href="http://music.baidu.com/cms/app/muplayer/test_mp3/1.mp3">下载</a>';
body += '</audio>';
parent.layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['320px', '130px'], //宽高
title: '播放语音',
content: body
});
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
<div class="exitDialog">
<table style="width:98%; margin-top: 10px; ">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<audio id="play_url" src="" controls="controls"></audio>
</td>
</tr>
</table>
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/phone-center/call-records-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.username = $('#username').val();
params.begin_time = $('#begin_time').val();
params.end_time = $('#end_time').val();
params.caller = $('#caller').val();
params.called = $('#called').val();
params.call_result = $('#call_result').val();
params.duration_begin = $('#duration_begin').val();
params.duration_end = $('#duration_end').val();
params.is_called = $('#is_called').val();
return params;
}
});
return false;
}
</div>
$(function() {
search();
laydate({
elem:'#begin_time',
format: 'YYYY-MM-DD hh:mm:ss',
istime: true
});
laydate({
elem:'#end_time',
format: 'YYYY-MM-DD hh:mm:ss',
istime: true
});
});
</script>
<?php $this->endBlock(); ?>

@ -1,13 +1,23 @@
<?php
use \common\libs\MyLib;
?>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="theFrm">
<?php $this->beginBlock('header_css'); ?>
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>修改密码</h5>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="id" value="<?=$info->id?>">
<tr>
<td width="20%" height="25" class="td_bg">人员名称</td>
<td width="80%" height="25" class="td_bg">
<select name="user_id">
<div class="form-group">
<label class="col-md-1 control-label">人员名称</label>
<div class="col-md-6">
<select name="user_id" id="user_id" class="form-control">
<?php
echo '<option value="0">请选择</option>';
@ -19,59 +29,51 @@ use \common\libs\MyLib;
}
?>
</select>
</td>
</tr>
<tr>
<td width="20%" height="25" class="td_bg">电话号码</td>
<td width="80%" height="25" class="td_bg"><input name="phone" type="text" id="phone" value="<?=$info->phone?>" size="40" /></td>
</tr>
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">电话号码</label>
<div class="col-md-6">
<input type="text" class="form-control" name="phone" id="phone" value="<?=$info->phone?>">
</div>
</div>
<div>
<div class="row">
<div class="col-md-5 col-md-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong>提 交</strong>
</button>
</div>
</div>
</div>
</form>
<tr>
<td height="22" colspan="2" align="center" class="td_bg">
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/>
&nbsp;&nbsp;
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 ">
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script><script >
$(document).bind("ajaxSend",function(elm,xhr,s) {
var csrf_param = $('meta[name=csrf-param]').prop('content');
var csrf_token = $('meta[name=csrf-token]').prop('content');
if(s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Param',csrf_param);
xhr.setRequestHeader('X-CSRF-Token',csrf_token);
}
});
</script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<link rel="stylesheet" href="../Myfile/css/font.css?v=20190611">
<link rel="stylesheet" href="../Myfile/css/xadmin.css?v=20190605">
<link rel="stylesheet" href="../Myfile/css/theme274.min.css?v=20190605">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="../Myfile/lib/layui/layui.js?v=20190611" charset="utf-8"></script>
<script type="text/javascript" src="../Myfile/js/xadmin.js?v=20190612"></script><script type="text/javascript" language="javascript">
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
$(function () {
//提交按钮
$("#submit-btn").click(function(){
if(confirm('是否确认提交?')) {
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/phone-center/save',params,function(obj){
if(obj.success) {
$('#back-btn').click();
} else {
alert(obj.msg);
$.post('/phone-center/save',params,function(data){
parent.layer.msg(data.msg);
if(data.success) {
parent.refreshList();
layer_close();
}
},'json');
}
}, function(){
//
});
//返回按钮
$('#back-btn').click(function(){
window.location.href='/phone-center/assign-phone';
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

@ -1,59 +1,62 @@
<?php
use \common\libs\MyLib;
?>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="theFrm">
<input type="hidden" name="id" value="<?=$info->id?>">
<input type="hidden" name="assign_id" value="<?=$assign_id?>">
<tr>
<td width="20%" height="25" class="td_bg">电话号码</td>
<td width="40%" height="25" class="td_bg"><input name="phone" type="text" id="phone" value="<?=$info->phone?>" size="40" /></td>
<td width="20%" height="25" class="td_bg">作为被叫号</td>
<td width="40" height="25" class="td_bg">
<input name="is_called" type="radio" id="is_called" value="0" size="40" <?=$info->is_called == 0?'checked':'' ?> />
<input name="is_called" type="radio" id="is_called" value="1" size="40" <?=$info->is_called == 1?'checked':''?> />
</td>
<?php $this->beginBlock('header_css'); ?>
<?php $this->endBlock(); ?>
</tr>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>修改密码</h5>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="assign_id" value="<?=$assign_id?>">
<div class="form-group">
<label class="col-md-1 control-label">电话号码</label>
<div class="col-md-6">
<input type="text" name="phone" value="" class="form-control">
</div>
</div>
<div>
<div class="row">
<div class="col-md-5 col-md-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong>保存</strong>
</button>
</div>
</div>
</div>
</form>
<tr>
<td height="22" colspan="4" align="center" class="td_bg">
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/>
&nbsp;&nbsp;
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 ">
</td>
</tr>
</table>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="../Myfile/css/font.css?v=20190611">
<link rel="stylesheet" href="../Myfile/css/xadmin.css?v=20190605">
<link rel="stylesheet" href="../Myfile/css/theme274.min.css?v=20190605">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="../Myfile/lib/layui/layui.js?v=20190611" charset="utf-8"></script>
<script type="text/javascript" src="../Myfile/js/xadmin.js?v=20190612"></script><script type="text/javascript" language="javascript">
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
$(function () {
//提交按钮
$("#submit-btn").click(function(){
if(confirm('是否确认提交?')) {
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/phone-center/sub-save',params,function(obj){
alert(obj.msg);
if(obj.success) {
$('#back-btn').click();
$.post('/phone-center/sub-save',params,function(data){
parent.layer.msg(data.msg);
if(data.success) {
parent.refreshList();
layer_close();
}
},'json');
}
}, function(){
//
});
//返回按钮
$('#back-btn').click(function(){
var params = $("#theFrm").serialize();
window.location.href='/phone-center/sub-index?id=<?=$assign_id?>';
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

@ -1,114 +1,106 @@
<?php
use \common\libs\MyLib;
?>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="theFrm">
<input type="hidden" name="assign_id" value="<?=$assign_info->id?>">
<tr>
<td width="20%" height="25" class="td_bg">人员名称</td>
<td width="80%" height="25" class="td_bg" colspan="2">
<?=$assign_info->user->getShowName()?>
</td>
</tr>
<tr>
<td width="20%" height="25" class="td_bg">电话</td>
<td width="80%" height="25" class="td_bg" colspan="2">
<?=$assign_info->phone?>
</td>
</tr>
<tr>
<td width="20%" height="25" class="td_bg" colspan="3">&nbsp;</td>
</tr>
<tr>
<td width="20%" height="25" class="td_bg">小号</td>
<td width="80%" height="25" class="td_bg" colspan="2">
[<a href="javascript:void(0);" onclick="add(<?= $assign_info->id ?>)">添加</a>]
</td>
</tr>
<?php foreach ($sub_items as $k=>$item):?>
<tr>
<td width="20%" height="25" class="td_bg"><?=$k+1?></td>
<td width="40%" height="25" class="td_bg">
<?=$item->phone?>&nbsp;&nbsp;[<a href="javascript:void(0);" onclick="link(<?= $item['id'] ?>,<?=$assign_info->id?>)">绑定</a>]
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
</td>
<td height="25" class="td_bg">
[<a href="javascript:void(0);" onclick="edit(<?= $item['id'] ?>,<?= $assign_info->id ?>)">修改</a>]
[<a href="javascript:void(0);" onclick="del(<?= $item['id'] ?>)">删除</a>]
</td>
</tr>
<?php endforeach;?>
</form>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>号码分配 -- <?=$assign_info->user->getShowName()?> -- <?=$assign_info->phone?></h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="history.back();">
<i class="fa fa-backward"></i> 返回
</a>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<td height="22" colspan="3" align="center" class="td_bg" >
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 ">
</td>
<th data-field="id">ID</th>
<th data-field="phone">电话号码</th>
<th data-formatter="opFormatter">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script><script >
$(document).bind("ajaxSend",function(elm,xhr,s) {
var csrf_param = $('meta[name=csrf-param]').prop('content');
var csrf_token = $('meta[name=csrf-token]').prop('content');
if(s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Param',csrf_param);
xhr.setRequestHeader('X-CSRF-Token',csrf_token);
}
});
</script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script><script >
$(document).bind("ajaxSend",function(elm,xhr,s) {
var csrf_param = $('meta[name=csrf-param]').prop('content');
var csrf_token = $('meta[name=csrf-token]').prop('content');
if(s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Param',csrf_param);
xhr.setRequestHeader('X-CSRF-Token',csrf_token);
}
});
</script>
<link rel="stylesheet" href="../Myfile/css/font.css?v=20190611">
<link rel="stylesheet" href="../Myfile/css/xadmin.css?v=20190605">
<link rel="stylesheet" href="../Myfile/css/theme274.min.css?v=20190605">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="../Myfile/lib/layui/layui.js?v=20190611" charset="utf-8"></script>
<script type="text/javascript" src="../Myfile/js/xadmin.js?v=20190612"></script><script type="text/javascript" language="javascript">
$(function () {
//返回按钮
$('#back-btn').click(function(){
window.location.href='/phone-center/assign-phone';
});
})
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="link(' + row.id + ')">');
opStr.push('<i class="fa fa-edit" title="绑定"></i>');
opStr.push('</a>');
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">');
opStr.push('<i class="fa fa-trash" title="删除"></i>');
opStr.push('</a>');
function edit(id,assign_id) {
window.location.href = '/phone-center/sub-edit?id=' + id + '&assign_id=' + assign_id;
return opStr.join(' ');
}
function del(id,assign_id) {
if(confirm('是否确认删除?')) {
$.post('/phone-center/sub-delete',{id:id},function(obj){
if(obj.success) {
window.location.reload();
} else {
alert(obj.msg);
function create() {
title = '新增小号';
layer_show(title, '/phone-center/sub-edit?assign_id=<?=$assign_info-id?>');
}
function link(id) {
$.get('/phone/ax-init',{id:id,assign_id:<?=$assign_info-id?>},function(obj){
parent.layer.msg(obj.msg);
},'json');
}
function del(id) {
parent.layer.confirm('是否确认删除?', {
btn: ['删除','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/phone-center/sub-delete',{id:id},function(data) {
parent.layer.msg(data.msg);
refreshList();
}, 'json');
}, function(){
//
});
}
function add(id) {
window.location.href = '/phone-center/sub-edit?assign_id=' + id;
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function link(id,assign_id) {
$.get('/phone/ax-init',{id:id,assign_id:assign_id},function(obj){
alert(obj.msg);
},'json');
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/phone-center/sub-index-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.phone_id = <?=$assign_info->id?>;
params.type_id = $('#type_id').val();
params.name = $('#name').val();
return params;
}
});
return false;
}
$(function() {
search();
});
</script>
<?php $this->endBlock(); ?>

@ -1,340 +1,112 @@
<html>
<meta charset="UTF-8"/>
<head>
<title>卡尔话机WebSocket测试页</title>
</head>
<body onLoad="wsInit()">
<h1>卡尔话机WebSocket测试页</h1><h2>请使用支持webSocket的浏览器</h2>
输入server的ip和port,例如:ws://127.0.0.1:8800/<br/>
<input id="serverInfo" type="text" value="ws://127.0.0.1:8800/" size="40"/>&nbsp;&nbsp;
<input type="button" id="btn" value="重新连接" onClick="wsInit('reConn')" />
<br>
<div id="txt-e" style=" color: red; font-size: 18px; display: none;"></div>
<div id="txt-ok" style=" color: green; font-size: 18px; display: none;"></div>
<p>
发送报文:<input id="sendMsg" type="text" value='{"cmd":"LINK"}' style="width: 500px;">
<br><br>
接收报文:
<textarea style="width:500px;"id="recMsg" name="" cols="" rows="10"></textarea></p>
<p><input type="button" onClick="sendMsg('link')" value="发起link连接"></p>
<p><input type="button" onClick="sendMsg('ATD')" value="拨号">
<span style="border:2px solid #6C3;font-size:12px; color:#1a1a1a; margin-left:10px;padding:5px">
<label><input type="radio" name="sendhaoma" value="1" checked="true">隐藏号码</label>
<label><input type="radio" name="sendhaoma" value="0" >显示号码</label>
</span>
<input type="tel" id="tel" value="10010" style="margin-left:10px;"/>
</p>
<p><input type="button" onClick="sendMsg('ATH')" value="挂断"></p>
<p><input type="button" onClick="sendMsg('ATA')" value="接听"></p>
<p><input type="button" onClick="sendMsg('READIMEI')" value="读取话机imei"></p>
<p><input type="button" onClick="sendMsg('READVER')" value="读取话机版本号"></p>
<p><input type="button" onClick="sendMsg('startrecord')" value="开启录音"></p>
<p><input type="button" onClick="sendMsg('stoprecord')" value="停止录音"></p>
<p><input type="button" onClick="sendMsg('READSTATUS')" value="查询话机状态"><span style="font-size:12px; color:#333; margin-left:10px">备注:status:0挂机,1来电,2呼叫,3接通
挂机状态时,number号码为空。</span></p>
<p><input type="button" onClick="sendMsg('HIDENUMBER')" value="隐藏或显示号码">
<span style="border:2px solid #6C6;font-size:12px; color:#1a1a1a; margin-left:10px; padding:5px">
<label><input type="radio" name="laidian" value="0" >来电</label> <label><input type="radio" name="laidian" value="1" >去电</label>
</span>
<span style="border:2px solid #6C3;font-size:12px; color:#1a1a1a; margin-left:10px;padding:5px">
<label><input type="radio" name="haoma" value="1" >隐藏号码</label>
<label><input type="radio" name="haoma" value="0" >显示号码</label>
</span>
</p>
<p><input type="button" onClick="sendMsg('GETNUMBERHIDEN')" value="读取话机号码隐藏状态">
<span style="border:2px solid #6C6;font-size:12px; color:#1a1a1a; margin-left:10px; padding:5px">
<label><input name="duqvhj" type="radio" value="0" checked >来电</label>
<label><input type="radio" name="duqvhj" value="1">去电</label>
</span>
</p>
<p><input type="button" onClick="sendMsg('SETRECORDVOICE')" value="设置录音音量">
<input type="voice" id="voice" value=""/><span style="font-size:12px; color:#333; margin-left:10px">备注:声音范围 1~100。</span>
</p>
<p><input type="button" onClick="sendMsg('SETMODE')" value="设置话机通话模式">
<span style="border:2px solid #6C6;font-size:12px; color:#1a1a1a; margin-left:10px; padding:5px">
<label><input name="headsetProfile" type="radio" value="0" checked >关闭耳机模式</label>
<label><input name="headsetProfile" type="radio" value="1">开耳机模式</label>
</span>
</p>
<p><input type="button" onClick="sendMsg('GETMODE')" value="获取话机通话模式">
<span style="font-size:12px; color:#333; margin-left:10px">备注:0 关闭耳机模式,1 开耳机模式。</span>
</p>
<p><input type="button" onClick="sendMsg('SETUOC')" value="设置远端播放">
<span style="border:2px solid #6C6;font-size:12px; color:#1a1a1a; margin-left:10px; padding:5px">
<label><input name="headsetProfileRadio" type="radio" value="0" checked >关闭远端播放</label>
<label><input name="headsetProfileRadio" type="radio" value="1">开启远端播放</label>
</span>
</p>
<p><input type="button" onClick="sendMsg('GETUOC')" value="获取远端播放">
<span style="font-size:12px; color:#333; margin-left:10px">备注:0 关闭远端播放,1 开启远端播放。</span>
</p>
<p>
<input type="button" onClick="sendMsg('UPPARAM')" value="设置通话记录传平台的参数">
<span style="font-size:12px; color:#1a1a1a; margin-left:10px; padding:5px">
url:<input type="upparamurl" id="upparamurl" value="http://apis.7moor.com/sim/cdr_ytx/insertCdr/" style="margin-left:10px;"/>
坐席工号:<input type="agent" id="agent" value="100001" style="margin-left:10px;"/>
计费账号:<input type="company" id="company" value="psytest" style="margin-left:10px;"/>
本机号码:<input type="thismobile" id="thismobile" value="13212345678" style="margin-left:10px;"/>
</span>
</p>
</body>
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>通话记录</h5>
<div class="ibox-tools">
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" class="form-inline" onsubmit="return search();">
<div class="form-group" style="margin-bottom: 8px;">
<label for="username">坐席人员</label>
<input type="text" id="caller" name="caller" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="datepicker">通话时间</label>
<div class="input-group" id="datepicker">
<input type="text" class="form-control" id="begin_date" name="begin_date" value="" autocomplete="off" />
<span class="input-group-addon"></span>
<input type="text" class="form-control" id="end_date" name="end_date" value="" autocomplete="off" />
</div>
</div>
<button type="submit" class="btn btn-primary">搜索</button>
</form>
<div class="row">
<div class="col-md-12">
<table id="listTable">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="username">工号</th>
<th data-field="name">姓名</th>
<th data-field="total_call_num">通话数量</th>
<th data-field="total_call_time_out">呼出时长</th>
<th data-field="total_call_time">通话时长</th>
<th data-field="call_in_total_num">呼入次数</th>
<th data-field="call_in_suc_num">成功呼入</th>
<th data-field="call_in_suc_num_rate">呼入接通率</th>
<th data-field="call_out_total_num">呼出次数</th>
<th data-field="call_out_suc_num">成功呼出</th>
<th data-field="call_out_suc_num_rate">呼出接通率</th>
<th data-field="phone_status">通话状态</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/assets/js/plugins/layer/laydate/laydate.js"></script>
<script>
var ws;
function wsInit(val){
//重连先关闭
if(val=='reConn'){
ws.close();
}
document.getElementById("txt-ok").innerText="";
document.getElementById("txt-e").innerText="";
if("WebSocket" in window) {
var serverInfo = document.getElementById("serverInfo").value;
// 打开一个 web socket,全局共用一个
ws = new WebSocket(serverInfo);
//console.log("已连接"+serverInfo);
ws.onopen = function() {
setTimeout(function(){
sendMsg('link')
},100);
showResult('ok');
};
ws.onmessage = function(evt) {
document.getElementById("recMsg").value=evt.data;
var data = JSON.parse(evt.data);
//console.log(data);
switch(data['cmd']) {
// 服务端ping客户端
case 'USB':
ws.send('{"cmd":"USB","connected":"true","success":"true","message":"成功"}');
break;
case 'CORG':
ws.send('{"cmd":"CORG","number":"10010","success":"true","message":"成功"}');
break;
case 'CALLING':
ws.send('{"cmd":"CALLING","number":"10010","success":"true","message":"成功"}');
break;
case 'CBEGIN':
ws.send('{"cmd":"CBEGIN","success":"true","message":"成功"}');
break;
case 'ALERT':
ws.send('{"cmd":"ALERT","success":"true","message":"成功"}');
break;
case 'CEND':
ws.send('{"cmd":"CEND","success":"true","message":"成功"}');
break;
}
};
//出现错误
ws.onerror = function(evt){
//console.log(evt);
}
//连接断开
ws.onclose = function(evt){
//console.log(evt)
showResult('error');
}
} else {
// 浏览器不支持 WebSocket
alert("您的浏览器不支持 WebSocket!");
}
}
function showResult(val){
var serverInfo = document.getElementById("serverInfo").value;
var okText = serverInfo + "连接成功";
var errText = serverInfo + "连接失败,请检查window服务、IP和端口安装并配置正确";
if(val=='ok'){
document.getElementById("txt-ok").innerText = okText;
document.getElementById("txt-ok").style.display="block";
document.getElementById("txt-e").style.display="none";
}else{
//console.log(errText)
document.getElementById("txt-e").innerText = errText;
document.getElementById("txt-ok").style.display="none";
document.getElementById("txt-e").style.display="block";
}
}
function reConn(){
ws = new WebSocket(serverInfo);
}
function sendMsg(val){
// Web Socket 已连接上,使用 send() 方法发送数据
var state=ws.readyState;
console.log("readyState:"+state);
if(state!=1){
document.getElementById("txt-e").style.display="block";
//location.reload();
return;
}else{
document.getElementById("txt-e").style.display="none";
}
if(val=="link"){
val = '{"cmd":"LINK"}';
}
/*if(val=="USB"){
val = '{"cmd":"USB","connected":"true","success":"true","message":"成功"}';
}*/
if(val=="ATD"){
function getRadioLValue(haoma){
var obj = document.getElementsByName(haoma);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
var sendhaoma = getRadioLValue("sendhaoma");
var number = document.getElementById("tel").value;
val = '{"cmd":"ATD","number":"'+number+'","hidden":"'+sendhaoma+'"}';
}
if(val=="ATH"){
val = '{"cmd":"ATH"}';
}
if(val=="ATA"){
val = '{"cmd":"ATA"}';
}
if(val=="READIMEI"){
val = '{"cmd":"READIMEI"}';
}
if(val=="READVER"){
val = '{"cmd":"READVER"}';
}
if(val=="READSTATUS"){
val = '{"cmd":"READSTATUS"}';
}
if(val=="startrecord"){
function getLocalTime(nS) {
return new Date(parseInt(nS) * 1000).Format("yyyyMMddhhmmss");
}
Date.prototype.Format = function(fmt) {//author: meizz
var o = {
"M+" : this.getMonth() + 1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth() + 3) / 3), //季度
"S" : this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
//E:\\qtproject\\PhoneService\\kaerHjSDK\\recordfile\\20180514.mp3
var time= Math.round(new Date() / 1000) ;
var times =(getLocalTime(time));
console.log(time);
var filename= "E:/qtproject/PhoneService/kaerHjSDK/recordfile/"+times+".mp3";
val = '{"cmd":"startrecord","filename":"'+filename+'"}';
//alert(filename);
}
if(val=="stoprecord"){
val = '{"cmd":"stoprecord"}';
}
if(val=="HIDENUMBER"){
function getRadioValue(laidian){
var obj = document.getElementsByName(laidian);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
function getRadioLValue(haoma){
var obj = document.getElementsByName(haoma);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
var type=getRadioValue('laidian');
var hidden=getRadioLValue('haoma');
//console.log(type);
//console.log('号码'+hidden);
val = '{"cmd":"HIDENUMBER","type":"'+type+'","hidden":"'+hidden+'"}';
}
if(val=="GETNUMBERHIDEN"){
function getRadioDqValue(duqvhj){
var obj = document.getElementsByName(duqvhj);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
var type=getRadioDqValue('duqvhj');
val = '{"cmd":"GETNUMBERHIDEN","type":"'+type+'"}';
}
if(val=="SETRECORDVOICE"){
var voice= document.getElementById("voice").value;
val = '{"cmd":"SETRECORDVOICE","voice":"'+voice+'"}';
}
if(val=="SETMODE"){
function getRadioHpValue(headsetProfile){
var obj = document.getElementsByName(headsetProfile);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
var mode=getRadioHpValue('headsetProfile');
val = '{"cmd":"SETMODE","mode":"'+mode+'"}';
}
if(val=="GETMODE"){
val = '{"cmd":"GETMODE"}';
}
if(val=="SETUOC"){
function getRadioHpValue(headsetProfileRadio){
var obj = document.getElementsByName(headsetProfileRadio);
for(i = 0;i<obj.length;i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "undefined";
}
var mode=getRadioHpValue('headsetProfileRadio');
val = '{"cmd":"SETUOC","UOC":"'+mode+'"}';
}
if(val=="GETUOC"){
val = '{"cmd":"GETUOC"}';
}
if(val=="UPPARAM"){//设置通话记录传平台的参数
var upparamurl = document.getElementById("upparamurl").value;//坐席工号
var agent = document.getElementById("agent").value;//坐席工号
var company =document.getElementById("company").value;//计费账号
var thismobile =document.getElementById("thismobile").value;//本机号码
val = '{"cmd":"UPPARAM","url":"'+upparamurl+'","agent":"'+agent+'","company":"'+company+'","thismobile":"'+thismobile+'"}';
}
document.getElementById("sendMsg").value=val;
ws.send(val);
console.log("数据已发送");
}
function opFormatter(value, row, index) {
var opStr = [];
opStr.push('<a href="javascript:void(0);" onclick="play(' + row.record_file_url + ')">');
opStr.push('<i class="fa fa-play" title="播放"></i>');
opStr.push('</a>');
return opStr.join(' ');
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/phone-center/usercall-index-json",
pagination: true,
sidePagination: 'server',
queryParams: function(params) {
params.username = $('#username').val();
params.begin_time = $('#begin_time').val();
params.end_time = $('#end_time').val();
params.caller = $('#caller').val();
params.called = $('#called').val();
params.call_result = $('#call_result').val();
params.duration_begin = $('#duration_begin').val();
params.duration_end = $('#duration_end').val();
params.is_called = $('#is_called').val();
return params;
}
});
return false;
}
$(function() {
search();
laydate({
elem:'#begin_date',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#end_date',
format: 'YYYY-MM-DD'
});
});
</script>
</html>
<?php $this->endBlock(); ?>

Loading…
Cancel
Save