report_tour的tour_name长度; 多日游的渠道价计算

feature/trippest
lyt 7 years ago
parent 78535daf0f
commit 7916d84dae

@ -60,6 +60,7 @@ class TulanduoApi extends CI_Controller
mb_regex_encoding("UTF-8"); mb_regex_encoding("UTF-8");
bcscale(4); bcscale(4);
$this->load->helper('array'); $this->load->helper('array');
$this->load->library('trippest');
$this->load->model('Orders_model'); $this->load->model('Orders_model');
$this->load->model('TuLanDuo_queryContentBuilder', 'tld_order'); $this->load->model('TuLanDuo_queryContentBuilder', 'tld_order');
// $this->output->enable_profiler(TRUE); // $this->output->enable_profiler(TRUE);
@ -399,20 +400,30 @@ class TulanduoApi extends CI_Controller
unset($vtf); unset($vtf);
} }
// 渠道价 // 渠道价
$partner_fee = 0;
$partner_fee_currency = 'RMB';
$pag_info = $this->analysis_productcode($detail_jsonResp->orderDetail->routeName, $detail_jsonResp->orderDetail->orderId); $pag_info = $this->analysis_productcode($detail_jsonResp->orderDetail->routeName, $detail_jsonResp->orderDetail->orderId);
$total_num = $detail_jsonResp->orderDetail->adultNum+$detail_jsonResp->orderDetail->childNum; $total_num = $detail_jsonResp->orderDetail->adultNum+$detail_jsonResp->orderDetail->childNum;
$partner_price = $this->Orders_model->get_partner_price($pag_info->PAG_Code, $total_num, $detail_jsonResp->orderDetail->travelDate); $all_pag = $this->trippest->get_complex_pag(strtoupper($pag_info->PAG_Code));
if ( ! empty($partner_price)) { foreach ($all_pag as $kp => $vp) {
$travel_fee_currency = $partner_price->PKP_Currency ? $partner_price->PKP_Currency : "RMB"; $partner_price = $this->Orders_model->get_partner_price(strtoupper($vp), $total_num, $detail_jsonResp->orderDetail->travelDate);
if (strval($partner_price->PKP_PriceType) === "1") { if ( ! empty($partner_price)) {
// 每团 $partner_fee_currency = $partner_price->PKP_Currency ? $partner_price->PKP_Currency : "RMB";
$travel_fee = $partner_price->PKP_AdultCost; if (strval($partner_price->PKP_PriceType) === "1") {
} else { // 每团
// 每人 $partner_fee += $partner_price->PKP_AdultCost;
$adult_price = bcmul($detail_jsonResp->orderDetail->adultNum, $partner_price->PKP_AdultCost); } else {
$child_price = bcmul($detail_jsonResp->orderDetail->childNum, $partner_price->PKP_ChildCost); // 每人
$travel_fee = bcadd($adult_price, $child_price); $adult_price = bcmul($detail_jsonResp->orderDetail->adultNum, $partner_price->PKP_AdultCost);
$child_price = bcmul($detail_jsonResp->orderDetail->childNum, $partner_price->PKP_ChildCost);
$partner_fee += bcadd($adult_price, $child_price);
}
} }
$partner_price = null;
}
if ($partner_fee > 0) {
$travel_fee = $partner_fee;
$travel_fee_currency = $partner_fee_currency;
} }
$coli_update_column = array( $coli_update_column = array(
"COLI_Memo" => substr($new_memo, 0, 400) "COLI_Memo" => substr($new_memo, 0, 400)

@ -128,7 +128,7 @@ class Order_finance extends CI_Controller {
$processed_cold_sn = array_merge($processed_cold_sn,$ret->pvt->cold_sn); $processed_cold_sn = array_merge($processed_cold_sn,$ret->pvt->cold_sn);
$report_tour_pvt['ordernumber'] = $ret->pvt->coli_id; $report_tour_pvt['ordernumber'] = $ret->pvt->coli_id;
$report_tour_pvt['tourCode'] = mb_substr($ret->pvt->PAG_Code, 0, 50); $report_tour_pvt['tourCode'] = mb_substr($ret->pvt->PAG_Code, 0, 50);
$report_tour_pvt['tourname'] = mb_substr($ret->pvt->pag_name, 0, 200); $report_tour_pvt['tourname'] = substr($ret->pvt->pag_name, 0, 200);
$report_tour_pvt['tourtime'] = $ret->pvt->startdate; $report_tour_pvt['tourtime'] = $ret->pvt->startdate;
$report_tour_pvt['tourRSd'] = $ret->pvt->adult_num; $report_tour_pvt['tourRSd'] = $ret->pvt->adult_num;
$report_tour_pvt['tourRSx'] = $ret->pvt->child_num; $report_tour_pvt['tourRSx'] = $ret->pvt->child_num;
@ -160,7 +160,7 @@ class Order_finance extends CI_Controller {
$cost_c = array(); $cost_c = array();
$cost_c['ordernumber'] = $cost->coli_id; $cost_c['ordernumber'] = $cost->coli_id;
$cost_c['tourCode'] = mb_substr(implode(',', array_unique(array_map(function($ele){ return $ele->real_code; }, $cost->order_cost))), 0, 50); $cost_c['tourCode'] = mb_substr(implode(',', array_unique(array_map(function($ele){ return $ele->real_code; }, $cost->order_cost))), 0, 50);
$cost_c['tourname'] = mb_substr($cost->pag_name, 0, 200) ; $cost_c['tourname'] = substr($cost->pag_name, 0, 200) ;
$cost_c['tourtime'] = $cost->startdate; $cost_c['tourtime'] = $cost->startdate;
$cost_c['tourRSd'] = $cost->order_cost[0]->adult_num; $cost_c['tourRSd'] = $cost->order_cost[0]->adult_num;
$cost_c['tourRSx'] = $cost->order_cost[0]->child_num; $cost_c['tourRSx'] = $cost->order_cost[0]->child_num;

@ -31,6 +31,49 @@ class Trippest
return $name; return $name;
} }
public function complex_tour()
{
return array(
"BJSIC-41" => array(
"name1" => "One Day Beijing Highlights Tour"
,"name2" => "北京精品一日游目的地BJSIC-41"
,"tours" => array(
"BJSIC-41"
)
)
,"BJSIC-42" => array(
"name1" => "Two-Day Beijing Boutique Small Group Tour"
,"name2" => "北京精品两日游目的地BJSIC-42"
,"tours" => array(
"BJSIC-41","BJSIC-42"
)
)
,"BJSIC-43" => array(
"name1" => "Three-Day Beijing Discovery Tour"
,"name2" => "北京精品三日游目的地BJSIC-43"
,"tours" => array(
"BJSIC-41","BJSIC-42","BJSIC-43"
)
)
,"XASIC-42" => array(
"name1" => " "
,"name2" => " "
,"tours" => array(
"XASIC-41","XASIC-42"
)
)
);
}
public function get_complex_pag($pag_code)
{
$all_set = $this->complex_tour();
if (isset($all_set[$pag_code])) {
return $all_set[$pag_code]['tours'];
}
return array($pag_code);
}
} }

Loading…
Cancel
Save