From a252069f54116e630cb4648dc92fe1d3cf9a1810 Mon Sep 17 00:00:00 2001 From: lcc <1127794702@qq.com> Date: Wed, 4 Sep 2024 11:08:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0=E4=BA=91?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E7=A0=81=E5=88=86=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/controllers/Common.php | 15 +- admin/controllers/Login.php | 9 +- admin/controllers/receiver/Customer.php | 5 +- admin/controllers/sys/yx/Mobile.php | 178 +++++++++++++++++++++ admin/views/sys/yx/edit.php | 113 +++++++++++++ admin/views/sys/yx/edit_admin.php | 31 ++++ admin/views/sys/yx/lists.php | 92 +++++++++++ api/controllers/plan/Yxcall.php | 1 + common/models/sys/Sys_yx_mobiles_model.php | 13 ++ 9 files changed, 446 insertions(+), 11 deletions(-) create mode 100644 admin/controllers/sys/yx/Mobile.php create mode 100644 admin/views/sys/yx/edit.php create mode 100644 admin/views/sys/yx/edit_admin.php create mode 100644 admin/views/sys/yx/lists.php create mode 100644 common/models/sys/Sys_yx_mobiles_model.php diff --git a/admin/controllers/Common.php b/admin/controllers/Common.php index 44d9c7de..e7c5c956 100644 --- a/admin/controllers/Common.php +++ b/admin/controllers/Common.php @@ -833,6 +833,7 @@ class Common extends CI_Controller public function bind_mobile() { $this->load->model('sys/sys_admin_model'); + $this->load->model('sys/sys_yx_mobiles_model'); $params = $this->input->get(); $id = intval($params['id']); $type = $params['type']; @@ -851,12 +852,14 @@ class Common extends CI_Controller return $this->show_json(SYS_CODE_FAIL, '手机不存在!'); } $mobile = $re['mobile']; - $cache = &load_cache('redis'); - $xz_admin_phone = $cache->get('xz_admin_phone'); - $middleNumber = ''; - if ($xz_admin_phone) { - $middleNumber = $xz_admin_phone['admins'][$this->uid]; - } +// $cache = &load_cache('redis'); +// $xz_admin_phone = $cache->get('xz_admin_phone'); +// $middleNumber = ''; +// if ($xz_admin_phone) { +// $middleNumber = $xz_admin_phone['admins'][$this->uid]; +// } + $yxMobiles = $this->sys_yx_mobiles_model->get(['admin_id' => $this->uid, 'status' => 1]); + $middleNumber = $yxMobiles['mobile'] ?: ''; if (!$middleNumber) { return $this->show_json(SYS_CODE_FAIL, '还未分配号码不可使用'); } diff --git a/admin/controllers/Login.php b/admin/controllers/Login.php index 0b3d1983..59c7d1fc 100644 --- a/admin/controllers/Login.php +++ b/admin/controllers/Login.php @@ -216,10 +216,11 @@ class Login extends CI_Controller //退出 public function logout() { - $domain = explode('.', $_SERVER['HTTP_HOST']); - array_shift($domain); - $domain = implode('.', $domain); - +// $domain = explode('.', $_SERVER['HTTP_HOST']); +// array_shift($domain); +// $domain = implode('.', $domain); + $http_host = explode(':', $_SERVER['HTTP_HOST']); + $domain = $http_host[0]; $this->input->set_cookie(LOGIN_COOKIE, '', 0, $domain); return $this->show_json(SYS_CODE_SUCCESS, '注销成功', '/login'); diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 962bb562..c80e16ef 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -647,13 +647,16 @@ class Customer extends HD_Controller foreach ($rows_log as $key => $value) { $rec_text = $rec_url = ''; if ($value['type'] == 2) { + $record = ''; if ($value['sub_type'] == Receiver_customer_oplogs_model::SUB_TYPE_XZ) { $rec_row = $this->receiver_xz_model->get(['id' => $value['log']], 'rec_url,duration'); + $rec_row['rec_url'] && $record = $rec_row['rec_url']; } else { $rec_row = $this->receiver_yx_model->get(['id' => $value['log']], 'rec_url,duration'); + $rec_row['rec_url'] && $record = get_yx_video($rec_row['rec_url']); } if ($rec_row['duration']) { - $rec_row['rec_url'] && $rec_url = $rec_row['rec_url']; + $record && $rec_url = $record; !$rec_row['rec_url'] && $rec_text = '录音暂未生成'; } else { $rec_text = '未接通'; diff --git a/admin/controllers/sys/yx/Mobile.php b/admin/controllers/sys/yx/Mobile.php new file mode 100644 index 00000000..250438f5 --- /dev/null +++ b/admin/controllers/sys/yx/Mobile.php @@ -0,0 +1,178 @@ +load->model('sys/sys_yx_mobiles_model'); + $this->load->model('area_model'); + $this->load->model('sys/sys_admin_model'); + } + + public function index() + { + return $this->lists(); + } + + public function lists($where = array(), $order = 'id desc', $page = 0, $size = 10) + { + $page = $this->input->post_get('page') ? $this->input->get('page') : 1; + $params = $this->input->get(); + $where['status>='] = 0; + if ($params['mobile']) { + $where["mobile like '%{$params['mobile']}%'"] = null; + } + $count = $this->sys_yx_mobiles_model->count($where); + $lists = []; + if ($count) { + $rows = $this->sys_yx_mobiles_model->select($where, $order, $page, $size); + foreach ($rows as $row) { + $tmp = $row; + $city = $this->area_model->get(['city_id' => $row['city_id']]); + $tmp['province_name'] = $city['province_name']; + $tmp['city_name'] = $city['city_name']; + $admin = ''; + if ($row['admin_id']) { + $admin = $this->sys_admin_model->get(['id' => $row['admin_id']]); + } + $tmp['admin_name'] = $admin ? $admin['username'] : '未绑定'; + $lists[] = $tmp; + } + } + $this->data['pager'] = array('count' => '', 'curr' => $page, 'totle' => $count, 'total' => $count); + $this->data['lists'] = $lists; + $this->data['params'] = $params; + $this->data['_title'] = '云信虚拟号管理'; + $this->show_view('sys/yx/lists', true); + } + + public function get() + { + $id = $this->input->get('id'); + $row = []; + $url = 'add'; + if ($id) { + $row = $this->sys_yx_mobiles_model->get(['id' => $id]); + $url = 'edit'; + } + $this->data['url'] = $url; + $this->data['row'] = $row; + $this->show_view('sys/yx/edit'); + } + + + public function add() + { + $input = $this->input->post(); + if (!$input['mobile'] || !mobile_valid($input['mobile'])) { + return $this->show_json(SYS_CODE_FAIL, '请输入正确手机号'); + } + if (!$input['city_id']) { + return $this->show_json(SYS_CODE_FAIL, '请选择城市'); + } + $add = [ + 'mobile' => $input['mobile'], + 'province_id' => $input['province_id'], + 'city_id' => $input['city_id'], + 'c_time' => time(), + ]; + $re = $this->sys_yx_mobiles_model->add($add); + if ($re) { + return $this->show_json(SYS_CODE_SUCCESS, '添加成功'); + } else { + return $this->show_json(SYS_CODE_FAIL, '添加失败'); + } + } + + public function edit() + { + $input = $this->input->post(); + $row = $this->sys_yx_mobiles_model->get(['id' => $input['id']]); + if (!$row) { + return $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + if (!$input['mobile'] || !mobile_valid($input['mobile'])) { + return $this->show_json(SYS_CODE_FAIL, '请输入正确手机号'); + } + if (!$input['city_id']) { + return $this->show_json(SYS_CODE_FAIL, '请选择城市'); + } + $data = [ + 'mobile' => $input['mobile'], + 'province_id' => $input['province_id'], + 'city_id' => $input['city_id'], + ]; + $re = $this->sys_yx_mobiles_model->update($data, ['id' => $row['id']]); + if ($re) { + return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); + } else { + return $this->show_json(SYS_CODE_FAIL, '保存失败'); + } + } + + public function batch() + { + + } + + public function export() + { + + } + + public function del() + { + + } + + /** + * 修改状态 + * @return bool + */ + public function edit_status() + { + $id = $this->input->post('id'); + if (!$id) { + return $this->show_json(SYS_CODE_FAIL, '提交失败'); + } + $status = $this->input->post('status'); + $update['status'] = $status; + $re = $this->sys_yx_mobiles_model->update($update, array('id' => $id)); + if ($re) { + return $this->show_json(SYS_CODE_SUCCESS, '操作成功'); + } else { + return $this->show_json(SYS_CODE_FAIL, '操作失败'); + } + } + + public function edit_admin() + { + $id = $this->input->post_get('id'); + $row = $this->sys_yx_mobiles_model->get(['id' => $id]); + if (!$row) { + return $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + if ($this->input->method() == 'post') { + $admin_id = (int)$this->input->post('admin_id'); + $re = $this->sys_yx_mobiles_model->update(['admin_id' => $admin_id], array('id' => $id)); + if ($re) { + return $this->show_json(SYS_CODE_SUCCESS, '操作成功'); + } else { + return $this->show_json(SYS_CODE_FAIL, '操作失败'); + } + } else { + $where = [ + 'status' => 1, + "id not in (select admin_id from lc_sys_yx_mobiles where status>=0 and admin_id>0 and admin_id!={$row['admin_id']})" => null + ]; + $adminLists = $this->sys_admin_model->select($where, 'id desc', 0, 0, 'id,username,mobile'); + $this->data['adminLists'] = $adminLists; + $this->data['row'] = $row; + $this->show_view('sys/yx/edit_admin'); + } + } +} diff --git a/admin/views/sys/yx/edit.php b/admin/views/sys/yx/edit.php new file mode 100644 index 00000000..baa8b5cb --- /dev/null +++ b/admin/views/sys/yx/edit.php @@ -0,0 +1,113 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+
+ diff --git a/admin/views/sys/yx/edit_admin.php b/admin/views/sys/yx/edit_admin.php new file mode 100644 index 00000000..fd46cc11 --- /dev/null +++ b/admin/views/sys/yx/edit_admin.php @@ -0,0 +1,31 @@ +
+ +
+ +
+ +
+
+
+ +
+
+ diff --git a/admin/views/sys/yx/lists.php b/admin/views/sys/yx/lists.php new file mode 100644 index 00000000..97bf4ec6 --- /dev/null +++ b/admin/views/sys/yx/lists.php @@ -0,0 +1,92 @@ +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
ID手机号城市绑定管理员状态操作
{{value.id}}{{value.mobile}}{{value.province_name}}-{{value.city_name}}{{value.admin_name}}{{ value.status==1 ? '正常': '禁用'}} + 禁用 + 启用 + 修改 + {{value.admin_id>0 ? '修改绑定管理员' :'绑定管理员'}} +
+
+
+
+
+ data['pager']); ?> +
+
+ diff --git a/api/controllers/plan/Yxcall.php b/api/controllers/plan/Yxcall.php index 0301b97f..fc4bc495 100644 --- a/api/controllers/plan/Yxcall.php +++ b/api/controllers/plan/Yxcall.php @@ -48,6 +48,7 @@ class Yxcall extends HD_Controller 'uname' => $admin['username'] ? $admin['username'] : '', 'type' => 2,//类型 0 普通 1短信 2电话 'log' => $row['id'], + 'cf_platform' => 'admin', 'c_time' => time() ); if ($row['cf_title'] == 'clues') {//线索拨打电话回调 diff --git a/common/models/sys/Sys_yx_mobiles_model.php b/common/models/sys/Sys_yx_mobiles_model.php new file mode 100644 index 00000000..cadca89b --- /dev/null +++ b/common/models/sys/Sys_yx_mobiles_model.php @@ -0,0 +1,13 @@ +table_name, 'default'); + } +}