作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

我的托管

... ... @@ -12,6 +12,7 @@ namespace app\index\controller;
use app\index\model\CodeModel;
use app\index\model\CollocationModel;
use app\index\model\OrderInfoModel;
use app\index\model\OrderModel;
use app\index\model\QuestionModel;
use app\index\model\SubjoinInsuranceModel;
use app\index\model\UserModel;
... ... @@ -108,14 +109,15 @@ class MeTrusteeshipController extends WeChatBaseController
return json_encode($arr);
}
$orderInfoModel = new OrderInfoModel();
$where1 = array('c.user_id'=>$user_id,'c.insurance_type_id'=>$param['insurance_type_id'],'c.insurer'=>$param['insurer']);
$where2 = array('insurance_type_id'=>$param['insurance_type_id']);
$insurance = $orderInfoModel->selectData($where1,$where2);//获取到当前类型的保单
dump($insurance);
exit();
// $where1 = array('c.user_id'=>$user_id,'c.insurance_type_id'=>$param['insurance_type_id'],'c.insurer'=>$param['insurer']);
$where2 = array('insurance_type_id'=>$param['insurance_type_id'],'user_id'=>$user_id,'insurer'=>$param['insurer']);
$subjoin = $orderInfoModel->selectData1($where2);//获取到当前类型的附加保单
$orderModel = new OrderModel();
$insurance = $orderModel->selectData($where2);//获取到当前类型的主保单
$indexServer = new IndexServer();
$data = $indexServer->main_arrows($insurance,$question,$user);
$data = $indexServer->main_arrows($insurance,$subjoin,$question,$user);
dump($data);
exit();
$arr['code'] = 20000;
$arr['msg'] = '获取成功!';
$arr['data'] = $data;
... ...
... ... @@ -14,6 +14,14 @@ use think\Db;
class OrderInfoModel extends Model
{
public function selectData1($where=null){
$where['o.delete_time'] = ['eq',0];
$where['c.expire_time'] = ['>',time()];//判断保单是否还在缴费期限内
$where['o.order_expire_time'] = ['>',time()];//筛选出托管中状态
$where['o.status'] = ['eq',3];//筛选出托管中状态
$data = $this->where($where)->select()->toArray();
return $data;
}
public function selectData($where1,$where2=null){
$where1['o.delete_time'] = ['eq',0];
$where1['c.expire_time'] = ['>',time()];//判断保单是否还在缴费期限内
... ...
... ... @@ -21,4 +21,9 @@ class OrderModel extends Model
$data = $this->where($where)->find();
return $data;
}
public function selectData($where){
$where['delete_time'] = ['eq',0];
$data = $this->where($where)->select()->toArray();
return $data;
}
}
\ No newline at end of file
... ...
... ... @@ -12,95 +12,97 @@ use app\index\model\OrderInfoModel;
class IndexServer
{
//点击保单类型判断当前用户在当前类型下的箭头现实情况
public function main_arrows($data,$question,$user){
foreach($data as $key => $vo){
if($vo['insurer'] == $user['name']){
if($vo['insurance_type_id'] == 1){
public function main_arrows($data1,$data2,$question,$user){
foreach($data1 as $key => $vo1){
if($vo1['insurer'] == $user['name']){
if($vo1['insurance_type_id'] == 1){
//重疾
$standard = ($question['personage_year_income']*5)+($question['not_return']*0.3);
if($standard >= $vo['insurance_price']){
if($standard >= $vo1['insurance_price']){
//绿油油
$data[$key]['main_arrows'] = 1;
$data1[$key]['main_arrows'] = 1;
}else{
//红彤彤
$data[$key]['main_arrows'] = 2;
$data1[$key]['main_arrows'] = 2;
}
}else if($vo['insurance_type_id'] == 2){
}else if($vo1['insurance_type_id'] == 2){
//人寿
$standard = $question['personage_year_income']*10+$question['not_return'];
if($standard >= $vo['insurance_price']){
if($standard >= $vo1['insurance_price']){
//绿油油
$data[$key]['main_arrows'] = 1;
$data1[$key]['main_arrows'] = 1;
}else{
//红彤彤
$data[$key]['main_arrows'] = 2;
$data1[$key]['main_arrows'] = 2;
}
}else if($vo['insurance_type_id'] == 3){
}else if($vo1['insurance_type_id'] == 3){
//出行
$standard = $question['personage_year_income']*10+$question['not_return'];
if($standard >= $vo['insurance_price']){
if($standard >= $vo1['insurance_price']){
//绿油油
$data[$key]['main_arrows'] = 1;
$data1[$key]['main_arrows'] = 1;
}else{
//红彤彤
$data[$key]['main_arrows'] = 2;
$data1[$key]['main_arrows'] = 2;
}
}else if($vo['insurance_type_id'] == 4){
}else if($vo1['insurance_type_id'] == 4){
//医疗
$standard = 1000000;
if($standard >= $vo['insurance_price']){
if($standard >= $vo1['insurance_price']){
//绿油油
$data[$key]['main_arrows'] = 1;
$data1[$key]['main_arrows'] = 1;
}else{
//红彤彤
$data[$key]['main_arrows'] = 2;
$data1[$key]['main_arrows'] = 2;
}
}
foreach($vo['subjoin_insurance'] as $key1 => $s_i){
if($s_i['insurance_type_id'] == 1){
}
}
foreach($data2 as $key1 => $vo2){
if($vo2['insurance_type_id'] == 1){
//重疾
$standard = ($question['personage_year_income']*5)+($question['not_return']*0.3);
if($standard >= $s_i['subjoin_price']){
if($standard >= $vo2['subjoin_price']){
//绿油油
$vo['subjoin_insurance'][$key1]['main_arrows'] = 1;
$data2[$key1]['main_arrows'] = 1;
}else{
//红彤彤
$vo['subjoin_insurance'][$key1]['main_arrows'] = 2;
$data2[$key1]['main_arrows'] = 2;
}
}else if($s_i['insurance_type_id'] == 2){
}else if($vo2['insurance_type_id'] == 2){
//人寿
$standard = $question['personage_year_income']*10+$question['not_return'];
if($standard >= $s_i['subjoin_price']){
if($standard >= $vo2['subjoin_price']){
//绿油油
$vo['subjoin_insurance'][$key1]['main_arrows'] = 1;
$data2[$key1]['main_arrows'] = 1;
}else{
//红彤彤
$vo['subjoin_insurance'][$key1]['main_arrows'] = 2;
$data2[$key1]['main_arrows'] = 2;
}
}else if($s_i['insurance_type_id'] == 3){
}else if($vo2['insurance_type_id'] == 3){
//出行
$standard = $question['personage_year_income']*10+$question['not_return'];
if($standard >= $s_i['subjoin_price']){
if($standard >= $vo2['subjoin_price']){
//绿油油
$vo['subjoin_insurance'][$key1]['main_arrows'] = 1;
$data2[$key1]['main_arrows'] = 1;
}else{
//红彤彤
$vo['subjoin_insurance'][$key1]['main_arrows'] = 2;
$data2[$key1]['main_arrows'] = 2;
}
}else if($s_i['insurance_type_id'] == 4){
}else if($vo2['insurance_type_id'] == 4){
//医疗
$standard = 1000000;
if($standard >= $s_i['subjoin_price']){
if($standard >= $vo2['subjoin_price']){
//绿油油
$vo['subjoin_insurance'][$key1]['main_arrows'] = 1;
$data2[$key1]['main_arrows'] = 1;
}else{
//红彤彤
$vo['subjoin_insurance'][$key1]['main_arrows'] = 2;
}
}
$data2[$key1]['main_arrows'] = 2;
}
}
}
$data['insurance'] = $data1;
$data['subjoin'] = $data2;
return $data;
}
public function vice_arrows(){
... ...