Exemple #1
0
 /**
  * 26获取订单详细信息 [bos]
  * url:/index.php?r=CarrentalApi/rc/GetCarRentalOrderDetail
  */
 public function actionGetCarRentalOrderDetail()
 {
     $json_params = Yii::app()->request->getParam('json_params');
     //客户端请求的json参数
     //测试用例[S]
     $json_params_go = Yii::app()->request->getParam('go');
     if ($json_params_go == 'go') {
         $array_params['UserId'] = 23;
         $array_params['OrderId'] = 544567;
         $json_params = json_encode($array_params);
     }
     //测试用例[E]
     if (!empty($json_params) && IconvEncode::IsJson($json_params)) {
         $bos_rs_json = RcManager::GetCarRentalOrderDetail($json_params);
         if (!empty($bos_rs_json->GetCarRentalOrderDetailResult)) {
             $rs_bos_arr = json_decode($bos_rs_json->GetCarRentalOrderDetailResult, true);
             if ($rs_bos_arr['ErrorCode'] === 0 && !empty($rs_bos_arr['Response']['Response'])) {
                 $rs_bos_arr_response = json_decode($rs_bos_arr['Response']['Response'], true);
                 if (is_array($rs_bos_arr_response)) {
                     //处理额外服务格式[S]
                     $extraList = array();
                     if (!empty($rs_bos_arr_response['ExtraService'])) {
                         //id,name,amount,value;
                         $extraService_str = $rs_bos_arr_response['ExtraService'];
                         $extraService_arr = explode(';', $extraService_str);
                         foreach ($extraService_arr as $extra_key => $extea_val) {
                             $extea_arr = explode(',', $extea_val);
                             $extraList[$extra_key]['id'] = isset($extea_arr[0]) ? $extea_arr[0] : '';
                             $extraList[$extra_key]['name'] = isset($extea_arr[1]) ? $extea_arr[1] : '';
                             $extraList[$extra_key]['amount'] = isset($extea_arr[2]) ? $extea_arr[2] : '';
                             $extraList[$extra_key]['value'] = isset($extea_arr[3]) ? $extea_arr[3] : '';
                         }
                     }
                     $rs_bos_arr_response['ExtraList'] = $extraList;
                     //处理额外服务格式[S]
                     $return_json = json_encode(array('status' => true, 'data' => $rs_bos_arr_response));
                 } else {
                     $return_json = json_encode(array('status' => true, 'data' => array()));
                     //没有查询到此订单
                 }
                 exit($return_json);
             } else {
                 if (!empty($rs_bos_arr['ErrorMsg'])) {
                     $return_json = json_encode(array('status' => false, 'error_msg' => '0x260001_' . $rs_bos_arr['ErrorMsg']));
                     exit($return_json);
                 }
             }
         }
         $return_json = json_encode(array('status' => false, 'error_msg' => '0x260002_bos接口返回数据异常!'));
     } else {
         $return_json = json_encode(array('status' => false, 'error_msg' => '0x260003_传入的json格式用误!'));
     }
     exit($return_json);
 }