IndexServer.php 4.1 KB
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/28
 * Time: 17:22
 */
namespace app\index\server;

use app\index\model\OrderInfoModel;

class IndexServer
{
    //点击保单类型判断当前用户在当前类型下的箭头现实情况
    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 >= $vo1['insurance_price']){
                        //绿油油
                        $data1[$key]['main_arrows'] = 1;
                    }else{
                        //红彤彤
                        $data1[$key]['main_arrows'] = 2;
                    }
                }else if($vo1['insurance_type_id'] == 2){
                    //人寿
                    $standard = $question['personage_year_income']*10+$question['not_return'];
                    if($standard >= $vo1['insurance_price']){
                        //绿油油
                        $data1[$key]['main_arrows'] = 1;
                    }else{
                        //红彤彤
                        $data1[$key]['main_arrows'] = 2;
                    }
                }else if($vo1['insurance_type_id'] == 3){
                    //出行
                    $standard = $question['personage_year_income']*10+$question['not_return'];
                    if($standard >= $vo1['insurance_price']){
                        //绿油油
                        $data1[$key]['main_arrows'] = 1;
                    }else{
                        //红彤彤
                        $data1[$key]['main_arrows'] = 2;
                    }
                }else if($vo1['insurance_type_id'] == 4){
                    //医疗
                    $standard = 1000000;
                    if($standard >= $vo1['insurance_price']){
                        //绿油油
                        $data1[$key]['main_arrows'] = 1;
                    }else{
                        //红彤彤
                        $data1[$key]['main_arrows'] = 2;
                    }
                }
            }
        }
        foreach($data2 as $key1 => $vo2){
            if($vo2['insurance_type_id'] == 1){
                //重疾
                $standard = ($question['personage_year_income']*5)+($question['not_return']*0.3);
                if($standard >= $vo2['subjoin_price']){
                    //绿油油
                    $data2[$key1]['main_arrows'] = 1;
                }else{
                    //红彤彤
                    $data2[$key1]['main_arrows'] = 2;
                }
            }else if($vo2['insurance_type_id'] == 2){
                //人寿
                $standard = $question['personage_year_income']*10+$question['not_return'];
                if($standard >= $vo2['subjoin_price']){
                    //绿油油
                    $data2[$key1]['main_arrows'] = 1;
                }else{
                    //红彤彤
                    $data2[$key1]['main_arrows'] = 2;
                }
            }else if($vo2['insurance_type_id'] == 3){
                //出行
                $standard = $question['personage_year_income']*10+$question['not_return'];
                if($standard >= $vo2['subjoin_price']){
                    //绿油油
                    $data2[$key1]['main_arrows'] = 1;
                }else{
                    //红彤彤
                    $data2[$key1]['main_arrows'] = 2;
                }
            }else if($vo2['insurance_type_id'] == 4){
                //医疗
                $standard = 1000000;
                if($standard >= $vo2['subjoin_price']){
                    //绿油油
                    $data2[$key1]['main_arrows'] = 1;
                }else{
                    //红彤彤
                    $data2[$key1]['main_arrows'] = 2;
                }
            }
        }
        $data['insurance'] = $data1;
        $data['subjoin'] = $data2;
        return $data;
    }
    public function vice_arrows(){

    }
}