From 587c5c39051ddc06b09ddfcce021a4611ad46f02 Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Mon, 18 Oct 2021 21:21:28 +0800 Subject: [PATCH] edit-api company_id=1 --- api/controllers/wxapp/liche/Contract.php | 5 +- api/controllers/wxapp/liche/Pay.php | 3 + api/controllers/wxapp/licheb/Cusorder.php | 3 + api/controllers/wxapp/licheb/Protocol.php | 9 ++ common/libraries/receiver/Orders_entity.php | 158 ++------------------ 5 files changed, 28 insertions(+), 150 deletions(-) diff --git a/api/controllers/wxapp/liche/Contract.php b/api/controllers/wxapp/liche/Contract.php index 752ae1d7..bb2c8d46 100644 --- a/api/controllers/wxapp/liche/Contract.php +++ b/api/controllers/wxapp/liche/Contract.php @@ -97,7 +97,7 @@ class Contract extends Wxapp{ $img = $this->input_param('img'); $row = $this->contracts_model->get(['type'=>$type,'o_id'=>$id]); - $order = $this->orders_model->get(['id'=>$id],'biz_id,ifentrust,pack_id,info_json'); + $order = $this->orders_model->get(['id'=>$id],'brand_id,biz_id,ifentrust,pack_id,info_json'); if(!$row['file'] || !$img){ throw new Exception('参数错误', API_CODE_INVILD_PARAM); } @@ -111,6 +111,9 @@ class Contract extends Wxapp{ $company = $this->sys_company_model->get(["title like '%服务%'"=>null,'status'=>1],'img_seal,id'); }else{ $biz = $this->biz_model->get(['id'=>$order['biz_id']],'company_id'); + if($order['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司 + $biz['company_id'] = 1; + } $company = $this->sys_company_model->get(['id'=>$biz['company_id']],'img_seal,id'); } $img_seal = $company['img_seal'] ? build_qiniu_image_url($company['img_seal']) : ''; diff --git a/api/controllers/wxapp/liche/Pay.php b/api/controllers/wxapp/liche/Pay.php index e781b50a..6f939818 100644 --- a/api/controllers/wxapp/liche/Pay.php +++ b/api/controllers/wxapp/liche/Pay.php @@ -101,6 +101,9 @@ class Pay extends Wxapp{ $brand_row = $this->auto_brand_model->get(['id'=>$order_row['brand_id']],'name'); $s_row = $this->auto_series_model->get(['id'=>$order_row['s_id']],'name'); $biz_row = $this->biz_model->get(['id'=>$order_row['biz_id']],'biz_name,company_id'); + if($order_row['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司 + $biz_row['company_id'] = 1; + } $company_row = $this->sys_company_model->get(['id'=>$biz_row['company_id']],'short'); $type_name = $type_arr[$row['type']]; $description = "{$brand_row['name']}{$s_row['name']}-{$order_row['name']}-{$biz_row['biz_name']}-{$type_name}-{$company_row['short']}"; diff --git a/api/controllers/wxapp/licheb/Cusorder.php b/api/controllers/wxapp/licheb/Cusorder.php index 94b8cc5e..06e2683d 100644 --- a/api/controllers/wxapp/licheb/Cusorder.php +++ b/api/controllers/wxapp/licheb/Cusorder.php @@ -180,6 +180,9 @@ class Cusorder extends Wxapp{ $money_json['fee_carno'] = 0.01; }else{ $biz = $this->biz_model->get(['id'=>$row['biz_id']],'company_id,city_id'); + if($series_row['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司 + $biz['company_id'] = 1; + } $city = $this->sys_city_model->get(['city_id'=>$biz['city_id']],'fee_carno'); $money_json['fee_carno'] = $city['fee_carno']; } diff --git a/api/controllers/wxapp/licheb/Protocol.php b/api/controllers/wxapp/licheb/Protocol.php index 8f3169f5..80eb52d8 100644 --- a/api/controllers/wxapp/licheb/Protocol.php +++ b/api/controllers/wxapp/licheb/Protocol.php @@ -50,6 +50,9 @@ class Protocol extends CI_Controller{ $biz = $this->biz_model->get(['id'=>$row['biz_id']]); $city = $this->area_model->get(['county_id'=>$biz['county_id']],'city_name,county_name'); $row['address'] = $city['city_name'].$city['county_name'].'  '.$biz['address'] .'  '. $biz['biz_name']; + if($row['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司 + $biz['company_id'] = 1; + } $company = $this->sys_company_model->get(['id'=>$biz['company_id']]); $row['company'] = $company; //获取选择代办包 @@ -115,6 +118,9 @@ class Protocol extends CI_Controller{ $row['brand_name'] = $brand['name'].$series['name'].' '.$version; //获取门店信息 $biz = $this->biz_model->get(['id'=>$row['biz_id']]); + if($row['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司 + $biz['company_id'] = 1; + } $company = $this->sys_company_model->get(['id'=>$biz['company_id']]); $row['company'] = $company; } @@ -156,6 +162,9 @@ class Protocol extends CI_Controller{ $row['cardid'] = $info_json['cardid']; //获取门店信息 $biz = $this->biz_model->get(['id'=>$row['biz_id']]); + if($row['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司 + $biz['company_id'] = 1; + } $company = $this->sys_company_model->get(['id'=>$biz['company_id']]); $row['company'] = $company; $where = [ diff --git a/common/libraries/receiver/Orders_entity.php b/common/libraries/receiver/Orders_entity.php index 4370046e..cb3765ed 100644 --- a/common/libraries/receiver/Orders_entity.php +++ b/common/libraries/receiver/Orders_entity.php @@ -67,56 +67,6 @@ class Orders_entity{ return [$res,$title]; } - /** - * 签完成协议后操作 - * @param $oid int 订单id - * @param $app_id int 小程序id - * @param $userinfo array 小程序用户信息 - */ - public function sign_after($oid,$app_id,$userinfo){ - $this->order_row = $this->ci->orders_model->get(['id'=>$oid]); - if(!$this->order_row){ - return false; - } - $customers = $this->ci->customers_model->get(['id'=>$this->order_row['rid']],'rid'); - $ifpay = false; - $ifpay = $this->ci->order_purchase_model->count(['status>'=>1,'item_id'=>$oid,'app_id'=>$app_id,'app_uid'=>$userinfo['uid']]); - if($customers['rid'] && !$ifpay){ //判断线索是否支付定金 - $ifpay = $this->ci->order_purchase_model->count(['type'=>3,'status'=>2,'cf_id'=>$customers['rid'],'app_id'=>$app_id,'app_uid'=>$userinfo['uid']]); - } - if($ifpay){ - $this->ci->signs_model->update(['status'=>2],['o_id'=>$oid]); - if($this->order_row['payway']){//全款 - $status = 2; - $this->ci->load->model('receiver/order/receiver_order_ckcars_model','next_model'); - }else{ - $status = 1; - $this->ci->load->model('receiver/order/receiver_order_loans_model','next_model'); - } - //判断下一步是否存在 - if(!$this->ci->next_model->get(['o_id'=>$this->order_row['id']])){ - $res = $this->ci->orders_model->update(['status'=>$status],['id'=>$this->order_row['id']]); - if($res){ - $this->ci->next_model->add(['o_id'=>$this->order_row['id'],'c_time'=>time()]); - } - }else{ - $res = $this->ci->orders_model->update(['status'=>2],['id'=>$this->order_row['id']]); - } - }else{ - $this->ci->signs_model->update(['status'=>1],['o_id'=>$this->order_row['id']]); - $srv_money = $this->order_srv_money($oid); - 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; - } - $res = $this->c_order($mch_id,$this->order_row,$app_id,$userinfo); - } - return $res; - } /** * 签完成协议后操作 * @param $oid int 订单id @@ -138,6 +88,9 @@ class Orders_entity{ if($srv_money < $this->order_row['deposit']){ //服务费小于定金 给销售公司 //获取门店信息 $biz = $this->ci->biz_model->get(['id'=>$this->order_row['biz_id']],'company_id'); + if($this->order_row['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司 + $biz['company_id'] = 1; + } $company = $this->ci->sys_company_model->get(['id'=>$biz['company_id']],'wx_mchid'); $mch_id = $company['wx_mchid']; }else{ @@ -364,105 +317,6 @@ class Orders_entity{ return $res; } - //确认车辆完成创建两个支付订单 - public function check_finish($oid,$app_id,$userinfo){ - - $this->order_row = $this->ci->orders_model->get(['id'=>$oid]); - if(!$this->order_row){ - return false; - } - $brand = $this->ci->auto_brand_model->get(['id'=>$this->order_row['brand_id']],'name'); - $series = $this->ci->auto_series_model->get(['id'=>$this->order_row['s_id']],'name'); - $car_json = json_decode($this->order_row['car_json'],true); - $color = isset($car_json['color']) ? $car_json['color'] : ''; - - $jsondata['car'] = $car_json; - if($color['jsondata']['img']){ - $jsondata['cover'] = $color['jsondata']['img']; - } - //获取门店信息 - $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']]); - - $srv_money = $this->order_srv_money($oid); //服务费 - $money_json = json_decode($this->order_row['money_json'],true); - if($this->order_row['payway']){ //全款 - if($srv_money < $this->order_row['deposit']){ //服务费小于定金 - $to_srv_price = $srv_money; - $to_com_price = $money_json['price_car'] - $this->order_row['deposit']; - $to_com_price = $to_com_price>0 ? $to_com_price : 0; - }else{ - $to_com_price = $money_json['price_car']; //给销售公司金额 裸车价格 - $to_srv_price = $srv_money - $this->order_row['deposit']; //给服务公司金额 裸车价格+服务费-给销售公司金额-定金 - $to_srv_price = $to_srv_price>0 ? $to_srv_price : 0; - } - }else{ //分期 - if($srv_money < $this->order_row['deposit']){ //服务费小于定金 - $to_srv_price = $srv_money; - $to_com_price = $money_json['price_car']-$money_json['price_loan'] - $this->order_row['deposit']; - $to_com_price = $to_com_price>0 ? $to_com_price : 0; - }else{ - $to_com_price = $money_json['price_car']-$money_json['price_loan']; //给销售公司金额 - $to_srv_price = $srv_money - $this->order_row['deposit']; //给服务公司的金额 服务费-定金 - $to_srv_price = $to_srv_price>0 ? $to_srv_price : 0; - } - } - $add_data = []; - if($to_srv_price>0){ - $order_type = 5; - $sid = create_order_no(350200,'liche',1,$order_type); - $add_data[] = [ - 'app_id' => $app_id, - 'app_uid' => $userinfo['uid'], - 'sid' => $sid, - 'mch_id' => self::SRV_MCH_ID, - 'item_id' => $this->order_row['id'], - 'item_title' => $brand['name'].$series['name'], - 'item_num' => 1, - 'type' => $order_type, - 'item_price' => $to_srv_price, - 'total_price' => $to_srv_price, - 'uname' => $userinfo['nickname'], - 'mobile' => $userinfo['mobile'], - 'payway' => 1, - 'status' => 1, - 'status_detail' => 11, - 'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE), - 'c_time' => time(), - 'cf_id' => $this->order_row['id'] - ]; - } - if($to_com_price>0){ - $order_type = 6; - $sid = create_order_no(350200,'liche',1,$order_type); - $add_data[] = [ - 'app_id' => $app_id, - 'app_uid' => $userinfo['uid'], - 'sid' => $sid, - 'mch_id' => $company['wx_mchid'], - 'item_id' => $this->order_row['id'], - 'item_title' => $brand['name'].$series['name'], - 'item_num' => 1, - 'type' => $order_type, - 'item_price' => $to_com_price, - 'total_price' => $to_com_price, - 'uname' => $userinfo['nickname'], - 'mobile' => $userinfo['mobile'], - 'payway' => 1, - 'status' => 1, - 'status_detail' => 11, - 'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE), - 'c_time' => time(), - 'cf_id' => $this->order_row['id'] - ]; - } - $result = false; - if($add_data){ - $result = $this->ci->order_purchase_model->add_batch($add_data); - } - return $result; - } - /** * 获取订单服务费 @@ -515,6 +369,9 @@ class Orders_entity{ } //获取门店信息 $biz = $this->ci->biz_model->get(['id'=>$this->order_row['biz_id']],'company_id'); + if($this->order_row['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司 + $biz['company_id'] = 1; + } $company = $this->ci->sys_company_model->get(['id'=>$biz['company_id']]); $srv_money = $this->order_srv_money($oid); //服务费 @@ -617,6 +474,9 @@ class Orders_entity{ if($srv_money < $this->order_row['deposit']){ //服务费小于定金 给销售公司 //获取门店信息 $biz = $this->ci->biz_model->get(['id'=>$this->order_row['biz_id']],'company_id'); + if($this->order_row['brand_id']==4){ //哪吒品牌 公司固定厦门狸车销售公司 + $biz['company_id'] = 1; + } $company = $this->ci->sys_company_model->get(['id'=>$biz['company_id']],'wx_mchid'); $mch_id = $company['wx_mchid']; }else{