hotfix/远程访问多媒体中心
赵鹏 6 years ago
commit 6dbb0aaab6

@ -38,12 +38,9 @@
<!--@CUSTOM-CONENT@-->
@AMP-COMMON-FOOTER@
<amp-user-notification
layout=nodisplay
id="amp-user-notification">
Unsere Webseite verwendet Cookies um die Webseite st?ndig zu verbessern. Wenn Sie auf unserer Seite weitersurfen, stimmen Sie der Datenschutzerkl?rung zu.
<a class="btn cookiesAlertBtn" on="tap:amp-user-notification.dismiss">Ich stimme zu.</a>
</amp-user-notification>
@AMP-USERR-NOTIFICATION@
<div class="fixed-addthis"><amp-addthis width="320" height="48" layout="responsive" data-pub-id="ra-58255ecaa2c44e0d" data-widget-id="mip1"></amp-addthis></div>
<amp-animation id="showAnim"layout="nodisplay"><script type="application/json">{"duration":"200ms","fill":"both","iterations":"1","direction":"alternate","animations":[{"selector":"#scrollToTopButton","keyframes":[{"opacity":"1","visibility":"visible"}]}]}</script></amp-animation><amp-animation id="hideAnim"layout="nodisplay"><script type="application/json">{"duration":"200ms","fill":"both","iterations":"1","direction":"alternate","animations":[{"selector":"#scrollToTopButton","keyframes":[{"opacity":"0","visibility":"hidden"}]}]}</script></amp-animation><div id="marker"><amp-position-observer on="enter:hideAnim.start; exit:showAnim.start"layout="nodisplay"></amp-position-observer></div><a id="scrollToTopButton"on="tap:top-page.scrollTo(duration=200)"class="scrollToTop"></a>
<!--AMP Builder-->

@ -648,7 +648,7 @@ class addorders extends CI_Controller{
$PostData['TrainOrderService']->Order->User->UserName = 'guilintravel';
$PostData['TrainOrderService']->Order->User->userLoginName = 'guilintravel';
$PostData['TrainOrderService']->Order->User->UserMobile = '18877381547';
//print_r($PostData);die();
//print_r(json_encode($PostData));
//本地添加记录
$add_data = new stdClass();
$add_data->cold_sn = $cold_sn;
@ -673,11 +673,11 @@ class addorders extends CI_Controller{
$this->train_system_model->add_orders($add_data);
$Url = 'http://m.ctrip.com/restapi/soa2/11009/json/PartnerAddOrder';
$ResponseJson = GetPost_http($Url,json_encode($PostData),'POST');
$ResponseJson = GetPost_http($Url,json_encode($PostData),'json');
$ResponseData = json_decode($ResponseJson);
//echo '预定';
//print_r($ResponseData);
//print_r($ResponseData);die();
//预定请求成功后执行支付
if($ResponseData->Status == 'SUCCESS'){
@ -693,4 +693,38 @@ class addorders extends CI_Controller{
}
echo json_encode($reback);
}
//请求支付
public function payorders($CtripOrder,$Price){
if(empty($CtripOrder) && !is_numeric($Price)){
exit('传参错误!');
}
//生成报文
$PostData = array();
$TimeStamp = time();
$time = date('Y-m-d H:i:s',$TimeStamp);
$PostData['Authentication'] = new stdClass();
$PostData['Authentication']->TimeStamp = $time;
$PostData['Authentication']->ServiceName = 'order.PartnerPayOrder';
$PostData['Authentication']->PartnerName = ORDERUSER;
$MessageIdentity = md5($time.'order.PartnerPayOrder'.ORDERKEY);
$PostData['Authentication']->MessageIdentity = $MessageIdentity;
$PostData['TrainOrderService'] = new stdClass();
$PostData['TrainOrderService']->PartnerName = ORDERUSER;
$PostData['TrainOrderService']->OrderNumber = $CtripOrder;
$PostData['TrainOrderService']->PayedPrice = $Price;
//$PostData['TrainOrderService']->PayType = $time;
//$PostData['TrainOrderService']->TradeNumber = $time;
$Url = 'http://m.ctrip.com/restapi/soa2/11009/json/PartnerPayOrder';
$ResponseJson = GetPost_http($Url,json_encode($PostData),'json');
$ResponseData = json_decode($ResponseJson);
//echo '支付';
//print_r($ResponseData);
//支付同步回调信息 {"Status":"SUCCESS","PartnerName":"guilintravel","OrderNumber":"guilintravel1546071576","OperationDateTime":"2018-12-29 16:19:37","RetCode":0,"ResponseStatus":{"Timestamp":"\/Date(1546071577236+0800)\/","Ack":"Success","Errors":[],"Extension":[]}}
}
}

@ -153,9 +153,9 @@ class callback extends CI_Controller{
public function ctripcallback(){
$back_json = file_get_contents('php://input');
log_message('error','携程回调信息:'.$back_json);
/*$back_json = '{"Authentication":{"ServiceName":"web.order.returnTicketNotice","PartnerName":"tieyou","TimeStamp":"2019-1-18 11:35:22","MessageIdentity":"93F2BA3253829E8FAD29B5DEB7646A59"},"TrainOrderService":{"contactName":{},"contactMobile":{},"OrderNumber":"guilintravel1547778269","refundTicket":{"childBillId":{},"orderId":"8360041214","eOrderNumber":"EB59937931","eOrderType":"1","seatNumber":"01D\u53f7","passport":"544712454","passportName":"YANGFRANCISCHENG","realName":"YANGFRANCISCHENG","status":"1","reason":"\u9000\u7968\u6210\u529f\uff0c\u9000\u6b3e\u91d1\u989d:218.50\u5143"}}}';*/
//$back_json = '{"@attributes":{"xsi":"http:\/\/www.w3.org\/2001\/XMLSchema-instance"},"Authentication":{"TimeStamp":"2019-06-27 11:01:15","ServiceName":"web.order.notifyTicket","MessageIdentity":"08F97DF046FC32BB3F0CCBAF2DAAFB60","PartnerName":"tieyou"},"TrainOrderService":{"OrderInfo":{"OrderNumber":"guilintravel1561604425","ElectronicOrderNumber":"ED35331748","OrderType":"\u7535\u5b50","OrderTotleFee":"490.50","TicketInfo":{"OrderTicketFromStation":"\u54c8\u5c14\u6ee8\u897f","OrderTicketToStation":"\u5317\u4eac","OrderTicketYMD":"20190726","OrderTicketTime":"10:43","OrderTicketCheci":"D102","OrderTicketPrice":"490.50","OrderAcceptSeat":{"0":"\n "},"OrderTicketSeat":"\u4e00\u7b49\u5ea7","SeatNumber":"08\u8f66\u53a214F\u53f7","railwayTip":{"0":"\n "},"AuditTicketCount":"1","ChildTicketCount":"0","Passengers":{"Passenger":{"RealName":"SHCHERBAKOVOLEG","IdentityType":"\u62a4\u7167","NumberID":"655103175","TicketType":"\u6210\u4eba\u7968","Birth":{"0":"\n "},"InsuranceCount":"0"}}},"TicketInfoFinal":{"OrderTicketFromStation":"\u54c8\u5c14\u6ee8\u897f","OrderTicketToStation":"\u5317\u4eac","ChildBillid":{"0":"\n "},"ElectronicOrderNumber":"ED35331748","Result":"2","NoTicketReasons":{"0":"\n "},"OrderTicketYMD":"20190726","OrderTicketTime":"10:43","OrderTicketCheci":"D102","OrderTicketPrice":"490.50","SeatNumber":"08\u8f66\u53a214F\u53f7","railwayTip":{"0":"\n "},"TicketCheck":"\u68c0\u7968\u53e3B3\u53f7\u53e3","IsUserAcount":"0","ReturnFlag":"0","RescheduleFlag":"0","Tickets":{"Ticket":{"OrderTicketSeat":"\u4e00\u7b49\u5ea7","TicketType":"\u6210\u4eba\u7968","OrderTicketPrice":"490.50","TicketCount":"1","DetailInfos":{"DetailInfo":{"PassengerName":"SHCHERBAKOVOLEG","IdentityType":"\u62a4\u7167","NumberID":"655103175","SeatNo":"08\u8f66\u53a214F\u53f7"}}}}}}}}';
$ctrip_backdata = json_decode($back_json);
//print_r($ctrip_backdata);
//print_r($ctrip_backdata);die();
if(!empty($ctrip_backdata)){
$update_data = new stdClass();
$update_data->ServiceName = $ctrip_backdata->Authentication->ServiceName;
@ -192,6 +192,7 @@ class callback extends CI_Controller{
$data_passager = new stdClass();
$string = '';
$i = 0;
if($person_num > 1){
foreach ($ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->DetailInfos->DetailInfo as $items){
if(strpos($items->SeatNo,'车厢')){
@ -205,6 +206,7 @@ class callback extends CI_Controller{
}
//对订票乘客进行存储
$data_passager->status = '4';
$data_passager->ordernumber = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
$data_passager->realname = $items->PassengerName;
$data_passager->identitytype = $items->IdentityType;
@ -230,6 +232,7 @@ class callback extends CI_Controller{
}
//对订票乘客进行存储
$data_passager->status = '4';
$data_passager->ordernumber = $ctrip_backdata->TrainOrderService->OrderInfo->OrderNumber;
$data_passager->realname = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->DetailInfos->DetailInfo->PassengerName;
$data_passager->identitytype = $ctrip_backdata->TrainOrderService->OrderInfo->TicketInfoFinal->Tickets->Ticket->DetailInfos->DetailInfo->IdentityType;
@ -260,7 +263,9 @@ class callback extends CI_Controller{
$update_data->bookcallback = $back_json;
//添加支付记录
$add_train_payment_data = new stdClass();
$add_train_payment_data->TOC_Memo = $update_data->ordernumber;
//根据订单号获取cold_sn
$order_info = $this->train_system_model->get_order_info($update_data->ordernumber);
$cold_sn = $order_info->ts_cold_sn;
@ -288,7 +293,7 @@ class callback extends CI_Controller{
//退票时还需要单独对对每个乘客存储回调信息
$passpager_info = new stdClass();
$passpager_info->returncallback = $back_json;
$passpager_info->status = '7';
$passpager_info->OrderStatus = '7';
$passpager_info->ordernumber = $ctrip_backdata->TrainOrderService->OrderNumber;
$passpager_info->realname = $ctrip_backdata->TrainOrderService->refundTicket->realName;
$passpager_info->numberid = $ctrip_backdata->TrainOrderService->refundTicket->passport;

@ -259,6 +259,11 @@ class train_system_model extends CI_Model {
return $query->row();
}
public function get_order_info($ordernumber){
$sql = "select * from trainsystem where ts_ordernumber = '$ordernumber'";
$query = $this->INFO->query($sql);
return $query->row();
}
public function test(){
$sql = "delete from trainsystem where ts_cold_sn = '488121613_1552637689'";

@ -384,4 +384,33 @@ class Index extends CI_Controller {
print_r(json_encode($detail_data));
}
}
public function ajax_get_reviews(){
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST, GET');
header('Access-Control-Max-Age:0');
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
header('Access-Control-Allow-Credentials:true');
$destination = $this->input->get_post('destination');
if(empty($destination)){
header("HTTP/1.1 404 Not Found");
exit('{"status":"404","reason":"请输入站点代码!"}');
}else{
$return_data = array();
$ta_website = $this->config->item('tripadvisor_website');
if(empty($ta_website[$destination])){
header("HTTP/1.1 404 Not Found");
exit('{"status":"404","reason":"请输入正确的站点代码!"}');
}
$return_data['list_url'] = str_replace('{PAGENUM}','',$ta_website[$destination]);
//根据站点获取评论
$list_reviews = $this->Tripadvisor_Review_model->get_fivelatestreviews($destination);
$return_data['list_reviews'] = $list_reviews;
print_r(json_encode($return_data));
}
}
}

@ -195,5 +195,21 @@ class Tripadvisor_Review_model extends CI_Model {
$query = $this->INFO->query($sql,array($destination));
return $query->result();
}
public function get_fivelatestreviews($destination){
$sql = 'select top 5
tr_review_title,
tr_content,
tr_member_name,
tr_member_loc,
tr_member_starts,
tr_review_date,
tr_visited_date,
tr_review_pics,
tr_datetime
from Ta_Reviews where tr_destination = ? and tr_member_starts = 5 order by tr_review_date desc';
$query = $this->INFO->query($sql,array($destination));
return $query->result();
}
}

@ -4,6 +4,7 @@ $config["trade_type"] = "NATIVE";
$config["currency"] = "CNY";
$config["currency_unit"] = 100;
$config["method_code"] = 15016;
$config["send_notify_url"] = "https://www.mycht.cn/webht.php/apps/pay/paymentservice/send_notify";
/*!
* 各账号的设置
*/

@ -130,7 +130,7 @@ class AlipayTradeService extends CI_Controller
,NULL
,strval($asyns_resp->data->gmt_create)
,strval($asyns_resp->data->gmt_payment)
,json_encode($asyns_resp->data)
,json_encode($asyns_resp->data,JSON_UNESCAPED_UNICODE)
,$notify_type
,$code
,strval($asyns_resp->data->trade_status)
@ -147,7 +147,7 @@ class AlipayTradeService extends CI_Controller
,NULL
,strval($asyns_resp->data->gmt_refund)
,strval($asyns_resp->data->notify_time)
,json_encode($asyns_resp->data)
,json_encode($asyns_resp->data,JSON_UNESCAPED_UNICODE)
,$notify_type
,$code
,strval($asyns_resp->data->trade_status)
@ -357,6 +357,12 @@ class AlipayTradeService extends CI_Controller
continue;
}
//检测是否是APP订单
if ((strpos($item->ALI_memo, 'China Train Booking') !== false) || (strpos($item->ALI_memo, 'ChinaTrainBooking') !== false)) {
$item->ALI_orderId .= "_A";
// $this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
}
//退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理
if ($item->ALI_payType == 'refund') {
$this->send_refund($item);
@ -370,12 +376,6 @@ class AlipayTradeService extends CI_Controller
continue;
}
//检测是否是APP订单,默认不处理
// if ((strpos($item->pn_memo, 'China Train Booking') !== false) || (strpos($item->pn_memo, 'ChinaTrainBooking') !== false)) { //APP自动出票的订单不需要处理
// $this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
// continue;
// }
//根据note信息找到订单号
$orderid_info = analysis_orderid($item->ALI_orderId);
@ -399,7 +399,7 @@ class AlipayTradeService extends CI_Controller
$this->Alipay_note_model->set_invoice($item->ALI_dealId, $orderid_info->orderid . '_' . $orderid_info->ordertype);
//检测是否是APP订单,默认不处理
if ($orderid_info->ordertype == 'A') { //APP自动出票的订单不需要处理
if ($orderid_info->ordertype == 'A' && $item->ALI_payType == 'pay') { //APP自动出票的订单不需要处理
$this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
continue;
}
@ -537,15 +537,15 @@ class AlipayTradeService extends CI_Controller
$parent_note = $this->Alipay_note_model->note($parent_trade_no);
// APP 组的退款查不到原始收款记录 todo
if (empty($parent_note) ) { # && true === $this->Alipay_note_model->if_APP_order($parent_order) ) {
// $parent_note = $parent_payment;
$parent_note = $item;
// 补充字段
// $parent_note->IPL_orderId = $parent_order . '_B';
// $parent_note->IPL_currencyCode = $parent_payment->currencyCode;
// $parent_note->IPL_payerName = strval("''");
// $parent_note->IPL_payerEmail = strval("''");
$this->Alipay_note_model->update_send($item->ALI_dealId, 'sendfail');
return false;
// $this->Alipay_note_model->update_send($item->ALI_dealId, 'sendfail');
// return false;
}
//订单号
$orderid_info = analysis_orderid($parent_note->ALI_orderId);
@ -641,10 +641,10 @@ class AlipayTradeService extends CI_Controller
$this->Alipay_note_model->update_send($item->ALI_dealId, 'sendfail');
return false;
}
$send_email = ($item->ALI_completeTime>date('Y-m-d', strtotime("-1 day")));
//添加邮件发送记录
// if (true) { // test
if ($item->ALI_sent !== 'send' && substr($item->ALI_sent, 0, 5) !== 'send-') {
if ($send_email===true && $item->ALI_sent !== 'send' && substr($item->ALI_sent, 0, 5) !== 'send-') {
// 客人邮件中的外联落款
// $web_code = 'cht'; // 默认cht
$web_lgc = 1;
@ -701,11 +701,17 @@ class AlipayTradeService extends CI_Controller
$c_M_AddTime,
'ChinaHighlights refund receipt');
$this->Alipay_note_model->update_send($item->ALI_dealId, 'send-customer');
} else {
$this->Alipay_note_model->update_send($item->ALI_dealId, 'send');
}
//添加邮件发送记录 end
// TODO 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录
if ($this->payment_model->if_finance_exists($advisor_info->COLI_GRI_SN)===true) {
$this->Note_model->update_send($item->ALI_dealId, 'send-to-finance');
// 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录
// 更新是否需要发送财务
$refund_finance_day = 20;
$now_day = date('d');
$late_entry_date_set = $now_day<$refund_finance_day ? date('Y-m-01', strtotime("-1 month")) : date('Y-m-01');
if ($this->payment_model->if_finance_done($advisor_info->COLI_GRI_SN, $late_entry_date_set) === true) {
$this->Alipay_note_model->update_send($item->ALI_dealId, 'send-to-finance');
}
return ;
}
@ -779,19 +785,152 @@ class AlipayTradeService extends CI_Controller
*/
public function get_billfile($date=NULL)
{
ignore_user_abort(true);
$request = new AlipayDataDataserviceBillDownloadurlQueryRequest();
$date = $date===NULL ? "2019-05-16" : $date;
$date = $date===NULL ? date("Y-m-d", strtotime("-1 day")) : $date;
$request->setBizContent("{" .
"\"bill_type\":\"signcustomer\"," .
"\"bill_date\":\"$date\"" .
"}");
$response = $this->aopclientRequestExecute ($request);
// var_dump($response);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
var_dump($response->$responseNode);
// $resultCode = $result->$responseNode->code;
// if(!empty($resultCode)&&$resultCode == 10000){
// }
$resultCode = $response->$responseNode->code;
if(empty($resultCode) || strval($resultCode) !== "10000"){
return false;
}
set_time_limit(0);
$file = file_get_contents($response->$responseNode->bill_download_url);
$file_name = FCPATH.'download_statement\settlement_files\alipay\\' . $date . ".zip";
$target = FCPATH.'download_statement\settlement_files\alipay\\' . $date ;
file_put_contents($file_name, $file);
$biz_detail_table = array();
$biz_data_title = $this->bill_data_title();
$finance_data_title = $this->finance_data_title();
$zip = zip_open($file_name);
if ($zip) {
while ($zip_entry = zip_read($zip)) {
if (zip_entry_open($zip, $zip_entry, "r")) {
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
$content_convert = mb_convert_encoding($buf, 'UTF-8', 'GB2312');
$content_row = explode("\n", $content_convert);
if (stripos($content_row[0], "业务明细")) {
$data_title = $biz_data_title;
} elseif (stripos($content_row[0], "账务明细")) {
$data_title = $finance_data_title;
} else {
zip_entry_close($zip_entry);
continue;
}
for ($i=5; $i < count($content_row); $i++) {
if (stripos($content_row[$i], "结束")) {
break;
}
$row = explode(',',$content_row[$i]);
$row_arr = array();
foreach ($data_title as $key => $title) {
if ( ! isset($row[$key])) {
continue;
}
$row_arr[$title] = trim($row[$key]);
}
$biz_detail_table[] = $row_arr;
}
zip_entry_close($zip_entry);
}
}
zip_close($zip);
}
if (empty($biz_detail_table)) {
return false;
}
foreach ($biz_detail_table as $key => $row) {
$total_amount = 0;$trade_type='';$trade_no = '';$has_charge=null;
if (isset($row['finance_id'])) {
if ($row['biz_type'] !== '其它') {
continue;
}
$total_amount = floatval($row['income'])>0 ? $row['income'] : $row['expenditure'];
$trade_type = floatval($total_amount)>0 ? 'pay' : 'refund';
$trade_no = $row['trade_no'];
} else if (!empty($row['refund_id'])) {
$total_amount = bcadd($row['total_amount'],$row['charge_fee']);
$trade_type = 'refund';
$trade_no = $row['refund_id'];
} else {
$total_amount = ($row['total_amount']);
$trade_type = 'pay';
$trade_no = $row['trade_no'];
$has_charge = floatval($row['charge_fee'])==0 ? 1 : null;
}
$this->Alipay_note_model->save_alipay(
$trade_no
,strval($row['out_trade_no'])
,"CNY"
,strval($total_amount)
,NULL
,$has_charge
,strval($row['complete_time'])
,strval($row['complete_time'])
,json_encode($row,JSON_UNESCAPED_UNICODE)
,$trade_type
,null
,'TRADE_SUCCESS'
,NULL
,$row['buyer_user_name']
,null,true
);
}
return;
}
public function bill_data_title()
{
return array(
"trade_no", // 支付宝交易号
"out_trade_no", // 商户订单号
"trade_type", // 业务类型
"subject", // 商品名称
"create_time", // 创建时间
"complete_time", // 完成时间
"store_id", // 门店编号
"store_name", // 门店名称
"operator", // 操作员
"terminal_id", // 终端号
"buyer_user_name", // 对方账户
"total_amount", // 订单金额(元)
"receipt_amount", // 商家实收(元)
"coupon_amount", // 支付宝红包(元)
"point_amount", // 集分宝(元)
"alipayaccount_amount", // 支付宝优惠(元)
"mdiscount_amount", // 商家优惠(元)
"discount_amount", // 券核销金额(元)
"discount_name", // 券名称
"mcoupon_amount", // 商家红包消费金额(元)
"pcard_amount", // 卡消费金额(元)
"refund_id", // 退款批次号/请求号
"charge_fee", // 服务费(元)
"royalty_fee", // 分润(元)
"body" // 备注
);
}
public function finance_data_title()
{
return array(
"finance_id",// 账务流水号
"trade_no",// 业务流水号
"out_trade_no",// 商户订单号
"subject",// 商品名称
"complete_time",// 发生时间
"buyer_user_name",// 对方账号
"income",// 收入金额(+元)
"expenditure",// 支出金额(-元)
"balance",// 账户余额(元)
"trading_channel",// 交易渠道
"biz_type",// 业务类型:交易退款,在线支付,收费,其它
"remark"// 备注
);
}
/**
@ -872,7 +1011,7 @@ var_dump($response->$responseNode);
,1 // 此处1表示通过收款码进来的, 不收手续费, 后续录入时分别处理
,strval($query_pay->send_pay_date)
,strval($query_pay->send_pay_date)
,json_encode($query_pay)
,json_encode($query_pay,JSON_UNESCAPED_UNICODE)
,$pay_type
,NULL
,strval($query_pay->trade_status)

@ -32,6 +32,27 @@ class PaymentService extends CI_Controller {
} else {
$data['notelist'] = $this->note_model->search_date($data['date']);
}
array_walk($data["notelist"], function(&$ele, $key)
{
$ele->brand_name = "none";
switch ($ele->OPN_accountMethod) {
case '15016':
$ele->brand_name = "WeChat";
break;
case '15010':
case '15002':
$ele->brand_name = "PayPal";
break;
case '15018':
$ele->brand_name = "Credit Card";
break;
case '15015':
$ele->brand_name = "Alipay";
break;
default:
break;
}
});
/**
* 导出记录用的记录节点
@ -56,6 +77,7 @@ class PaymentService extends CI_Controller {
public function send_notify($opn_id=NULL, $old_ssje=NULL)
{
ignore_user_abort(true);
$output = "处理交易记录:<br>";
$data = array();
$show_index = 0;
//优先处理指定的交易号,用于修正交易号直接发送通知
@ -254,11 +276,12 @@ class PaymentService extends CI_Controller {
//显示处理记录
if (empty($opn_id)) {
echo ++$show_index . ' ' . $item->OPN_transactionId . '<br/>';
$output .= (++$show_index) . ' ' . $item->OPN_transactionId . '<br/>';
}
}
return;
echo $output;
return $output;
// return $this->output->set_content_type('application/json')->set_output(json_encode($data));
}
@ -405,7 +428,9 @@ class PaymentService extends CI_Controller {
$data['order_info'] = $this->account_model->get_order($orderid_info->orderid, true, $orderid_info->ordertype);
if ($orderid_info->ordertype === 'T') {
$data['gai_info'] = $this->account_model->get_money_t($pn_txn_id);
} elseif ($orderid_info->ordertype === 'B' || $orderid_info->ordertype === 'TP') {
} elseif ($orderid_info->ordertype === 'B' || $orderid_info->ordertype === 'TP'
|| $orderid_info->ordertype === 'A'
) {
$data['gai_info'] = $this->account_model->get_money_b($pn_txn_id);
}
}
@ -440,7 +465,9 @@ class PaymentService extends CI_Controller {
$old_ssje = $data['gai_info'][0]->GAI_SSJE;
$this->account_model->delete_money_t($pn_txn_id);
}
} elseif ($orderid_info->ordertype === 'B' || $orderid_info->ordertype === 'TP') {
} elseif ($orderid_info->ordertype === 'B' || $orderid_info->ordertype === 'TP'
|| $orderid_info->ordertype === 'A'
) {
$data['gai_info'] = $this->account_model->get_money_b($pn_txn_id);
if ( ! empty($data['gai_info'])) {
$old_ssje = $data['gai_info'][0]->GAI_SSJE;

@ -91,6 +91,8 @@ class WxpayService extends CI_Controller {
foreach ($all_account as $account) {
$this->download_bill($account);
}
async_curl($this->config->item('send_notify_url', 'wxpay'));
async_curl('https://www.mycht.cn/webht.php/apps/pay/alipaytradeservice/get_billfile');
return;
}

@ -770,10 +770,13 @@ class IPayLinksService extends CI_Controller
}
//添加邮件发送记录 end
// 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录
if ($this->payment_model->if_finance_exists($advisor_info->COLI_GRI_SN)===true) {
// 更新是否需要发送财务
$refund_finance_day = 20;
$now_day = date('d');
$late_entry_date_set = $now_day<$refund_finance_day ? date('Y-m-01', strtotime("-1 month")) : date('Y-m-01');
if ($this->payment_model->if_finance_done($advisor_info->COLI_GRI_SN, $late_entry_date_set) === true) {
$this->Note_model->update_send($item->IPL_dealId, 'send-to-finance');
}
return ;
}

@ -1,17 +1,17 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function array_unique_fb($array2D)
{
foreach ($array2D as $v)
{
$v = join(",",$v); //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
$temp[] = $v;
}
$temp = array_unique($temp); //去掉重复的字符串,也就是重复的一维数组
foreach ($temp as $k => $v)
{
$temp[$k] = explode(",",$v); //再将拆开的数组重新组装
}
return $temp;
foreach ($array2D as $v)
{
$v = join(",",$v); //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
$temp[] = $v;
}
$temp = array_unique($temp); //去掉重复的字符串,也就是重复的一维数组
foreach ($temp as $k => $v)
{
$temp[$k] = explode(",",$v); //再将拆开的数组重新组装
}
return $temp;
}
function my_array_unique($array, $keep_key_assoc = false)
@ -39,30 +39,70 @@ function my_array_unique($array, $keep_key_assoc = false)
//根据URL获取月份
function getaqiMonth($url){
$monArr = array('January','February','March','April','May','June','July','August','September','October','November','December');
$monObj = array(
'January' => '01',
'February' => '02',
'March' => '03',
'April' => '04',
'May' => '05' ,
'June' => '06',
'July' => '07',
'August' => '08',
'September' => '09',
'October' => '10',
'November' => '11',
'December' => '12');
$urlarr = explode("/",$url);
$tmp = $urlarr[(count($urlarr)-1)];
$tmp = ucfirst(str_ireplace('.htm','',$tmp));
//$d=strtotime("00:01am ".$tmp." 15 2015");
if(in_array($tmp,$monArr)){
return $monObj[$tmp];
}else{
return false;
}
$monArr = array('January','February','March','April','May','June','July','August','September','October','November','December');
$monObj = array(
'January' => '01',
'February' => '02',
'March' => '03',
'April' => '04',
'May' => '05' ,
'June' => '06',
'July' => '07',
'August' => '08',
'September' => '09',
'October' => '10',
'November' => '11',
'December' => '12');
$urlarr = explode("/",$url);
$tmp = $urlarr[(count($urlarr)-1)];
$tmp = ucfirst(str_ireplace('.htm','',$tmp));
//$d=strtotime("00:01am ".$tmp." 15 2015");
if(in_array($tmp,$monArr)){
return $monObj[$tmp];
}else{
return false;
}
}
/*!
* @Author: LYT
* @Date: 2019-06-27 10:32:11
* @Desc: 异步的curl,1秒超时,被请求的地址需要设置: ignore_user_abort(true);
*/
function async_curl($url, $second = 1)
{
log_message('error','Webht Async Call: '. $url);
$ch = curl_init();
$curlVersion = curl_version();
$ua = "Webht (".PHP_OS.") PHP/".PHP_VERSION." CURL/".$curlVersion['version']." " . "AsyncJob";
//设置超时
curl_setopt($ch, CURLOPT_TIMEOUT, $second);
curl_setopt($ch,CURLOPT_URL, $url);
if(stripos($url,"https://")!==FALSE){
// curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
} else {
// curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,TRUE);
// curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);//严格校验
}
curl_setopt($ch,CURLOPT_USERAGENT, $ua);
//设置header
curl_setopt($ch, CURLOPT_HEADER, FALSE);
//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
//运行curl
$data = curl_exec($ch);
if (curl_errno($ch) && !in_array(curl_errno($ch),array(0,28)) ) {
log_message('error',"Webht Async Curl Call 出错,错误码:" . curl_errno($ch) . ": " . curl_error($ch) . ", url: " . $url);
}
if (!in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE),array(0,200)) ) {
log_message('error', "Webht Async Curl Call Request html Status Code: ".curl_getinfo($ch, CURLINFO_HTTP_CODE)."; curl url: ".$url);
}
curl_close($ch);
return $data;
}
/*
* 把数组元素组合为字符串
* $container:用来包含元素的符号
@ -230,3 +270,19 @@ function from_xml($xml)
return json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
}
/*!
* 转换字符集编码
* @param $data
* @param $targetCharset
* @return string
*/
function characet($data, $targetCharset) {
if (!empty($data)) {
$fileType = "UTF-8";
if (strcasecmp($fileType, $targetCharset) != 0) {
$data = mb_convert_encoding($data, $targetCharset, $fileType);
// $data = iconv($fileType, $targetCharset.'//IGNORE', $data);
}
}
return $data;
}

@ -164,6 +164,7 @@ class Wxpay_call
log_message('error',"curl出错错误码:$error " . curl_error($ch));
curl_close($ch);
}
return;
}

@ -89,8 +89,15 @@ class Alipay_note_model extends CI_Model {
* @author LYT <lyt@hainatravel.com>
* @date 2017-08-29
*/
public function save_alipay($ALI_dealId,$ALI_orderId,$ALI_currencyCode,$ALI_orderAmount,$ALI_payAmount,$ALI_stateCode,$ALI_acquiringTime,$ALI_completeTime,$ALI_memo,$ALI_payType,$ALI_resultCode=null,$ALI_resultMsg=null,$ALI_payerName=null,$ALI_payerEmail=NULL) {
$sql = "
public function save_alipay($ALI_dealId,$ALI_orderId,$ALI_currencyCode,$ALI_orderAmount,$ALI_payAmount,$ALI_stateCode,$ALI_acquiringTime,$ALI_completeTime,$ALI_memo,$ALI_payType,$ALI_resultCode=null,$ALI_resultMsg=null,$ALI_payerName=null,$ALI_payerEmail=NULL, $check_exists=false) {
$sql = $check_exists===false ? "" : "
IF NOT EXISTS(
SELECT TOP 1 1
FROM AlipayLog
WHERE ALI_dealId = '$ALI_dealId'
)
";
$sql .= "
INSERT INTO AlipayLog
(
ALI_dealId,ALI_orderId,ALI_currencyCode,ALI_orderAmount,ALI_payAmount,ALI_stateCode,ALI_acquiringTime,ALI_completeTime,ALI_memo,ALI_sent,ALI_noticeTime,ALI_payType,ALI_resultCode,ALI_resultMsg,ALI_payerName,ALI_payerEmail

@ -348,7 +348,6 @@ class Online_payment_account_model extends CI_Model {
and cgi.CGI_GRI_SN=? ";
return $this->HT->query($sql, array($gri_sn))->num_rows() > 0;
}
// 商务订单没有生成团信息
public function if_finance_done($gri_sn, $late_date)
{
$sql = "SELECT top 1 1
@ -356,6 +355,7 @@ class Online_payment_account_model extends CI_Model {
where GRI_SN=?
and GRI_EntranceDate < ?
";
// 商务订单没有生成团信息
if ($this->HT->query($sql, array($gri_sn,$late_date))->num_rows() === 0) {
$sql = "SELECT top 1 1
from BIZ_ConfirmLineInfo coli

@ -21,6 +21,12 @@
.search-btn{cursor: pointer; background: url(//data.chinahighlights.com/css/images/global/site-search-button.png) no-repeat center center;}
.input-check{width: 20px;height: 20px;}
label span{vertical-align: super;}
.brand_text {color: #fff; padding: 2px 3px; border-radius: 4px;font-style: italic;}
/* .wechat-color {background-color: #00C800;} */
.wechat-color {background-color: #62B900;}
.paypal-color {background-color: #002D89;}
.alipay-color {background-color: #00AAEE;}
.ipaylinks-color,.creditcard-color {background-color: #A31022;}
</style>
</head>
<body>
@ -192,7 +198,8 @@
?>
<tr>
<td><?php echo $key+1; ?></td>
<td><?php echo $item->OPN_orderId . ' / ' . $item->OPN_orderAmount . $item->OPN_currency; ?></td>
<td><span class="brand_text <?php echo strtolower(str_replace(" ","",$item->brand_name))."-color"; ?>"><?php echo $item->brand_name; ?></span>
<?php echo $item->OPN_orderId . ' / ' . $item->OPN_orderAmount . $item->OPN_currency; ?></td>
<td>
<?php
echo $item->OPN_payerEmail;

@ -1003,8 +1003,6 @@ class Index extends CI_Controller {
/*!
* 退款处理
* @date 2019-05-05
* TODO:
* * 退款的记录增加发送财务的状态
*/
public function send_refund($item, $handpick, $old_ssje=NULL)
{
@ -1136,7 +1134,11 @@ class Index extends CI_Controller {
}
//添加邮件发送记录 end
// 如果已做账, 标记需要通知财务send-to-finance, 通知时间用订单日志记录
if ($this->Paypal_model->if_finance_exists($advisor_info->COLI_GRI_SN)===true) {
// 更新是否需要发送财务
$refund_finance_day = 20;
$now_day = date('d');
$late_entry_date_set = $now_day<$refund_finance_day ? date('Y-m-01', strtotime("-1 month")) : date('Y-m-01');
if ($this->Paypal_model->if_finance_done($advisor_info->COLI_GRI_SN, $late_entry_date_set) === true) {
$this->Note_model->update_send($item->pn_txn_id, 'send-to-finance', $item->pn_sn);
}
return ;

@ -687,4 +687,22 @@ class Paypal_model extends CI_Model {
and cgi.CGI_GRI_SN=? ";
return $this->HT->query($sql, $gri_sn)->num_rows() > 0;
}
public function if_finance_done($gri_sn, $late_date)
{
$sql = "SELECT top 1 1
from groupinfo gri
where GRI_SN=?
and GRI_EntranceDate < ?
";
// 商务订单没有生成团信息
if ($this->HT->query($sql, array($gri_sn,$late_date))->num_rows() === 0) {
$sql = "SELECT top 1 1
from BIZ_ConfirmLineInfo coli
inner join BIZ_ConfirmLineDetail cold on COLD_COLI_SN=COLI_SN and isnull(cold.DeleteFlag,0)=0
where COLI_GRI_SN=?
and COLD_StartDate<?";
return $this->HT->query($sql, array($gri_sn,$late_date))->num_rows() > 0;
}
return false;
}
}

@ -471,6 +471,8 @@ class TulanduoApi extends CI_Controller
$cold_update_column["COLD_ServiceSN2"] = $pag_info->pag_sub;
$cold_update_column["COLD_ServiceCity"] = $pag_info->serviceinfo->PAG_CII_SN;
$cold_update_column["COLD_PlanVEI_SN"] = $vei_SN;
$cold_update_column["COLD_StartDate"] = $detail_jsonResp->orderDetail->travelDate;
$cold_update_column["COLD_EndDate"] = $detail_jsonResp->orderDetail->leaveDate;
}
$this->Order_update->cold_where_update = " COLD_SN=" . $cold_sn;
$this->Order_update->biz_confirmlinedetail_update($cold_update_column);

@ -90,7 +90,7 @@ class Order_finance extends CI_Controller {
$report_order['qtMoney'] = 0;
$report_order['orderstats'] = 1;
$report_order['ordernumber'] = $order_info->ordernumber;
$report_order['TuanName'] = mb_substr($order_info->TuanName, 0, 50);
$report_order['TuanName'] = mb_convert_encoding(substr($order_info->TuanName, 0, 50), 'UTF-8');
$report_order['operater'] = $order_info->operater;
$report_order['Agenter'] = mb_substr($order_info->Agenter,0,10);
$report_order['ChinaName'] = $order_info->ChinaName;

@ -169,7 +169,7 @@ function real_phone_number($phone, $nation_code)
function calc_age($birthday)
{
$now = new DateTime();
$birth = new DateTime(strstr($birthday, " ", TRUE));
$birth = new DateTime($birthday);
$date_d = $now->diff($birth);
$d_t = ($date_d->format("%y"));
return $d_t;
@ -181,7 +181,7 @@ function calc_age_type($birthday)
return 1;
}
$age = calc_age($birthday);
if ($age < 18) {
if ($age > 0 && $age < 18) {
return 2;
}
return 1;

@ -246,7 +246,7 @@ class Tulanduo
$this_otherinfo .= "; " . $vg->Gender;
}
if (strval($vg->BirthDay) !== '') {
$this_otherinfo .= "; 生日:". $vg->BirthDay;
$this_otherinfo .= "; 生日:". $vg->BirthDay . "; " . calc_age($vg->BirthDay) . "岁";
}
if (strval($vg->PassportValidDate) !== '') {
$this_otherinfo .= "; 护照有效期:" . $vg->PassportValidDate;
@ -315,6 +315,7 @@ class Tulanduo
}
// 查询是否变更 deprecated at 2019-05
$sync_orderstate = 10;
$set_update = false;
$this->ci->tldOrderBuilder->clearModifyLogInfo();
$resp = $this->excute_curl($this->neworder_url, $this->ci->tldOrderBuilder);
$response = json_decode($resp);
@ -364,6 +365,9 @@ class Tulanduo
if (intval($pag->PAG_DEI_SN)===1 && ! empty($pag->PAG_Code)) {
$pag->PAG_Code = $this->ci->trippest->ch_code_transfer( mb_strtoupper($pag->PAG_Code));
$pag->PAG_ExtendType = $this->tulanduo_trippest_pag[$pag->PAG_Code]->PAG_ExtendType;
} else if (false !== stripos($pag->GRD_Landscape, 'trippest')) {
$apart["com"]['details'][$pag->PAG_Code][] = $pag;
continue;
}
if (empty($pag->PAG_Code)) // 已在grd查询中增加是否目的地产品的判断
{
@ -374,7 +378,7 @@ class Tulanduo
$pag->PAG_Title = $this->tulanduo_trippest_pag[$pag->PAG_Code]->PAG_Title;
}
// 合作的产品
if ($this->ci->trippest->if_tour_pvt(array($pag))===1) {
if ($this->ci->trippest->if_tour_pvt(array($pag))===1 || isset($pag->is_biz)) {
$apart["pvt"]['details'][] = $pag;
} else {
$apart["com"]['details'][$pag->PAG_Code][] = $pag;
@ -394,6 +398,9 @@ class Tulanduo
if ($vi !== $vp) {
unset($apart_com[$vi]);
}
if (empty($apart_com[$vp]['details'])) {
$apart_com[$vp]['details'] = array();
}
// $apart_com[$vp]['details'][] = $apart['com']['details'][$vi];
$apart_com[$vp]['details'] = array_merge($apart_com[$vp]['details'], $apart['com']['details'][$vi]);
$apart_com[$vp]['PAG_Code'] = $vp;

@ -20,10 +20,11 @@ class Group_model extends CI_Model {
from VendorArrangeState vas
inner join Eva_ObjectInfo eoi on EOI_GRI_SN=VAS_GRI_SN and EOI_Type=1 and EOI_ObjSN=VAS_VEI_SN
inner join GRoupInfo gri on GRI_SN=VAS_GRI_SN
where 1=1 AND VAS_VEI_SN in ($vendor_str) ";
$sql .= $gri_sn!==0 ? $gri_sql : "
where 1=1 AND VAS_VEI_SN in ($vendor_str)
AND isnull(VAS_IsCancel,0)=0 AND isnull(VAS_Delete,0)=0 AND isnull(vas.DeleteFlag,0)=0
AND VAS_IsSendSucceed=1 AND isnull(VAS_IsReceive,0)=0
AND VAS_IsSendSucceed=1 ";
$sql .= $gri_sn!==0 ? $gri_sql : "
AND isnull(VAS_IsReceive,0)=0
-- AND EOI_GetDate between '$start_date' AND '$end_date'
AND EOI_GetDate > CONVERT(date, GETDATE())
AND isnull(VAS_IsConfirm,0)=0 AND VAS_ConfirmSN IS NULL
@ -102,9 +103,10 @@ class Group_model extends CI_Model {
$vgrd->ACI_PersonNum = intval($vcold->COLD_PersonNum);
$vgrd->ACI_ChildNum = intval($vcold->COLD_ChildNum);
$vgrd->ACI_BabyNum = intval($vcold->COLD_BabyNum);
$vgrd->PAG_DEI_SN = $vcold->PAG_DEI_SN;
$vgrd->PAG_DEI_SN = $vcold->PAG_DEI_SN ? $vcold->PAG_DEI_SN : 0;
$vgrd->PAG_sub_sn = intval($vcold->COLD_ServiceSN2);
$vgrd->vendor_memo = trim($vcold->COLD_vendorMemo);
$vgrd->is_biz = 1;
if ( strval($vcold->COLD_ServiceType)==='D') {
$vgrd->PAG_Code = mb_strtoupper($vcold->PAG_Code);
$vgrd->PAG_ExtendType = mb_strtoupper($vcold->PAG_ExtendType);
@ -147,7 +149,7 @@ class Group_model extends CI_Model {
*
from ArrangeConfirmInfo aci
left join BIZ_PackageInfo on PAG_SN=ACI_ServiceSN
and ACI_ServiceType='D' and PAG_DefaultVEI_SN=ACI_VEI_SN
and ACI_ServiceType='D' --and PAG_DefaultVEI_SN=ACI_VEI_SN
-- 增加是否目的地产品的判断
and SUBSTRING(CONVERT(varchar(10), PAG_SourceType) ,1,3)='132'
where 1=1
@ -199,12 +201,16 @@ class Group_model extends CI_Model {
return $this->HT->query($sql, array($gri_sn))->result();
}
public function get_sync_info($vas, $tour_code="")
public function get_sync_info($vas, $external_id=null, $tour_code="")
{
$sql = "SELECT *
from VendorPlanSendout
where VPS_VAS_SN=? ";
$param_arr = array($vas);
if ($external_id !== null) {
$sql .= " AND VPS_externalId=? ";
$param_arr[] = $external_id;
}
if ($tour_code !== "") {
$sql .= " AND VPS_tourCode=? ";
$param_arr[] = $tour_code;

Loading…
Cancel
Save