diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php
index 8e70263b..3b1beccd 100644
--- a/admin/controllers/receiver/orderv2/Orders.php
+++ b/admin/controllers/receiver/orderv2/Orders.php
@@ -1542,6 +1542,23 @@ class Orders extends HD_Controller
'price' => floatval($result['data']['premium']),
'product' => $result['data']['companyName'] ? $result['data']['companyName'] : $result['data']['department']
];
+
+ # 0612各保单支持返点系数, 保留系数
+ if ($re_data){
+ $insurance_img = json_decode($re_data['insurance_img'],true);
+ $business_img = json_decode($re_data['business_img'],true);
+ $accident_img = json_decode($re_data['accident_img'],true);
+ if ($field=='insurance_img' && $insurance_img['rebate']){
+ $img_jsondata['rebate'] = $insurance_img['rebate'];
+ }
+ elseif ($field=='business_img' && $business_img['rebate']){
+ $img_jsondata['rebate'] = $business_img['rebate'];
+ }
+ elseif ($field=='accident_img' && $accident_img['rebate']){
+ $img_jsondata['rebate'] = $accident_img['rebate'];
+ }
+ }
+
$jsondata['ins_info'][md5($img_url)] = $result;
$update[$field] = json_encode($img_jsondata,JSON_UNESCAPED_UNICODE);
$update['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
@@ -2136,6 +2153,26 @@ class Orders extends HD_Controller
$update = [
$info['field'] => json_encode([])
];
+
+ # 0612各保单支持返点系数, 保留系数
+ $insurance_img = json_decode($row['insurance_img'],true);
+ $business_img = json_decode($row['business_img'],true);
+ $accident_img = json_decode($row['accident_img'],true);
+ if ($info['field']=='insurance_img' && $insurance_img['rebate']){
+ $update = [
+ $info['field'] => json_encode(['rebate'=>$insurance_img['rebate']])
+ ];
+ }
+ elseif ($info['field']=='business_img' && $business_img['rebate']){
+ $update = [
+ $info['field'] => json_encode(['rebate'=>$business_img['rebate']])
+ ];
+ }
+ elseif ($info['field']=='accident_img' && $accident_img['rebate']){
+ $update = [
+ $info['field'] => json_encode(['rebate'=>$accident_img['rebate']])
+ ];
+ }
}else{
$update = [
$info['field'] => ''
diff --git a/api/controllers/plan/Order.php b/api/controllers/plan/Order.php
index 29eff3a2..fee1629f 100644
--- a/api/controllers/plan/Order.php
+++ b/api/controllers/plan/Order.php
@@ -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 "
";
echo "insurance_price: {$srv_json['insurance_price']}"."
";
echo "insurance_product: {$srv_json['insurance_product']}"."
";
+ echo "insurance_rebate: {$insurance_rebate}"."
";
echo "business_price: {$srv_json['business_price']}"."
";
echo "business_product: {$srv_json['business_product']}"."
";
+ echo "business_rebate: {$business_rebate}"."
";
echo "accident_price: {$srv_json['accident_price']}"."
";
echo "accident_title: {$srv_json['accident_title']}"."
";
+ echo "accident_rebate: {$accident_rebate}"."
";
echo "
";
}
}
@@ -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 强险配置 :
";
- if ($insure_product != $insurance_img['product']){
- echo "{$insurance_img['product']} -> {$insure_product}"."
";
- }
- echo $this->biz_settle_srv_model->db->last_query()."
";
- var_dump($fd_row);
- echo "
";
- }
- 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 强险配置(默认) :
";
+ echo "get 强险配置 :
";
+ if ($insure_product != $insurance_img['product']){
+ echo "{$insurance_img['product']} -> {$insure_product}"."
";
+ }
echo $this->biz_settle_srv_model->db->last_query()."
";
var_dump($fd_row);
echo "
";
}
+ 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 强险配置(默认) :
";
+ echo $this->biz_settle_srv_model->db->last_query()."
";
+ var_dump($fd_row);
+ echo "
";
+ }
+ }
+ $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 强险返点:
";
@@ -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 商业险配置 :
";
- if ($insure_product != $business_img['product']){
- echo "{$business_img['product']} -> {$insure_product}"."
";
- }
- echo $this->biz_settle_srv_model->db->last_query()."
";
- var_dump($bis_fd_row);
- echo "
";
- }
- 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 商业险配置(默认) :
";
+ echo "get 商业险配置 :
";
+ if ($insure_product != $business_img['product']){
+ echo "{$business_img['product']} -> {$insure_product}"."
";
+ }
echo $this->biz_settle_srv_model->db->last_query()."
";
var_dump($bis_fd_row);
echo "
";
}
+ 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 商业险配置(默认) :
";
+ echo $this->biz_settle_srv_model->db->last_query()."
";
+ var_dump($bis_fd_row);
+ echo "
";
+ }
+ }
+ $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 商业险返点:
";
@@ -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 意外险配置 :
";
- if ($insure_product != $accident_img['product']){
- echo "{$accident_img['product']} -> {$insure_product}"."
";
- }
- echo $this->biz_settle_srv_model->db->last_query()."
";
- var_dump($bis_fd_row);
- echo "
";
- }
- 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 意外险配置(默认) :
";
+ echo "get 意外险配置 :
";
+ if ($insure_product != $accident_img['product']){
+ echo "{$accident_img['product']} -> {$insure_product}"."
";
+ }
echo $this->biz_settle_srv_model->db->last_query()."
";
var_dump($bis_fd_row);
echo "
";
}
+ 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 意外险配置(默认) :
";
+ echo $this->biz_settle_srv_model->db->last_query()."
";
+ var_dump($bis_fd_row);
+ echo "
";
+ }
+ }
+ $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 意外险返点:
";