Customer_726
This commit is contained in:
@@ -55,12 +55,12 @@ class Customer extends HD_Controller
|
||||
if ($_SESSION['admin_info']['biz_id']) {
|
||||
$biz_ids = implode(',', $_SESSION['admin_info']['biz_id']);
|
||||
if ($params['biz_type']) {
|
||||
$where["biz_id in(select id from lc_biz where type={$params['biz_type']} and status=1 and id in({$biz_ids}))"] = null;
|
||||
$where["biz_id in(select id from lc_biz where type={$params['biz_type']} and id in({$biz_ids}))"] = null;
|
||||
} else {
|
||||
$where["biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
} else if ($params['biz_type']) {
|
||||
$where["biz_id in(select id from lc_biz where type={$params['biz_type']} and status=1)"] = null;
|
||||
$where["biz_id in(select id from lc_biz where type={$params['biz_type']})"] = null;
|
||||
}
|
||||
if (false == strpos($_SERVER['HTTP_HOST'], 'dev')) {//dev时不限制
|
||||
$where['biz_id<>'] = 1;
|
||||
@@ -101,56 +101,6 @@ class Customer extends HD_Controller
|
||||
!$params['county_id_admin'] && $params['county_id_admin'] = '';
|
||||
!$params['biz_id_admin'] && $params['biz_id_admin'] = '';
|
||||
!$params['admin_id'] && $params['admin_id'] = '';
|
||||
// if ($params['admin_id']) {
|
||||
// $where['admin_id'] = $params['admin_id'];
|
||||
// } else {
|
||||
// $where_lcb = array();
|
||||
// $str_ids = '';
|
||||
// if ($params['biz_id_admin']) {//指定店铺所有销售员
|
||||
// $where_lcb['biz_id'] = $params['biz_id_admin'];
|
||||
// $str_ids = $params['biz_id_admin'];
|
||||
// } else {
|
||||
// //指定城市的所有销售员
|
||||
// $where_biz = array();
|
||||
// if ($params['county_id_admin']) {
|
||||
// $where_biz['county_id'] = $params['county_id_admin'];
|
||||
// } else if ($params['city_id_admin']) {
|
||||
// $where_biz['city_id'] = $params['city_id_admin'];
|
||||
// }
|
||||
// if ($where_biz) {
|
||||
// $where_biz['status>-1'] = null;
|
||||
// $rows_biz = $this->biz_model->select($where_biz, 'id desc', 0, 0, 'id');
|
||||
// if ($rows_biz) {
|
||||
// $str_ids = implode(',', array_column($rows_biz, 'id'));
|
||||
// $where_lcb["biz_id in({$str_ids})"] = null;
|
||||
// } else {
|
||||
// $where_lcb['biz_id'] = -1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //获取目标销售员列表
|
||||
// if ($where_lcb) {
|
||||
// $params['city_id_admin'] && $where['city_id'] = $params['city_id_admin'];
|
||||
// $params['county_id_admin'] && $where['county_id'] = $params['county_id_admin'];
|
||||
// $params['biz_id_admin'] && $where['biz_id'] = $params['biz_id_admin'];
|
||||
//
|
||||
// $where_lcb['status>-1'] = null;
|
||||
// $rows_lcb = $this->app_licheb_users_model->select($where_lcb, 'id desc', 0, 0, 'id');
|
||||
// if ($rows_lcb) {
|
||||
// $str_ids = implode(',', array_column($rows_lcb, 'id'));
|
||||
// $str_ids = $str_ids . ',0';
|
||||
// $where["admin_id in({$str_ids})"] = null;
|
||||
// } else {
|
||||
// if (!$str_ids) {
|
||||
// $where['admin_id'] = -1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// !$params['city_id_admin'] && $params['city_id_admin'] = '';
|
||||
// !$params['county_id_admin'] && $params['county_id_admin'] = '';
|
||||
// !$params['biz_id_admin'] && $params['biz_id_admin'] = '';
|
||||
// $params['admin_id'] = '';
|
||||
// }
|
||||
if ($params['c_time']) {
|
||||
$c_time = explode(' ~ ', $params['c_time']);
|
||||
$c_time[0] && $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
|
||||
|
||||
@@ -158,6 +158,7 @@ class CusorderV2 extends Wxapp{
|
||||
'v_id' => $v_id,
|
||||
'cor_id' => $color_id,
|
||||
'incor_id' => $incolor_id,
|
||||
'admin_id' => $this->session['uid'],
|
||||
'sale_id' => $this->session['uid'],
|
||||
'over_time' => $over_time,
|
||||
'c_time' => time()
|
||||
|
||||
@@ -42,7 +42,8 @@ class Employees extends Wxapp
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model', 'mdOrders');
|
||||
$count_1 = $this->mdCustomer->count(['biz_id' => $this->biz_id, 'admin_id' => $id]);
|
||||
$count_2 = $this->mdOrders->count(['biz_id' => $this->biz_id, 'sale_id' => $id]);
|
||||
$data['transfer'] = ['title' => '移交', 'list' => [['key' => 1, 'name' => "客户($count_1)"], ['key' => 2, 'name' => "订单($count_2)"]]];
|
||||
$data['transfer'] = ['title' => '移交', 'list' => [['id' => 1, 'name' => "客户($count_1)", 'checked' => false]
|
||||
, ['id' => 2, 'name' => "订单($count_2)", 'checked' => false]]];
|
||||
$where = ['status' => 1, 'id<>' => $id, 'biz_id' => $this->biz_id];
|
||||
$res = $this->app_user_model->select($where, 'id desc', 0, 0, 'id,uname as name');
|
||||
$data['adviser'] = ['title' => '顾问', 'list' => $res ? $res : []];
|
||||
@@ -59,22 +60,27 @@ class Employees extends Wxapp
|
||||
{
|
||||
$out_id = $this->input_param('out_id');
|
||||
$in_id = $this->input_param('in_id');
|
||||
$keys = $this->input_param('keys');
|
||||
if (!$out_id || $in_id) {
|
||||
$transfer = $this->input_param('transfer');
|
||||
if (!$out_id || $in_id || !$transfer) {
|
||||
throw new Exception('参数错误', ERR_PARAMS_ERROR);
|
||||
}
|
||||
if (!$keys) {
|
||||
throw new Exception('请选择移交项', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomer');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model', 'mdOrders');
|
||||
foreach ($keys as $k) {
|
||||
if ($k == 1) {//移交客户
|
||||
$if_transfer = false;
|
||||
foreach ($transfer['list'] as $k => $v) {
|
||||
if ($v['id'] == 1 && $v['checked'] == true) {//移交客户
|
||||
$this->mdCustomer->update(['admin_id' => $in_id], ['biz_id' => $this->biz_id, 'admin_id' => $out_id]);
|
||||
} else if ($k == 2) {//移交订单
|
||||
$if_transfer = true;
|
||||
} else if ($v['id'] == 2 && $v['checked'] == true) {//移交订单
|
||||
$this->mdOrders->update(['admin_id' => $in_id], ['biz_id' => $this->biz_id, 'admin_id' => $out_id]);
|
||||
$if_transfer = true;
|
||||
}
|
||||
}
|
||||
if (!$if_transfer) {
|
||||
throw new Exception('请选择移交选项', ERR_PARAMS_ERROR);
|
||||
}
|
||||
//更新顾问状态暂停
|
||||
$this->app_user_model->update(['status' => 0], ['id' => $out_id]);
|
||||
throw new Exception('操作成功', API_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user