diff --git a/frontend/controllers/CommonController.php b/frontend/controllers/CommonController.php index 4eacfe6..ccc3f61 100644 --- a/frontend/controllers/CommonController.php +++ b/frontend/controllers/CommonController.php @@ -381,4 +381,8 @@ class CommonController extends \yii\web\Controller } return $data; } + + public function actionCallPhone() { + return $this->render('call-phone'); + } } diff --git a/frontend/controllers/PhoneCenterController.php b/frontend/controllers/PhoneCenterController.php index 0fb4fb4..19373dc 100644 --- a/frontend/controllers/PhoneCenterController.php +++ b/frontend/controllers/PhoneCenterController.php @@ -45,8 +45,13 @@ use common\models\CompanyT; class PhoneCenterController extends BaseController { public $enableCsrfValidation = false; + public $layout = 'blue-main'; - public function actionCallRecords(){ + 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(){ @@ -237,33 +226,66 @@ public function actionDownload(){ } -public function actionAssignPhone(){ - $user_items = UserT::find()->orderBy('username')->all(); + 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); - $phone_items = NetworkPhoneAssignT::find() - ->leftJoin('user_t','user_t.id=network_phone_assign_t.user_id') - ->orderBy('user_t.username') - ->all(); + $user_items = UserT::find()->orderBy('username')->all(); - return $this->render('assign-phone',[ - 'user_items' => $user_items, - 'phone_items' => $phone_items - ]); -} + $phone_items = NetworkPhoneAssignT::find() + ->leftJoin('user_t','user_t.id=network_phone_assign_t.user_id') + ->orderBy('user_t.username') + ->all(); + + $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(); - + if(!$row->save()) { + throw new \Exception(print_r($row->getErrors(), true)); + } $tran->commit(); + + $result['success'] = true; + $result['msg'] = '保存成功'; + } catch(\Exception $e) { $tran->rollBack(); - throw $e; + $result['msg'] = $e->getMessage(); } - - $result['success'] = true; - $result['msg'] = '保存成功'; } return $result; } @@ -485,9 +509,11 @@ public function actionAssignPhone(){ return $result; } - - public function actionUsercallIndex(){ - + 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(){ diff --git a/frontend/views/common/call-phone.php b/frontend/views/common/call-phone.php new file mode 100644 index 0000000..9c9f092 --- /dev/null +++ b/frontend/views/common/call-phone.php @@ -0,0 +1,335 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + + + + + +
+
+
+
呼叫电话
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + + +endBlock('footer_js'); ?> diff --git a/frontend/views/common/update-pwd.php b/frontend/views/common/update-pwd.php index c3d09af..6169175 100644 --- a/frontend/views/common/update-pwd.php +++ b/frontend/views/common/update-pwd.php @@ -2,7 +2,6 @@ use \common\libs\MyLib; ?> beginBlock('header_css'); ?> - endBlock(); ?>
diff --git a/frontend/views/phone-center/assign-phone.php b/frontend/views/phone-center/assign-phone.php index d7eecce..34d179f 100644 --- a/frontend/views/phone-center/assign-phone.php +++ b/frontend/views/phone-center/assign-phone.php @@ -1,89 +1,107 @@ +beginBlock('header_css'); ?> + +endBlock(); ?> - - +
+
+
+
号码分配
+ +
+
+
+
+ + + + + + + + + +
ID人员名称电话号码操作
+
+
+
+
+
- - - - - - - - + + + - - - - - - -
- -
- - - - - - - - - - - - - - - -
人员名称电话号码操作
user->showName ?>phone?> - [修改] - [删除] - [小号] -
+endBlock(); ?> diff --git a/frontend/views/phone-center/call-records.php b/frontend/views/phone-center/call-records.php index 8d8a502..906a0c7 100644 --- a/frontend/views/phone-center/call-records.php +++ b/frontend/views/phone-center/call-records.php @@ -1,180 +1,180 @@ - - - - - - - - - - - - - - - - - - - + + + + - - - - - - -
- 通话时间:从截止 - 主叫电话: - 被叫电话: - - 通话状态: - - 通话时长:从截止 -(秒为单位) - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
序号坐席人员通话时间主叫真实号码被叫真实号码主叫分配号码被叫分配号码通话时长通话状态语音
id ?>user?$item->user->showName:'' ?>begin_time ?>caller ?>called ?>caller_show ?>called_show ?>call_duration)?>call_result) ?> - record_file_url):?> - 播放 - - -
- -
- - - - - - - - - -
 
- -
- -
+endBlock(); ?> diff --git a/frontend/views/phone-center/edit.php b/frontend/views/phone-center/edit.php index 2c4f29a..93e3ceb 100644 --- a/frontend/views/phone-center/edit.php +++ b/frontend/views/phone-center/edit.php @@ -1,77 +1,79 @@ - - - - - - - - - - - - - - - -
人员名称 - -
电话号码
- -    - -
+
+
+
+
修改密码
+
+
+
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
- - - - - - - +endBlock('footer_js'); ?> diff --git a/frontend/views/phone-center/sub-edit.php b/frontend/views/phone-center/sub-edit.php index 8108b41..186f2e5 100644 --- a/frontend/views/phone-center/sub-edit.php +++ b/frontend/views/phone-center/sub-edit.php @@ -1,59 +1,62 @@ - - - - +beginBlock('header_css'); ?> +endBlock(); ?> - - - - - +
+
+
+
修改密码
+
+
+
+
+ + +
+ +
+ +
+
+
+
+
+ +
+
+
+ +
+
+
+
+
- - - - - -
电话号码作为被叫号 - is_called == 0?'checked':'' ?> />否 - is_called == 1?'checked':''?> />是 -
- -    - -
- - - - - - - - - - - +endBlock('footer_js'); ?> diff --git a/frontend/views/phone-center/sub-index.php b/frontend/views/phone-center/sub-index.php index 0a5ffb5..adde1cb 100644 --- a/frontend/views/phone-center/sub-index.php +++ b/frontend/views/phone-center/sub-index.php @@ -1,114 +1,106 @@ - - - - - - - - - - - - - - - - - - - $item):?> - - - - - - - - - - -
人员名称 - user->getShowName()?> -
电话 - phone?> -
 
小号 - [添加] -
- phone?>  [绑定] +beginBlock('header_css'); ?> + +endBlock(); ?> - - [修改] - [删除] -
+
+
+
+
号码分配 -- user->getShowName()?> -- phone?>
+ +
+
+
+
+ + + + + + + + +
ID电话号码操作
+
+
+
+
+
- -
- - +beginBlock('footer_js'); ?> + + + + - - - - - - +endBlock(); ?> diff --git a/frontend/views/phone-center/usercall-index.php b/frontend/views/phone-center/usercall-index.php index c199bed..fdf8fd9 100644 --- a/frontend/views/phone-center/usercall-index.php +++ b/frontend/views/phone-center/usercall-index.php @@ -1,340 +1,112 @@ - - - - 卡尔话机WebSocket测试页 - - -

卡尔话机WebSocket测试页

请使用支持webSocket的浏览器

-输入server的ip和port,例如:ws://127.0.0.1:8800/
-   - -
- - -

- 发送报文: -

- 接收报文: - -

-

-

- - - - - -

- -

-

-

-

-

-

-

备注:status:0挂机,1来电,2呼叫,3接通 -挂机状态时,number号码为空。

-

- - - - - - - -

-

- - - - -

-

- 备注:声音范围 1~100。 -

-

- - - - -

-

- 备注:0 关闭耳机模式,1 开耳机模式。 -

- -

- - - - -

- -

- 备注:0 关闭远端播放,1 开启远端播放。 -

-

- - - - url: - 坐席工号: - 计费账号: - 本机号码: - -

- - + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
通话记录
+ +
+
+
+
+ + +
+
+ +
+ + + +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + +
ID工号姓名通话数量呼出时长通话时长呼入次数成功呼入呼入接通率呼出次数成功呼出呼出接通率通话状态
+
+
+
+
+
+beginBlock('footer_js'); ?> + + + + - - +endBlock(); ?>