From 7a040ad69cc9c076876b60be778a527ae733f65b Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Fri, 19 Nov 2021 10:33:40 +0800 Subject: [PATCH] add-srv-company --- admin/controllers/biz/store/Store.php | 2 ++ admin/views/biz/store/edit.php | 11 ++++++++++- api/controllers/wxapp/licheb/Protocol.php | 12 +++++++++-- common/libraries/receiver/Orders_entity.php | 22 ++++++++++++++------- sql/biz.sql | 1 + 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/admin/controllers/biz/store/Store.php b/admin/controllers/biz/store/Store.php index c1e5e3ab..4b4859f9 100755 --- a/admin/controllers/biz/store/Store.php +++ b/admin/controllers/biz/store/Store.php @@ -255,6 +255,7 @@ class Store extends HD_Controller $biz['lng'] = $this->input->post('lng', true); $biz['type'] = intval($this->input->post('type', true)); $biz['company_id'] = intval($this->input->post('company_id', true)); + $biz['srv_company_id'] = intval($this->input->post('srv_company_id', true)); $auto_brands = $this->input->post('auto_brands'); if ($auto_brands) { @@ -321,6 +322,7 @@ class Store extends HD_Controller $biz['lng'] = $this->input->post('lng', true); $biz['type'] = intval($this->input->post('type', true)); $biz['company_id'] = intval($this->input->post('company_id', true)); + $biz['srv_company_id'] = intval($this->input->post('srv_company_id', true)); //上传头像 $biz['headimg'] = $this->input->post('headimg'); diff --git a/admin/views/biz/store/edit.php b/admin/views/biz/store/edit.php index 3b562e34..6ca901b4 100755 --- a/admin/views/biz/store/edit.php +++ b/admin/views/biz/store/edit.php @@ -274,7 +274,7 @@
- +
+
+ +
+ +
+
diff --git a/api/controllers/wxapp/licheb/Protocol.php b/api/controllers/wxapp/licheb/Protocol.php index 234d030c..7b285576 100644 --- a/api/controllers/wxapp/licheb/Protocol.php +++ b/api/controllers/wxapp/licheb/Protocol.php @@ -99,7 +99,11 @@ class Protocol extends CI_Controller{ $money_json = json_decode($row['money_json'],true); //获取门店信息 $biz = $this->biz_model->get(['id'=>$row['biz_id']]); - $row['company'] = $this->sys_company_model->get(["title like '%服务%'"=>null,'status'=>1]); + if($biz['srv_company_id']){ + $row['company'] = $this->sys_company_model->get(['id'=>$biz['srv_company_id']]); + }else{ + $row['company'] = $this->sys_company_model->get(["title like '%服务%'"=>null,'status'=>1]); + } $is_insure = false; if($row['srv_ids']){ $money_json = json_decode($row['money_json'],true); @@ -327,7 +331,11 @@ class Protocol extends CI_Controller{ $money_json = json_decode($row['money_json'],true); //获取门店信息 $biz = $this->biz_model->get(['id'=>$row['biz_id']]); - $row['company'] = $this->sys_company_model->get(["title like '%服务%'"=>null,'status'=>1]); + if($biz['srv_company_id']){ + $row['company'] = $this->sys_company_model->get(['id'=>$biz['srv_company_id']]); + }else{ + $row['company'] = $this->sys_company_model->get(["title like '%服务%'"=>null,'status'=>1]); + } if($row['srv_ids']){ $service_rows = $this->services_model->select(["id in ({$row['srv_ids']})"=>null],'','','','title'); $services = implode(',',array_column($service_rows,'title')); diff --git a/common/libraries/receiver/Orders_entity.php b/common/libraries/receiver/Orders_entity.php index 2a566f8f..f798001c 100644 --- a/common/libraries/receiver/Orders_entity.php +++ b/common/libraries/receiver/Orders_entity.php @@ -97,13 +97,17 @@ class Orders_entity{ if($need_pay_money > 0 && !$deposit_count){ $this->ci->signs_model->update(['status'=>1],['o_id'=>$this->order_row['id']]); $srv_money = $this->order_srv_money($oid); + //获取门店信息 + $biz = $this->ci->biz_model->get(['id'=>$this->order_row['biz_id']],'company_id,srv_company_id'); if($srv_money < $this->order_row['deposit']){ //服务费小于定金 给销售公司 - //获取门店信息 - $biz = $this->ci->biz_model->get(['id'=>$this->order_row['biz_id']],'company_id'); $company = $this->ci->sys_company_model->get(['id'=>$biz['company_id']],'wx_mchid'); $mch_id = $company['wx_mchid']; }else{ $mch_id = self::SRV_MCH_ID; + if($biz['srv_company_id']){ + $company = $this->ci->sys_company_model->get(['id'=>$biz['srv_company_id']],'wx_mchid'); + $company['wx_mchid'] && $mch_id = $company['wx_mchid']; + } } $p_row = $this->ci->app_liche_orders_model->get(['o_id'=>$this->order_row['id'],'uid'=>$userinfo['id'],'pid'=>0,'status>='=>0]); if(!$p_row){ @@ -373,8 +377,9 @@ class Orders_entity{ $jsondata['cover'] = $color['jsondata']['img']; } //获取门店信息 - $biz = $this->ci->biz_model->get(['id'=>$this->order_row['biz_id']],'company_id'); + $biz = $this->ci->biz_model->get(['id'=>$this->order_row['biz_id']],'company_id,srv_company_id'); $company = $this->ci->sys_company_model->get(['id'=>$biz['company_id']]); + $srv_company = $this->ci->sys_company_model->get(['id'=>$biz['srv_company_id']]); $srv_money = $this->order_srv_money($oid); //服务费 $money_json = json_decode($this->order_row['money_json'],true); @@ -408,7 +413,7 @@ class Orders_entity{ 'o_id' => $this->order_row['id'], 'uid' => $userinfo['id'], 'sid' => $sid, - 'mch_id' => self::SRV_MCH_ID, + 'mch_id' => $srv_company ? $srv_company['wx_mchid'] : self::SRV_MCH_ID, 'pid' => $p_row['id'], 'brand_id' => $this->order_row['brand_id'], 's_id' => $this->order_row['s_id'], @@ -475,13 +480,17 @@ class Orders_entity{ $sub_row = $this->ci->app_liche_orders_model->get(['o_id'=>$this->order_row['id'],'uid'=>$userinfo['id'],'type'=>4,'status>='=>0]); if($pid && !$sub_row){ $srv_money = $this->order_srv_money($oid); + //获取门店信息 + $biz = $this->ci->biz_model->get(['id'=>$this->order_row['biz_id']],'company_id,srv_company_id'); if($srv_money < $this->order_row['deposit']){ //服务费小于定金 给销售公司 - //获取门店信息 - $biz = $this->ci->biz_model->get(['id'=>$this->order_row['biz_id']],'company_id'); $company = $this->ci->sys_company_model->get(['id'=>$biz['company_id']],'wx_mchid'); $mch_id = $company['wx_mchid']; }else{ $mch_id = self::SRV_MCH_ID; + if($biz['srv_company_id']){ + $company = $this->ci->sys_company_model->get(['id'=>$biz['srv_company_id']],'wx_mchid'); + $company['wx_mchid'] && $mch_id = $company['wx_mchid']; + } } $sid = create_order_no(350200,'liche',1,4); $sub_data = [ @@ -514,7 +523,6 @@ class Orders_entity{ 2 => '需要提醒客户去狸车小程序确认车辆并签名', 3 => '需要上传客户身份证/营业执照', 4 => '整理上牌资料、国补资料发给客服', - //5 => '客户提完车,需要点击“确认交付”' 5 => '要交接车时,需要点击“确认交付”后让客户去狸车小程序签交接表完成交接' ]; return $config[$status] ? $config[$status] : ''; diff --git a/sql/biz.sql b/sql/biz.sql index 2d139154..893f4f95 100644 --- a/sql/biz.sql +++ b/sql/biz.sql @@ -30,6 +30,7 @@ create table lc_biz ( alter table lc_biz add column type tinyint(1) not null default 0 comment '类型:1-合伙店,2-加盟店,3-代理店' after floor; alter table lc_biz add column company_id int not null default 0 comment '公司ID' after type; alter table lc_biz add column jsondata json null comment '其他数据' after company_id; +alter table lc_biz add srv_company_id int(11) not null default 0 comment '收服务费公司ID' after company_id; -- ---------------------------- -- Title:品牌表