From 704f8fd6f5767019658b8b33bf43795a5ee40120 Mon Sep 17 00:00:00 2001 From: qianhy Date: Wed, 14 Jun 2023 11:58:08 +0800 Subject: [PATCH] cost add loan rebate about --- api/controllers/plan/Order.php | 102 ++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 46 deletions(-) diff --git a/api/controllers/plan/Order.php b/api/controllers/plan/Order.php index 263caaab..c98bedfd 100644 --- a/api/controllers/plan/Order.php +++ b/api/controllers/plan/Order.php @@ -1042,6 +1042,7 @@ class Order extends CI_Controller{ } $srv_json['loan_num'] = $finance_num = $loan_row['num'] ? $loan_row['num'] : 36; $srv_json['loan_num'] = $srv_json['loan_product'] ? $srv_json['loan_num'] : 0; + $loan_rebate = $money_json['loan_rebate'] ? $money_json['loan_rebate'] : 0; # 0612 按揭返点系数 if ($debug){ if ($finance_id){ echo $this->sys_supplier_model->db->last_query()."
"; @@ -1052,43 +1053,47 @@ class Order extends CI_Controller{ echo "loan_product: {$srv_json['loan_product']}"."
"; echo "loan_num: {$srv_json['loan_num']}"."
"; echo "is_tiexi: {$loan_row['is_tiexi']}"."
"; + echo "loan_rebate: {$loan_rebate}"."
"; echo "

"; } $profix_loan = $loan_fd = 0; if (!$loan_row['is_tiexi']){ - $biz_id_param = $biz_id_force ? $biz_id_force : $item['biz_id']; - $where = [ - 'biz_id' => $biz_id_param, - 'type' => 3, - 'status' => 1, - 's_effect_time<=' => date('Y-m-d',strtotime($item['bill_time'])), - "JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$finance_id}'" => null, - "JSON_UNQUOTE(json_extract(jsondata, '$.finance_num')) = '{$finance_num}'" => null, - "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, - ]; - $fd_row = $this->biz_settle_srv_model->get($where); - if ($debug){ - echo "get 按揭配置 :
"; - echo $this->biz_settle_srv_model->db->last_query()."
"; - var_dump($fd_row); - echo "

"; - } - if(!$fd_row){ - $fd_row = $this->biz_settle_srv_model->get(['biz_id'=>$biz_id_param,'is_def'=>1,'status'=>1,'type'=>3, + if (!$loan_rebate){ + $biz_id_param = $biz_id_force ? $biz_id_force : $item['biz_id']; + $where = [ + 'biz_id' => $biz_id_param, + 'type' => 3, + 'status' => 1, + 's_effect_time<=' => date('Y-m-d',strtotime($item['bill_time'])), "JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$finance_id}'" => null, "JSON_UNQUOTE(json_extract(jsondata, '$.finance_num')) = '{$finance_num}'" => null, "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, - ]); + ]; + $fd_row = $this->biz_settle_srv_model->get($where); if ($debug){ - echo "get 按揭配置(默认) :
"; + echo "get 按揭配置 :
"; echo $this->biz_settle_srv_model->db->last_query()."
"; var_dump($fd_row); echo "

"; } + if(!$fd_row){ + $fd_row = $this->biz_settle_srv_model->get(['biz_id'=>$biz_id_param,'is_def'=>1,'status'=>1,'type'=>3, + "JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$finance_id}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.finance_num')) = '{$finance_num}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, + ]); + if ($debug){ + echo "get 按揭配置(默认) :
"; + echo $this->biz_settle_srv_model->db->last_query()."
"; + var_dump($fd_row); + echo "

"; + } + } + $fd_jsondata = json_decode($fd_row['jsondata'],true); + $loan_rebate = $fd_jsondata['rebate'] && $money_json['price_loan'] ? $fd_jsondata['rebate']:0; } - $fd_jsondata = json_decode($fd_row['jsondata'],true); - $loan_fd = $fd_jsondata['rebate'] && $money_json['price_loan'] ? $fd_jsondata['rebate']:0; + $loan_fd = $loan_rebate; $profix_loan = round($money_json['price_loan']*$loan_fd/100, 2); } @@ -1130,6 +1135,7 @@ class Order extends CI_Controller{ } $srv_json['loan_num0'] = $finance_num = $loan_row['num'] ? $loan_row['num'] : 36; $srv_json['loan_num0'] = $srv_json['loan_product0'] ? $srv_json['loan_num0'] : 0; + $loan0_rebate = $money_json['loan0_rebate'] ? $money_json['loan0_rebate'] : 0; # 0612 按揭返点系数 if ($debug){ if ($finance_id){ echo $this->sys_supplier_model->db->last_query()."
"; @@ -1140,43 +1146,47 @@ class Order extends CI_Controller{ echo "loan_product0: {$srv_json['loan_product0']}"."
"; echo "loan_num0: {$srv_json['loan_num0']}"."
"; echo "is_tiexi0: {$loan_row['is_tiexi0']}"."
"; + echo "loan0_rebate: {$loan0_rebate}"."
"; echo "

"; } $profix_loan = $loan_fd = 0; if (!$loan_row['is_tiexi']){ - $biz_id_param = $biz_id_force ? $biz_id_force : $item['biz_id']; - $where = [ - 'biz_id' => $biz_id_param, - 'type' => 3, - 'status' => 1, - 's_effect_time<=' => date('Y-m-d',strtotime($item['bill_time'])), - "JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$finance_id}'" => null, - "JSON_UNQUOTE(json_extract(jsondata, '$.finance_num')) = '{$finance_num}'" => null, - "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, - ]; - $fd_row = $this->biz_settle_srv_model->get($where); - if ($debug){ - echo "get 首付按揭-按揭配置 :
"; - echo $this->biz_settle_srv_model->db->last_query()."
"; - var_dump($fd_row); - echo "

"; - } - if(!$fd_row){ - $fd_row = $this->biz_settle_srv_model->get(['biz_id'=>$biz_id_param,'is_def'=>1,'status'=>1,'type'=>3, + if (!$loan0_rebate){ + $biz_id_param = $biz_id_force ? $biz_id_force : $item['biz_id']; + $where = [ + 'biz_id' => $biz_id_param, + 'type' => 3, + 'status' => 1, + 's_effect_time<=' => date('Y-m-d',strtotime($item['bill_time'])), "JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$finance_id}'" => null, "JSON_UNQUOTE(json_extract(jsondata, '$.finance_num')) = '{$finance_num}'" => null, "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, - ]); + ]; + $fd_row = $this->biz_settle_srv_model->get($where); if ($debug){ - echo "get 首付按揭-按揭配置(默认) :
"; + echo "get 首付按揭-按揭配置 :
"; echo $this->biz_settle_srv_model->db->last_query()."
"; var_dump($fd_row); echo "

"; } + if(!$fd_row){ + $fd_row = $this->biz_settle_srv_model->get(['biz_id'=>$biz_id_param,'is_def'=>1,'status'=>1,'type'=>3, + "JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$finance_id}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.finance_num')) = '{$finance_num}'" => null, + "JSON_UNQUOTE(json_extract(jsondata, '$.rebate')) > 0" => null, + ]); + if ($debug){ + echo "get 首付按揭-按揭配置(默认) :
"; + echo $this->biz_settle_srv_model->db->last_query()."
"; + var_dump($fd_row); + echo "

"; + } + } + $fd_jsondata = json_decode($fd_row['jsondata'],true); + $loan0_rebate = $fd_jsondata['rebate'] && $money_json['price_loan0'] ? $fd_jsondata['rebate']:0; } - $fd_jsondata = json_decode($fd_row['jsondata'],true); - $loan_fd = $fd_jsondata['rebate'] && $money_json['price_loan0'] ? $fd_jsondata['rebate']:0; + $loan_fd = $loan0_rebate; $profix_loan = round($money_json['price_loan0']*$loan_fd/100, 2); }