cost add loan rebate about

This commit is contained in:
qianhy
2023-06-14 11:58:08 +08:00
parent 836e02fd46
commit 704f8fd6f5
+56 -46
View File
@@ -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()."<br>";
@@ -1052,43 +1053,47 @@ class Order extends CI_Controller{
echo "loan_product: {$srv_json['loan_product']}"."<br>";
echo "loan_num: {$srv_json['loan_num']}"."<br>";
echo "is_tiexi: {$loan_row['is_tiexi']}"."<br>";
echo "loan_rebate: {$loan_rebate}"."<br>";
echo "<br><br>";
}
$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 按揭配置 : <br>";
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($fd_row);
echo "<br><br>";
}
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 按揭配置(默认) : <br>";
echo "get 按揭配置 : <br>";
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($fd_row);
echo "<br><br>";
}
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 按揭配置(默认) : <br>";
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($fd_row);
echo "<br><br>";
}
}
$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()."<br>";
@@ -1140,43 +1146,47 @@ class Order extends CI_Controller{
echo "loan_product0: {$srv_json['loan_product0']}"."<br>";
echo "loan_num0: {$srv_json['loan_num0']}"."<br>";
echo "is_tiexi0: {$loan_row['is_tiexi0']}"."<br>";
echo "loan0_rebate: {$loan0_rebate}"."<br>";
echo "<br><br>";
}
$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 首付按揭-按揭配置 : <br>";
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($fd_row);
echo "<br><br>";
}
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 首付按揭-按揭配置(默认) : <br>";
echo "get 首付按揭-按揭配置 : <br>";
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($fd_row);
echo "<br><br>";
}
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 首付按揭-按揭配置(默认) : <br>";
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($fd_row);
echo "<br><br>";
}
}
$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);
}