diff --git a/app/api/controller/Index.php b/app/api/controller/Index.php index 7c1f975..aef89bb 100644 --- a/app/api/controller/Index.php +++ b/app/api/controller/Index.php @@ -439,8 +439,10 @@ class Index extends BaseController add_log('check', $param['id'], $param); //发送消息通知 $msg=[ - 'create_time'=>time(), - 'action_id'=>$id + 'create_time'=>date('Y-m-d H:i:s',$detail['create_time']), + 'action_id'=>$id, + 'title' => Db::name('FlowType')->where('id',$checkData['type'])->value('title'), + 'from_uid'=>$detail['admin_id'] ]; if($param['check_status'] == 1){ $users = $param['check_admin_ids']; @@ -514,7 +516,9 @@ class Index extends BaseController //发送消息通知 $msg=[ 'create_time'=>date('Y-m-d H:i:s',$detail['create_time']), - 'action_id'=>$detail['id'] + 'action_id'=>$detail['id'], + 'title' => Db::name('FlowType')->where('id',$checkData['type'])->value('title'), + 'from_uid'=>$detail['admin_id'] ]; $users = $detail['admin_id']; sendMessage($users,($type*10+13),$msg); diff --git a/app/common.php b/app/common.php index 9d0d82d..414eb6e 100644 --- a/app/common.php +++ b/app/common.php @@ -508,7 +508,7 @@ function sendMessage($user_id, $template, $data=[]) $title = str_replace('{' . $key . '}', $val, $title); $content = str_replace('{' . $key . '}', $val, $content); } - if(isSet($data['from_uid'])){ + if(isset($data['from_uid'])){ $title = str_replace('{from_user}', get_admin($data['from_uid'])['name'], $title); $content = str_replace('{from_user}', get_admin($data['from_uid'])['name'], $content); } diff --git a/app/customer/controller/Api.php b/app/customer/controller/Api.php index 76a84ea..dc77f83 100644 --- a/app/customer/controller/Api.php +++ b/app/customer/controller/Api.php @@ -33,7 +33,7 @@ class Api extends BaseController $data['belong_did'] = $params['did']; $data['distribute_time'] = time(); if (Db::name('Customer')->update($data) !== false) { - add_log('allot', $data['id']); + add_log('allot', $data['id'],[],'客户'); to_log($this->uid,0,$data,['belong_uid'=>0]); return to_assign(0, "操作成功"); } else { @@ -44,75 +44,6 @@ class Api extends BaseController } } - //删除客户 - public function delete() - { - if (request()->isDelete()) { - $params = get_params(); - //是否是客户管理员 - $auth = isAuth($this->uid,'customer_admin'); - if($auth==0){ - return to_assign(1, "只有客户管理员才有权限操作"); - } - $data['id'] = $params['id']; - $log_data = array( - 'field' => 'del', - 'action' => 'delete', - 'type' => 0, - 'customer_id' => $params['id'], - 'admin_id' => $this->uid, - 'create_time' => time(), - ); - if($params['type'] ==1){ - $data['delete_time'] = time(); - $log_data['action'] = 'totrash'; - } - else{ - $data['delete_time'] = -1; - } - if (Db::name('Customer')->update($data) !== false) { - add_log('delete', $params['id'],[],'客户'); - Db::name('CustomerLog')->strict(false)->field(true)->insert($log_data); - return to_assign(); - } else { - return to_assign(1, "操作失败"); - } - } else { - return to_assign(1, "错误的请求"); - } - } - //还原客户 - public function revert() - { - if (request()->isAjax()) { - $params = get_params(); - //是否是客户管理员 - $auth = isAuth($this->uid,'customer_admin'); - if($auth==0){ - return to_assign(1, "只有客户管理员才有权限操作"); - } - $data['id'] = $params['id']; - $data['delete_time'] = 0; - if (Db::name('Customer')->update($data) !== false) { - add_log('recovery', $params['id'],[],'客户'); - $log_data = array( - 'field' => 'del', - 'action' => 'recovery', - 'type' => 0, - 'customer_id' => $params['id'], - 'admin_id' => $this->uid, - 'create_time' => time(), - ); - Db::name('CustomerLog')->strict(false)->field(true)->insert($log_data); - return to_assign(); - } else { - return to_assign(1, "操作失败"); - } - } else { - return to_assign(1, "错误的请求"); - } - } - //跟进记录列表 public function get_trace() { @@ -154,7 +85,7 @@ class Api extends BaseController } $res = CustomerTrace::strict(false)->field(true)->update($param); if ($res) { - add_log('edit', $param['id'], $param); + add_log('edit', $param['id'], $param,'客户跟进记录'); to_log($this->uid,1,$param,$old); return to_assign(); } else { @@ -165,7 +96,7 @@ class Api extends BaseController $param['admin_id'] = $this->uid; $tid = CustomerTrace::strict(false)->field(true)->insertGetId($param); if ($tid) { - add_log('add', $tid, $param); + add_log('add', $tid, $param,'客户跟进记录'); $log_data = array( 'field' => 'new', 'action' => 'add', @@ -220,7 +151,7 @@ class Api extends BaseController $param['delete_time'] = time(); $res = CustomerTrace::strict(false)->field(true)->update($param); if ($res) { - add_log('edit', $param['id'], $param); + add_log('delete', $param['id'], $param,'客户跟进记录'); to_log($this->uid,1,$param,['delete_time'=>0]); return to_assign(); } else { @@ -273,7 +204,7 @@ class Api extends BaseController } $res = CustomerChance::strict(false)->field(true)->update($param); if ($res) { - add_log('edit', $param['id'], $param); + add_log('edit', $param['id'], $param,'客户销售机会'); to_log($this->uid,3,$param,$old); return to_assign(); } else { @@ -284,7 +215,7 @@ class Api extends BaseController $param['admin_id'] = $this->uid; $tid = CustomerChance::strict(false)->field(true)->insertGetId($param); if ($tid) { - add_log('add', $tid, $param); + add_log('add', $tid, $param,'客户销售机会'); $log_data = array( 'field' => 'new', 'action' => 'add', @@ -339,7 +270,7 @@ class Api extends BaseController $param['delete_time'] = time(); $res = CustomerChance::strict(false)->field(true)->update($param); if ($res) { - add_log('edit', $param['id'], $param); + add_log('delete', $param['id'], $param,'客户销售机会'); to_log($this->uid,3,$param,['delete_time'=>0]); return to_assign(); } else { @@ -378,7 +309,7 @@ class Api extends BaseController CustomerContact::where(['cid' => $detail['cid']])->strict(false)->field(true)->update(['is_default'=>0]); $res = CustomerContact::where(['id' => $param['id']])->update(['is_default'=>1]); if ($res) { - add_log('edit', $param['id'], $param); + add_log('edit', $param['id'], $param,'客户联系人'); to_log($this->uid,2,$param,$detail); return to_assign(); } else { diff --git a/app/customer/controller/Index.php b/app/customer/controller/Index.php index 55b4ba6..8da3e37 100644 --- a/app/customer/controller/Index.php +++ b/app/customer/controller/Index.php @@ -416,6 +416,94 @@ class Index extends BaseController } else { return to_assign(1, "错误的请求"); } - } + } + + //客户移入废弃池 + public function to_trash() + { + if (request()->isAjax()) { + $params = get_params(); + $data['id'] = $params['id']; + $log_data = array( + 'field' => 'del', + 'action' => 'delete', + 'type' => 0, + 'customer_id' => $params['id'], + 'admin_id' => $this->uid, + 'create_time' => time(), + ); + $data['delete_time'] = time(); + $log_data['action'] = 'totrash'; + if (Db::name('Customer')->update($data) !== false) { + add_log('totrash', $params['id']); + Db::name('CustomerLog')->strict(false)->field(true)->insert($log_data); + return to_assign(); + } else { + return to_assign(1, "操作失败"); + } + } else { + return to_assign(1, "错误的请求"); + } + } + + //还原客户 + public function revert() + { + if (request()->isAjax()) { + $params = get_params(); + $data['id'] = $params['id']; + $data['delete_time'] = 0; + if (Db::name('Customer')->update($data) !== false) { + add_log('recovery', $params['id']); + $log_data = array( + 'field' => 'del', + 'action' => 'recovery', + 'type' => 0, + 'customer_id' => $params['id'], + 'admin_id' => $this->uid, + 'create_time' => time(), + ); + Db::name('CustomerLog')->strict(false)->field(true)->insert($log_data); + return to_assign(); + } else { + return to_assign(1, "操作失败"); + } + } else { + return to_assign(1, "错误的请求"); + } + } + + //彻底删除客户 + public function delete() + { + if (request()->isDelete()) { + $params = get_params(); + //是否是客户管理员 + $auth = isAuth($this->uid,'customer_admin'); + if($auth==0){ + return to_assign(1, "只有客户管理员才有权限操作"); + } + $data['id'] = $params['id']; + $data['delete_time'] = -1; + $log_data = array( + 'field' => 'del', + 'action' => 'delete', + 'type' => 0, + 'customer_id' => $params['id'], + 'admin_id' => $this->uid, + 'create_time' => time() + ); + if (Db::name('Customer')->update($data) !== false) { + add_log('delete', $params['id']); + Db::name('CustomerLog')->strict(false)->field(true)->insert($log_data); + return to_assign(); + } else { + return to_assign(1, "操作失败"); + } + } else { + return to_assign(1, "错误的请求"); + } + } + } diff --git a/app/customer/view/index/sea.html b/app/customer/view/index/sea.html index fe30e3a..dd1a5b3 100644 --- a/app/customer/view/index/sea.html +++ b/app/customer/view/index/sea.html @@ -170,7 +170,7 @@ obj.del(); } } - tool.delete("/customer/api/delete", {id: data.id,type:1}, callback); + tool.delete("/customer/index/to_trash", {id: data.id,type:1}, callback); layer.close(index); }); } diff --git a/app/customer/view/index/trash.html b/app/customer/view/index/trash.html index 1950b95..9af3cf7 100644 --- a/app/customer/view/index/trash.html +++ b/app/customer/view/index/trash.html @@ -117,7 +117,7 @@ obj.del(); } } - tool.post("/customer/api/revert", {id: data.id}, callback); + tool.post("/customer/index/revert", {id: data.id}, callback); layer.close(index); }); } @@ -132,7 +132,7 @@ obj.del(); } } - tool.delete("/customer/api/delete", {id: data.id,type:2}, callback); + tool.delete("/customer/index/delete", {id: data.id}, callback); layer.close(index); }); } diff --git a/app/finance/controller/Api.php b/app/finance/controller/Api.php index fd2fc4b..5481f1d 100644 --- a/app/finance/controller/Api.php +++ b/app/finance/controller/Api.php @@ -52,6 +52,7 @@ class Api extends BaseController $detail = Expense::where(['id' => $param['id']])->find(); $msg=[ 'create_time'=>date('Y-m-d H:i:s',(int)$detail['create_time']), + 'title'=>'报销', 'action_id'=>$detail['id'] ]; $users = $detail['admin_id']; diff --git a/app/finance/controller/Expense.php b/app/finance/controller/Expense.php index e500f7a..1d6fbe9 100644 --- a/app/finance/controller/Expense.php +++ b/app/finance/controller/Expense.php @@ -293,6 +293,7 @@ class Expense extends BaseController //发送消息通知 $msg=[ 'from_uid'=>$this->uid, + 'title'=>'报销', 'action_id'=>$param['id'] ]; $users = $param['check_admin_ids']; @@ -394,6 +395,7 @@ class Expense extends BaseController //发送消息通知 $msg=[ 'from_uid'=>$this->uid, + 'title'=>'报销', 'action_id'=>$exid ]; $users = $param['check_admin_ids']; diff --git a/app/finance/controller/Invoice.php b/app/finance/controller/Invoice.php index 286e199..70441b4 100644 --- a/app/finance/controller/Invoice.php +++ b/app/finance/controller/Invoice.php @@ -226,6 +226,7 @@ class Invoice extends BaseController //发送消息通知 $msg=[ 'from_uid'=>$this->uid, + 'title'=>'发票', 'action_id'=>$param['id'] ]; $users = $param['check_admin_ids']; @@ -306,6 +307,7 @@ class Invoice extends BaseController //发送消息通知 $msg=[ 'from_uid'=>$this->uid, + 'title'=>'发票', 'action_id'=>$exid ]; $users = $param['check_admin_ids']; diff --git a/app/home/controller/Index.php b/app/home/controller/Index.php index 16e5b30..6dd5694 100644 --- a/app/home/controller/Index.php +++ b/app/home/controller/Index.php @@ -24,7 +24,7 @@ class Index extends BaseController $invoice_map_check[] = ['', 'exp', Db::raw("FIND_IN_SET('{$admin_id}',check_admin_ids)")]; $invoice_map_check[] = ['delete_time', '=', 0]; $invoice_count_check = Db::name('Invoice')->where($invoice_map_check)->count(); - $statistics['invoice_html_check'] = ' 您有' . $invoice_count_check . '条发票申请待审核'; + $statistics['invoice_html_check'] = ' 您有' . $invoice_count_check . '条发票申请待审核'; if ($invoice_count_check == 0) { $statistics['invoice_html_check'] = ''; } @@ -34,7 +34,7 @@ class Index extends BaseController $invoice_map_open[] = ['open_admin_id', '=', $admin_id]; $invoice_map_open[] = ['delete_time', '=', 0]; $invoice_count_open = Db::name('Invoice')->where($invoice_map_open)->count(); - $statistics['invoice_html_open'] = '您有' . $invoice_count_open . '条发票待开具'; + $statistics['invoice_html_open'] = '您有' . $invoice_count_open . '条发票待开具'; if ($invoice_count_open == 0) { $statistics['invoice_html_open'] = ''; } @@ -44,7 +44,7 @@ class Index extends BaseController $expense_map_check[] = ['', 'exp', Db::raw("FIND_IN_SET('{$admin_id}',check_admin_ids)")]; $expense_map_check[] = ['delete_time', '=', 0]; $expense_count_check = Db::name('Expense')->where($expense_map_check)->count(); - $statistics['expense_html_check'] = '您有' . $expense_count_check . '条报销单待审核'; + $statistics['expense_html_check'] = '您有' . $expense_count_check . '条报销单待审核'; if ($expense_count_check == 0) { $statistics['expense_html_check'] = ''; } @@ -54,7 +54,7 @@ class Index extends BaseController $msg_map[] = ['read_time', '=', 0]; $msg_map[] = ['status', '=', 1]; $msg_count = Db::name('Message')->where($msg_map)->count(); - $statistics['msg_html'] = '您有' . $msg_count . '条未读消息'; + $statistics['msg_html'] = '您有' . $msg_count . '条未读消息'; $statistics['msg_num'] = $msg_count; if ($msg_count == 0) { $statistics['msg_html'] = ''; @@ -84,7 +84,14 @@ class Index extends BaseController \think\facade\Cache::tag('adminMenu')->set('menu' . $admin['id'], $list); } View::assign('menu', $list); - View::assign('theme', get_system_config('other','theme')); + //View::assign('theme', get_system_config('other','theme')); + $user = Db::name('Admin')->where('id',$this->uid)->find(); + if(isset($user['theme'])){ + View::assign('theme',$user['theme']); + } + else{ + View::assign('theme', 'black'); + } return View(); } } @@ -206,7 +213,8 @@ class Index extends BaseController { if (request()->isAjax()) { $param = get_params(); - set_system_config('other','theme',$param['theme']); + //set_system_config('other','theme',$param['theme']); + Db::name('Admin')->where('id',$this->uid)->update(['theme'=>$param['theme']]); return to_assign(); } else{ diff --git a/app/home/view/index/index.html b/app/home/view/index/index.html index f67914d..72ba28e 100644 --- a/app/home/view/index/index.html +++ b/app/home/view/index/index.html @@ -126,7 +126,7 @@