orders insure_rebate about

This commit is contained in:
qianhy
2023-06-12 14:07:25 +08:00
committed by lccsw
parent 0070f15bd7
commit e9d2f3711a
2 changed files with 134 additions and 81 deletions
+97 -81
View File
@@ -747,6 +747,10 @@ class Order extends CI_Controller{
$insurance_img = json_decode($img_data['insurance_img'],true);
$business_img = json_decode($img_data['business_img'],true);
$accident_img = json_decode($img_data['accident_img'],true);
# 0612各保单支持返点系数,优先级高于水平业务配置
$insurance_rebate = $insurance_img['rebate'] ? $insurance_img['rebate'] : 0;
$business_rebate = $business_img['rebate'] ? $business_img['rebate'] : 0;
$accident_rebate = $accident_img['rebate'] ? $accident_img['rebate'] : 0;
if ($biz['type']==1 && $srv_if_insure){
$srv_json['insurance_price'] = $insurance_img['price'] ? $insurance_img['price'] : 0;
$srv_json['insurance_product'] = $insurance_img['product'] ? $insurance_img['product'] : '';
@@ -761,10 +765,13 @@ class Order extends CI_Controller{
echo "<br>";
echo "insurance_price: {$srv_json['insurance_price']}"."<br>";
echo "insurance_product: {$srv_json['insurance_product']}"."<br>";
echo "insurance_rebate: {$insurance_rebate}"."<br>";
echo "business_price: {$srv_json['business_price']}"."<br>";
echo "business_product: {$srv_json['business_product']}"."<br>";
echo "business_rebate: {$business_rebate}"."<br>";
echo "accident_price: {$srv_json['accident_price']}"."<br>";
echo "accident_title: {$srv_json['accident_title']}"."<br>";
echo "accident_rebate: {$accident_rebate}"."<br>";
echo "<br><br>";
}
}
@@ -775,47 +782,50 @@ class Order extends CI_Controller{
//强险
$srv_json['insurance_ins_price'] = $srv_json['insurance_fd'] = 0;
if($biz['type']==1 && $srv_if_insure && $insurance_img && $insurance_img['product']){
$time = strtotime($insurance_img['date']);
$insure_product = $this->cost_insure_product($supplier2, $insurance_img['product']);
$where = [
'biz_id' => $item['biz_id'],
'title' => $insure_product,
'type' => 2,
'status' => 1,
"json_extract(jsondata, '$.type') = '2'" => null,
"json_extract(jsondata, '$.s_time') <= '{$time}'" => null,
"json_extract(jsondata, '$.e_time') >= '{$time}'" => null
];
$fd_row = $this->biz_settle_srv_model->get($where);
if ($debug){
echo "get 强险配置 : <br>";
if ($insure_product != $insurance_img['product']){
echo "{$insurance_img['product']} -> {$insure_product}"."<br>";
}
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($fd_row);
echo "<br><br>";
}
if(!$fd_row){
if (!$insurance_rebate){
$time = strtotime($insurance_img['date']);
$insure_product = $this->cost_insure_product($supplier2, $insurance_img['product']);
$where = [
'biz_id' => $item['biz_id'],
'title' => $insure_product,
'type' => 2,
'status' => 1,
'is_def' => 1,
"json_extract(jsondata, '$.type') = '2'" => null,
"json_extract(jsondata, '$.s_time') <= '{$time}'" => null,
"json_extract(jsondata, '$.e_time') >= '{$time}'" => null
];
$fd_row = $this->biz_settle_srv_model->get($where);
if ($debug){
echo "get 强险配置(默认) : <br>";
echo "get 强险配置 : <br>";
if ($insure_product != $insurance_img['product']){
echo "{$insurance_img['product']} -> {$insure_product}"."<br>";
}
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($fd_row);
echo "<br><br>";
}
if(!$fd_row){
$where = [
'biz_id' => $item['biz_id'],
'title' => $insure_product,
'type' => 2,
'status' => 1,
'is_def' => 1,
"json_extract(jsondata, '$.type') = '2'" => 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>";
}
}
$fd_jsondata = json_decode($fd_row['jsondata'],true);
$insurance_rebate = $fd_jsondata['rebate'] ? $fd_jsondata['rebate'] : 0;
}
$fd_jsondata = json_decode($fd_row['jsondata'],true);
$srv_json['insurance_fd'] = $fd_jsondata['rebate'] ? $fd_jsondata['rebate'] : 0;
$qx_fd = $fd_jsondata['rebate']/100/$insurance_xishu;
$srv_json['insurance_fd'] = $insurance_rebate;
$qx_fd = $insurance_rebate/100/$insurance_xishu;
$srv_json['insurance_ins_price'] = round(floatval($insurance_img['price']) * $qx_fd, 2);
if ($debug){
echo "get 强险返点: <br>";
@@ -830,47 +840,50 @@ class Order extends CI_Controller{
//商业险
$srv_json['business_ins_price'] = $srv_json['business_fd'] = 0;
if($biz['type']==1 && $srv_if_insure && $business_img && $business_img['product']){
$time = strtotime($business_img['date']);
$insure_product = $this->cost_insure_product($supplier2, $business_img['product']);
$where = [
'biz_id' => $item['biz_id'],
'title' => $insure_product,
'status' => 1,
'type' => 2,
"json_extract(jsondata, '$.type') = '1'" => null,
"json_extract(jsondata, '$.s_time') <= '{$time}'" => null,
"json_extract(jsondata, '$.e_time') >= '{$time}'" => null
];
$bis_fd_row = $this->biz_settle_srv_model->get($where);
if ($debug){
echo "get 商业险配置 : <br>";
if ($insure_product != $business_img['product']){
echo "{$business_img['product']} -> {$insure_product}"."<br>";
}
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($bis_fd_row);
echo "<br><br>";
}
if(!$bis_fd_row){
if (!$business_rebate){
$time = strtotime($business_img['date']);
$insure_product = $this->cost_insure_product($supplier2, $business_img['product']);
$where = [
'biz_id' => $item['biz_id'],
'title' => $insure_product,
'status' => 1,
'type' => 2,
'is_def' => 1,
"json_extract(jsondata, '$.type') = '1'" => null,
"json_extract(jsondata, '$.s_time') <= '{$time}'" => null,
"json_extract(jsondata, '$.e_time') >= '{$time}'" => null
];
$bis_fd_row = $this->biz_settle_srv_model->get($where);
if ($debug){
echo "get 商业险配置(默认) : <br>";
echo "get 商业险配置 : <br>";
if ($insure_product != $business_img['product']){
echo "{$business_img['product']} -> {$insure_product}"."<br>";
}
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($bis_fd_row);
echo "<br><br>";
}
if(!$bis_fd_row){
$where = [
'biz_id' => $item['biz_id'],
'title' => $insure_product,
'status' => 1,
'type' => 2,
'is_def' => 1,
"json_extract(jsondata, '$.type') = '1'" => null,
];
$bis_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($bis_fd_row);
echo "<br><br>";
}
}
$bis_fd_jsondata = json_decode($bis_fd_row['jsondata'],true);
$business_rebate = $bis_fd_jsondata['rebate'] ? $bis_fd_jsondata['rebate'] : 0;
}
$bis_fd_jsondata = json_decode($bis_fd_row['jsondata'],true);
$srv_json['business_fd'] = $bis_fd_jsondata['rebate'] ? $bis_fd_jsondata['rebate'] : 0;
$bis_fd = $bis_fd_jsondata['rebate']/100/$insurance_xishu;
$srv_json['business_fd'] = $business_rebate;
$bis_fd = $business_rebate/100/$insurance_xishu;
$srv_json['business_ins_price'] = round(floatval($business_img['price'])*$bis_fd, 2);
if ($debug){
echo "get 商业险返点: <br>";
@@ -885,47 +898,50 @@ class Order extends CI_Controller{
//意外险
$srv_json['accident_ins_price'] = $srv_json['accident_fd'] = 0;
if($biz['type']==1 && $srv_if_insure && $accident_img && $accident_img['product']){
$time = strtotime($accident_img['date']);
$insure_product = $this->cost_insure_product($supplier2, $accident_img['product']);
$where = [
'biz_id' => $item['biz_id'],
'title' => $insure_product,
'status' => 1,
'type' => 2,
"json_extract(jsondata, '$.type') = '3'" => null,
"json_extract(jsondata, '$.s_time') <= '{$time}'" => null,
"json_extract(jsondata, '$.e_time') >= '{$time}'" => null
];
$bis_fd_row = $this->biz_settle_srv_model->get($where);
if ($debug){
echo "get 意外险配置 : <br>";
if ($insure_product != $accident_img['product']){
echo "{$accident_img['product']} -> {$insure_product}"."<br>";
}
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($bis_fd_row);
echo "<br><br>";
}
if(!$bis_fd_row){
if (!$accident_rebate){
$time = strtotime($accident_img['date']);
$insure_product = $this->cost_insure_product($supplier2, $accident_img['product']);
$where = [
'biz_id' => $item['biz_id'],
'title' => $insure_product,
'status' => 1,
'type' => 2,
'is_def' => 1,
"json_extract(jsondata, '$.type') = '3'" => null,
"json_extract(jsondata, '$.s_time') <= '{$time}'" => null,
"json_extract(jsondata, '$.e_time') >= '{$time}'" => null
];
$bis_fd_row = $this->biz_settle_srv_model->get($where);
if ($debug){
echo "get 意外险配置(默认) : <br>";
echo "get 意外险配置 : <br>";
if ($insure_product != $accident_img['product']){
echo "{$accident_img['product']} -> {$insure_product}"."<br>";
}
echo $this->biz_settle_srv_model->db->last_query()."<br>";
var_dump($bis_fd_row);
echo "<br><br>";
}
if(!$bis_fd_row){
$where = [
'biz_id' => $item['biz_id'],
'title' => $insure_product,
'status' => 1,
'type' => 2,
'is_def' => 1,
"json_extract(jsondata, '$.type') = '3'" => null,
];
$bis_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($bis_fd_row);
echo "<br><br>";
}
}
$bis_fd_jsondata = json_decode($bis_fd_row['jsondata'],true);
$accident_rebate = $bis_fd_jsondata['rebate'] ? $bis_fd_jsondata['rebate'] : 0;
}
$bis_fd_jsondata = json_decode($bis_fd_row['jsondata'],true);
$srv_json['accident_fd'] = $bis_fd_jsondata['rebate'] ? $bis_fd_jsondata['rebate'] : 0;
$bis_fd = $bis_fd_jsondata['rebate']/100/$insurance_xishu;
$srv_json['accident_fd'] = $accident_rebate;
$bis_fd = $accident_rebate/100/$insurance_xishu;
$srv_json['accident_ins_price'] = round(floatval($accident_img['price'])*$bis_fd, 2);
if ($debug){
echo "get 意外险返点: <br>";