From 25ada26f3c3166370df093b04d3a03943801ccd8 Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Fri, 7 Jan 2022 16:58:46 +0800 Subject: [PATCH] edit-liche-roboot --- common/libraries/Qyrobot.php | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/common/libraries/Qyrobot.php b/common/libraries/Qyrobot.php index 847fa010..09cdad9f 100644 --- a/common/libraries/Qyrobot.php +++ b/common/libraries/Qyrobot.php @@ -26,12 +26,14 @@ class Qyrobot{ public function deposit_notify($oid){ $this->ci->load->model('receiver/order/receiver_orders_model'); $this->ci->load->model("biz/biz_model"); + $this->ci->load->model('area_model'); $this->ci->load->model('auto/auto_brand_model'); $this->ci->load->model('auto/auto_series_model'); $this->ci->load->model('app/liche/app_liche_orders_model'); $this->ci->load->model('app/liche/app_liche_orders_model'); $this->ci->load->model('app/licheb/app_licheb_users_model'); + $this->ci->load->model('app/licheb/app_licheb_channel_biz_model'); $order_row = $this->ci->receiver_orders_model->get(['id'=>$oid]); if(!$order_row){ @@ -39,21 +41,23 @@ class Qyrobot{ } $biz_row = $this->ci->biz_model->get(['id'=>$order_row['biz_id']]); if($biz_row['type']==3){ - $where = [ - 'group_id' => 4, - 'status' => 1, - "biz_id like '%{$biz_row['id']}%'" => null - ]; - $users = $this->ci->app_licheb_users_model->select($where,'id desc',1,10,'uname,biz_id'); //渠道经理 - $user_info = ''; - if($users){ - foreach($users as $key=>$val){ - $biz_id_arr = explode(',',$val['biz_id']); - if(!in_array($biz_row['id'],$biz_id_arr)){ - unset($users[$key]); - } + $channel_users = $this->ci->app_licheb_channel_biz_model->select(['biz_id'=>$biz_row['id']],'','','','uid'); + $user_ids = array_column($channel_users,'uid'); + $user_ids_str = implode(',',$user_ids); + if($user_ids_str && $user_ids){ + $where = [ + 'group_id' => 4, + 'status' => 1, + "id in ($user_ids_str)" => null + ]; + $users = $this->ci->app_licheb_users_model->select($where,'id desc',1,10,'uname,biz_id'); //渠道经理 + $user_info = ''; + if($users){ + $user_info = implode(' ',array_column($users,'uname')); + }else{ //获取城市 + $city_row = $this->ci->area_model->get(['city_id'=>$biz_row['city_id']]); + $user_info = $city_row['city_name']; } - $user_info = implode(' ',array_column($users,'uname')); } $biz_info = "{$user_info}渠道 {$biz_row['biz_name']}"; }else{