diff --git a/admin/controllers/Common.php b/admin/controllers/Common.php index daaf0a9e..e54676f3 100644 --- a/admin/controllers/Common.php +++ b/admin/controllers/Common.php @@ -404,6 +404,8 @@ class Common extends CI_Controller $size = $this->input->post('size') ? intval($this->input->post('size')) : 10; $type = $this->input->post('type'); $brand_id = intval($this->input->post('brand_id')); + $city_id = intval($this->input->post('city_id')); + $county_id = intval($this->input->post('county_id')); $use_shop_list = $this->input->post('use_shop_list'); $sys_cate_id = intval($this->input->post('sys_cate_id')); @@ -418,14 +420,13 @@ class Common extends CI_Controller $where['status'] = 1; $sys_cate_id && $where['cate_id'] = $sys_cate_id; $biz_name && $where['biz_name like "%' . $biz_name . '%"'] = null; - $brand_id && $where['hd_biz.brand_id'] = $brand_id; - $ids && $where['hd_biz.id not in (' . $ids . ')'] = null; - if ($type == 'jdb') { - $this->load->model('app/jdb/receiver_orders_model', 'mdReceiverOrders'); - } - $count = $this->mdBiz->selectBiz($where, '', '', '', 1, $type); + $brand_id && $where['brand_id'] = $brand_id; + $city_id && $where['city_id'] = $city_id; + $county_id && $where['county_id'] = $county_id; + $ids && $where['id not in (' . $ids . ')'] = null; + $count = $this->mdBiz->count($where); if ($count) { - $resBiz = $this->mdBiz->selectBiz($where, 'hd_biz.id desc', $page, $size, 0, $type); + $resBiz = $this->mdBiz->select($where, 'id desc', $page, $size); foreach ($resBiz as $key => $value) { $setValue = array(); $setValue['id'] = $value['id']; @@ -435,13 +436,6 @@ class Common extends CI_Controller $setValue['sort'] = $key; $setValue['is_checked'] = $shopChecked[$value['id']] ? 1 : 0; $setValue['brand_id'] = $value['brand_id']; - if ($type == 'jdb') { - $firstDay = date('Y-m-01', strtotime(date("Y-m-d"))) . ' 00:00:00'; - $lastDay = date('Y-m-d', strtotime("$firstDay +1 month -1 day")) . ' 23:59:59'; - $setValue['orders_month'] = $this->mdReceiverOrders->count(array("c_time >=" => strtotime($firstDay) - , "c_time <=" => strtotime($lastDay), 'biz_id' => $value['id'])); - $setValue['orders'] = $this->mdReceiverOrders->count(array('biz_id' => $value['id'])); - } $shopList[] = $setValue; } } diff --git a/admin/controllers/app/licheb/Member.php b/admin/controllers/app/licheb/Member.php index ffb68451..da7e5429 100755 --- a/admin/controllers/app/licheb/Member.php +++ b/admin/controllers/app/licheb/Member.php @@ -4,7 +4,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class Member extends HD_Controller{ - private $groups = [1=>'销售',2=>'店长',3=>'老板']; + private $groups = [1=>'销售',2=>'店长',3=>'老板',4=>'渠道经理']; public function __construct() { @@ -46,8 +46,16 @@ class Member extends HD_Controller{ $count = $this->userM->count($where); $lists = $this->userM->select($where,'id desc',$page,$size); foreach($lists as $key=>$val){ - $biz = $this->biz_model->get(['id'=>$val['biz_id']],'biz_name'); - $lists[$key]['biz_name'] = $biz['biz_name']; + $bizs = []; + $biz_id_arr = explode(',',$val['biz_id']); + if($biz_id_arr){ + $ids = implode(',',$biz_id_arr); + $b_where = [ + "id in ($ids)" => null + ]; + $bizs = $this->biz_model->select($b_where,'',0,0,'biz_name'); + } + $lists[$key]['bizs'] = $bizs; $lists[$key]['group_name'] = $this->groups[$val['group_id']]; if(SUPER_ADMIN == $this->role){//超级管理员才允许操作用户的披上超级马甲 @@ -74,6 +82,7 @@ class Member extends HD_Controller{ { $id = $this->input->get('id'); $row = $this->userM->get(['id'=>$id]); + $selectedBrands = []; if($id){ $info = array( 'id' => $row['id'], @@ -81,19 +90,30 @@ class Member extends HD_Controller{ 'mobile' => $row['mobile'], 'group_id' => $row['group_id'], 'biz_id' => $row['biz_id'], + 'city_id' => 0, + 'county_id' => 0 ); + $biz_id_arr = explode(',',$row['biz_id']); + if($biz_id_arr){ + $ids = implode(',',$biz_id_arr); + $where = [ + "id in ($ids)" => null + ]; + $selectedBrands = $this->biz_model->select($where,'',0,0,'id as biz_id,biz_name as name'); + } $action = '/app/licheb/member/edit'; $_title = '编辑用户'; } else { - $info = array('biz_id' => '', 'group_id' => ''); + $info = array('biz_id' => '', 'group_id' => '','city_id'=>0,'county_id'=>0); $action = '/app/licheb/member/add'; $_title = '添加用户'; } + $this->data['selectedBrands'] = $selectedBrands; $this->data['info'] = $info; $this->data['groups'] = $this->groups; $this->data['action'] = $action; $this->data['_title'] = $_title; - return $this->show_view('app/licheb/member/get'); + return $this->show_view('app/licheb/member/get',true); } //添加单条数据 @@ -102,7 +122,8 @@ class Member extends HD_Controller{ $uname = $info['uname']; $mobile = $info['mobile']; $group_id = $info['group_id']; - $biz_id = $info['biz_id']; + $bizs = $info['bizs']; + $biz_id_arr = array_column($bizs,'biz_id'); if (!mobile_valid($mobile)) { return $this->show_json(SYS_CODE_FAIL, '输入正确手机号'); @@ -123,7 +144,7 @@ class Member extends HD_Controller{ 'c_time' => time(), ); $group_id && $add['group_id'] = $group_id; - $biz_id && $add['biz_id'] = $biz_id; + $biz_id_arr && $add['biz_id'] = implode(',',$biz_id_arr); $id = $this->userM->add($add); return $this->show_json(SYS_CODE_SUCCESS, '操作成功', '/app/licheb/member'); @@ -138,7 +159,8 @@ class Member extends HD_Controller{ $nickname = $info['nickname']; $mobile = $info['mobile']; $group_id = $info['group_id']; - $biz_id = $info['biz_id']; + $bizs = $info['bizs']; + $biz_id_arr = array_column($bizs,'biz_id'); if (!mobile_valid($mobile)) { return $this->show_json(SYS_CODE_FAIL, '输入正确手机号'); @@ -154,7 +176,7 @@ class Member extends HD_Controller{ ); $upd['group_id'] = $group_id ? $group_id : 0; - $upd['biz_id'] = $biz_id ? $biz_id : 0; + $upd['biz_id'] = $biz_id_arr ? implode(',',$biz_id_arr) : 0; $nickname && $upd['nickname'] = $nickname; $uname && $upd['uname'] = $uname; diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 627a0dad..f24ccb7a 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -355,5 +355,35 @@ class Customer extends HD_Controller } return $id; } + //更新晓致电话数据 + public function get_update_xz(){ + $page = $this->input->get('page'); + $size = $this->input->get('size'); + $lk = $this->input->get('lk'); + !$page && $page = 1; + !$size && $size = 10; + $where = [ + 'cf_title' => 'customer', + 'cf_platform' => 'api', + 'status' => 1 + ]; + if($lk){ + $rows = $this->receiver_xz_model->select($where,'id desc',$page,$size,'id,biz_id'); + print_r($rows);exit; + } + $total = $this->receiver_xz_model->count($where); + $rows = $this->receiver_xz_model->select($where,'id desc',$page,$size,'id,cf_id'); + if($rows){ + foreach($rows as $key => $val){ + $row = $this->customers_model->get(['id'=>$val['cf_id']],'biz_id'); + if($row){ + $this->receiver_xz_model->update(['biz_id'=>$row['biz_id']],['id'=>$val['id']]); + } + } + echo "total:{$total},剩余:".($total-$page*$size); + }else{ + echo "finish"; + } + } } diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php index 74be4a0f..dc624e3a 100644 --- a/admin/controllers/receiver/Orders.php +++ b/admin/controllers/receiver/Orders.php @@ -410,54 +410,4 @@ class Orders extends HD_Controller{ return $this->show_json(SYS_CODE_SUCCESS,'保存成功'); } - //更新金额至json - public function get_update_money(){ - $page = $this->input->get('page'); - $size = $this->input->get('size'); - $lk = $this->input->get('lk'); - !$page && $page = 1; - !$size && $size = 10; - $where = []; - if($lk){ - $rows = $this->orders_model->select($where,'id desc',$page,$size,'id,money_json'); - print_r($rows);exit; - } - $rows = $this->orders_model->select($where,'id desc',$page,$size); - if($rows){ - $this->load->model('auto/auto_cars_model'); - $this->load->model("biz/biz_model"); - $this->load->model('sys/sys_city_model'); - foreach($rows as $key => $val){ - $car_row = $this->auto_cars_model->get(['brand_id'=>$val['brand_id'],'s_id'=>$val['s_id'],'v_id'=>$val['v_id'],'cor_id'=>$val['cor_id'],'incor_id'=>$val['incor_id']]); - //获取金额json数据 - $money_json = [ - 'price_car' => $car_row['price_car'], - 'price_book' => $car_row['price_book'], - 'price_insure' => $car_row['price_insure'], - 'price_fine' => $car_row['price_fine'], - ]; - //获取挂牌价 - if($val['brand_id']==3){ //狸车品牌写死挂牌费用0.01 测试用 - $money_json['fee_carno'] = 0.01; - }else{ - $biz = $this->biz_model->get(['id'=>$val['biz_id']],'company_id,city_id'); - $city = $this->sys_city_model->get(['city_id'=>$biz['city_id']],'fee_carno'); - $money_json['fee_carno'] = $city['fee_carno']; - } - - if(!$val['payway']){ //分期 - $money_json['price_finance'] = $car_row['price_finance']; - $money_json['first_pay'] = $car_row['first_pay']; - $money_json['month_pay'] = $car_row['month_pay']; - } - $update = [ - 'money_json' => json_encode($money_json,JSON_UNESCAPED_UNICODE) - ]; - $this->orders_model->update($update,['id'=>$val['id']]); - } - echo "do f"; - }else{ - echo "finish"; - } - } } diff --git a/admin/views/app/licheb/member/get.php b/admin/views/app/licheb/member/get.php index 3a0b942b..f54557f6 100755 --- a/admin/views/app/licheb/member/get.php +++ b/admin/views/app/licheb/member/get.php @@ -15,7 +15,7 @@
- @@ -23,31 +23,94 @@
-
- -
-
- -
-
- +
+ +
+ +
+