/**
  * 保险下单
  * @param $info_id
  */
 public function applyPolicyAction($info_id)
 {
     $data = $this->request->getJsonRawBody(true);
     $company_id = $data['company_id'];
     $final_result_id = $data['result_id'];
     $user = User::getCurrentUser();
     $info = Insurance::getInsuranceInfoById($info_id);
     $final_param_id = $info['final_param_id'];
     Insurance::updateFinalParam($final_param_id, array('company_id' => $company_id));
     $return_data = array();
     if ($info['state_id'] >= 4) {
         $return_data['success'] = false;
         $return_data['err_msg'] = '此订单已下单';
     } else {
         $success = Insurance::updateInsuranceInfo($info_id, array('company_id' => $company_id, 'final_result_id' => $final_result_id));
         if ($success) {
             $final_result = Insurance::getInsuranceFinalResultById($final_result_id);
             $total_fee = $final_result['totalAfterDiscount'];
             $order_result = Order::addOrder('insurance', array('info_id' => $info_id, 'user_id' => $user['user_id'], 'total_fee' => $total_fee));
             if (!$order_result) {
                 $return_data['success'] = false;
                 $return_data['err_msg'] = '保险支付订单生成失败';
             } else {
                 $return_data['success'] = true;
                 $return_data['order_info'] = array('order_id' => $order_result[0], 'order_no' => $order_result[1], 'order_fee' => $order_result[2]);
             }
         } else {
             $return_data['success'] = false;
             $return_data['err_msg'] = '订单生成失败';
         }
     }
     $this->view->setVars($return_data);
 }