diff --git a/application/third_party/tripadvisor_spider/config/config.php b/application/third_party/tripadvisor_spider/config/config.php
index 022d61f8..3b452f64 100644
--- a/application/third_party/tripadvisor_spider/config/config.php
+++ b/application/third_party/tripadvisor_spider/config/config.php
@@ -18,10 +18,10 @@ $config['tripadvisor_website'] = array(
'Zhangjiajie' => 'http://www.tripadvisor.com/Attraction_Review-g494933-d8077695-Reviews{PAGENUM}China_Highlights_Zhangjiajie_Day_Tour-Zhangjiajie_Hunan.html',
'HongKong' => 'https://www.tripadvisor.com/Attraction_Review-g294217-d10243951-Reviews{PAGENUM}China_Highlights_Hong_Kong-Hong_Kong.html',
'Panda' => 'https://www.tripadvisor.com/Attraction_Review-g297463-d11489225-Reviews{PAGENUM}China_Highlights-Chengdu_Sichuan.html',
- 'tp_Beijing' => 'https://www.tripadvisor.com/Attraction_Review-g294212-d4006739-Reviews-The_Trippest_Mini_Group_Tours-Beijing.html',
- 'tp_Xian' => 'https://www.tripadvisor.com/Attraction_Review-g298557-d10999897-Reviews-Xi_an_Trippest_Mini_Group_Tours-Xi_an_Shaanxi.html',
- 'tp_Shanghai' => 'https://www.tripadvisor.com/Attraction_Review-g308272-d6222868-Reviews-Shanghai_Trippest_Mini_Group_Tours-Shanghai.html',
- 'tp_Guilin' => 'https://www.tripadvisor.com/Attraction_Review-g298556-d14121459-Reviews-Trippest_Mini_Group_Tours-Guilin_Guangxi.html'
+ 'tp_Beijing' => 'https://www.tripadvisor.com/Attraction_Review-g294212-d4006739-Reviews{PAGENUM}-The_Trippest_Mini_Group_Tours-Beijing.html',
+ 'tp_Xian' => 'https://www.tripadvisor.com/Attraction_Review-g298557-d10999897-Reviews{PAGENUM}-Xi_an_Trippest_Mini_Group_Tours-Xi_an_Shaanxi.html',
+ 'tp_Shanghai' => 'https://www.tripadvisor.com/Attraction_Review-g308272-d6222868-Reviews{PAGENUM}-Shanghai_Trippest_Mini_Group_Tours-Shanghai.html',
+ 'tp_Guilin' => 'https://www.tripadvisor.com/Attraction_Review-g298556-d14121459-Reviews{PAGENUM}-Trippest_Mini_Group_Tours-Guilin_Guangxi.html'
);
diff --git a/application/third_party/tripadvisor_spider/controllers/index.php b/application/third_party/tripadvisor_spider/controllers/index.php
index 6b7e266f..2b8124b6 100644
--- a/application/third_party/tripadvisor_spider/controllers/index.php
+++ b/application/third_party/tripadvisor_spider/controllers/index.php
@@ -267,24 +267,40 @@ class Index extends CI_Controller {
}
}
- public function get_destination_reviews($destination = null){
+ public function get_destination_reviews($destination = null,$pagenum = null){
+ set_time_limit(0);
$ta_website = $this->config->item('tripadvisor_website');
//根据传入的目的地简码获取TA的相应评论列表
if(isset($ta_website[$destination])){
$url = $ta_website[$destination];
+ if($pagenum != ''){
+ $url = str_replace('{PAGENUM}','-or'.$pagenum,$url);
+ }else{
+ $url = str_replace('{PAGENUM}','',$url);
+ }
//根据url获取页面内容
$content = GET_HTTP($url);
-
//进行页面解析
$html_object = str_get_html($content);
-
- //获取第一页列表上的url
- foreach ($html_object->find('.reviewSelector .quote a') as $a_info){
- $url = 'https://www.tripadvisor.com'.$a_info->href;
-
+ $return = new stdClass();
+ $return->urls = array();
+ //获取每个页面上的url
+ foreach ($html_object->find('.reviewSelector .quote a') as $reviews_url){
+ array_push($return->urls,'https://www.tripadvisor.com'.$reviews_url->href);
}
+ print_r(json_encode($return));
+ }
+ }
+
+ //查看抓取到的所有信息
+ public function get_all_reviews($destination){
+ if($destination != ''){
+ $all_reviews = $this->Tripadvisor_Review_model->get_all_reviews($destination);
+ $return = array();
+ $return['list'] = $all_reviews;
+ print_r(json_encode($return));
}
}
@@ -294,8 +310,8 @@ class Index extends CI_Controller {
$destination = $this->input->get_post('destination');
$html_num = $this->input->get_post('html_num');
- //$url = 'https://www.tripadvisor.com/ShowUserReviews-g294212-d4006739-r666168101-The_Trippest_Mini_Group_Tours-Beijing.html';
- $destination = 'tp_Beijing';
+ //$url = 'https://www.tripadvisor.com/ShowUserReviews-g308272-d6222868-r599123490-Shanghai_Trippest_Mini_Group_Tours-Shanghai.html';
+ //$destination = 'tp_Beijing';
if($url != ''){
$content = GET_HTTP($url);
@@ -307,15 +323,28 @@ class Index extends CI_Controller {
//提取局部,不做整个页面的寻找元素,提升效率
$meta_inner = $html_object->find('.meta_inner');
+ $detail_data->user_loc = '';
+ $detail_data->pic = array();
foreach($meta_inner as $detail_info){
//记录该条记录的id
$detail_data->html_id = $html_num;
+
//获取评论者帐号
foreach($detail_info->find('.info_text') as $review_name){
$detail_data->review_name = $review_name->first_child()->innertext;
}
+ //获取评论者帐号
+ foreach($detail_info->find('.info_text .userLoc strong') as $user_loc){
+ $detail_data->user_loc = $user_loc->innertext;
+ }
+
+ //抓取评论时间
+ foreach($detail_info->find('.ratingDate') as $ratingDate){
+ $detail_data->rating_date = date('Y-m-d',strtotime($ratingDate->title));
+ }
+
//获取评论者ID
foreach($detail_info->find('.reviewSelector') as $review_id){
$detail_data->review_id = str_replace('review_','',$review_id->id);
@@ -337,13 +366,21 @@ class Index extends CI_Controller {
$detail_data->content = $content->innertext;
}
- //获取评论时间
- foreach($detail_info->find('.prw_reviews_stay_date_hsx') as $review_date){
- $detail_data->review_date = str_replace('Date of experience: ','',$review_date->innertext);
+ //获取体验时间
+ foreach($detail_info->find('.prw_reviews_stay_date_hsx') as $experience_date){
+ $detail_data->experience_date = date('Y-m-d',strtotime(str_replace('Date of experience: ','',$experience_date->innertext)));
+ }
+
+ //抓取图片
+ foreach($detail_info->find('.imgWrap .noscript') as $imgWrap){
+ $imgWrap->src = str_replace('photo-l','photo-s',$imgWrap->src);
+ array_push($detail_data->pic,$imgWrap->src);
}
}
//拿到数据后进行入库
+ $this->Tripadvisor_Review_model->add_reviews($detail_data);
+
print_r(json_encode($detail_data));
}
}
diff --git a/application/third_party/tripadvisor_spider/models/Tripadvisor_Review_model.php b/application/third_party/tripadvisor_spider/models/Tripadvisor_Review_model.php
index 25414fc7..d2f8cf21 100644
--- a/application/third_party/tripadvisor_spider/models/Tripadvisor_Review_model.php
+++ b/application/third_party/tripadvisor_spider/models/Tripadvisor_Review_model.php
@@ -161,5 +161,39 @@ class Tripadvisor_Review_model extends CI_Model {
$result = $query->result();
return $result;
}
+
+ public function add_reviews($detail_data){
+ $sql = "
+ IF NOT EXISTS(
+ select tr_review_id from Ta_Reviews where tr_review_id = ?
+ )
+ insert into Ta_Reviews
+ (
+ tr_destination,
+ tr_review_id,
+ tr_review_title,
+ tr_content,
+ tr_member_name,
+ tr_member_loc,
+ tr_member_starts,
+ tr_review_date,
+ tr_visited_date,
+ tr_review_pics,
+ tr_gri_no,
+ tr_tgi_sn,
+ tr_datetime
+ )values(
+ ?,?,?,?,?,?,?,?,?,?,?,?,GETDATE()
+ )
+ ";
+ $query = $this->INFO->query($sql, array($detail_data->review_id,$detail_data->destination,$detail_data->review_id,$detail_data->title,$detail_data->content,$detail_data->review_name,$detail_data->user_loc,$detail_data->star_nums,$detail_data->rating_date,$detail_data->experience_date,json_encode($detail_data->pic),'',''));
+ //$result = $query->result();
+ }
+
+ public function get_all_reviews($destination){
+ $sql = 'select * from Ta_Reviews where tr_destination = ? order by tr_review_date desc';
+ $query = $this->INFO->query($sql,array($destination));
+ return $query->result();
+ }
}
diff --git a/application/third_party/tripadvisor_spider/views/third_party_input.php b/application/third_party/tripadvisor_spider/views/third_party_input.php
index 0643046e..eb84da06 100644
--- a/application/third_party/tripadvisor_spider/views/third_party_input.php
+++ b/application/third_party/tripadvisor_spider/views/third_party_input.php
@@ -10,9 +10,15 @@
手动录入
+
+ 列表抓取
+
excel导入
+
+ 数据预览
+
+
+
+
+
+
+
+
+
+ 选择站点
+ tp_Beijing
+ tp_Shanghai
+ tp_Guilin
+
+
+
+
+
+
+
+
+
@@ -70,6 +124,7 @@ $(function(){
//获取填写的url
var ta_url = $('#ta_url').val();
var stars = '';
+ var pic_htm = '';
if(ta_url == ''){
alert('请填写需要采集的TA地址');
}else{
@@ -80,8 +135,14 @@ $(function(){
var data = $.parseJSON(json);
console.log(data);
$('.ta_content').html(data.content);
- $('.review_date').html('Date of experience: '+data.review_date);
+ $('.experience_date').html('Date of experience: '+data.experience_date);
$('.review_name').html(data.review_name);
+ $('.user_loc').html(data.user_loc);
+ $('.rating_date').html('Reviewed:'+data.rating_date);
+ for(var i=0;i ';
+ }
+ $('.review_pic').html(pic_htm);
$('.ta_title').html(''+data.title+' ');
if(data.star_nums){
for(var i=0;i';
+ html += '
'+jsondata.list[y].tr_member_name+'
'+jsondata.list[y].tr_member_loc+'
';
+ for(var i=0;i';
+ }
+ html += '
'+jsondata.list[y].tr_review_title+'
Reviewed: '+jsondata.list[y].tr_review_date+'
'+jsondata.list[y].tr_content+'
';
+ html += '
';
+
+ if($.parseJSON(jsondata.list[y].tr_review_pics).length > 0){
+ for(var j=0;j<$.parseJSON(jsondata.list[y].tr_review_pics).length;j++){
+ html += '
';
+ }
+ }
+
+ html += '
Date of experience: '+jsondata.list[y].tr_visited_date+'
';
+ }
+ html += 'total nums : '+jsondata.list.length+'
'
+ $('#list_view_content').html(html);
+ }
+ });
+ }
+ });
});
\ No newline at end of file
diff --git a/webht/controllers/onlineoffice.php b/webht/controllers/onlineoffice.php
new file mode 100644
index 00000000..0d8b9d97
--- /dev/null
+++ b/webht/controllers/onlineoffice.php
@@ -0,0 +1,95 @@
+output->enable_profiler(TRUE);
+ $this->permission->is_admin(true);
+ $this->load->model('Navigation_model');
+ $this->load->model('Operator_model');
+ $this->admin_data=$this->session->userdata('admin_chtcdn');
+ $this->uid=$this->admin_data['OPI_SN'];
+ }
+
+ public function index()
+ {
+ $data['mid']=$this->uid;
+ $this->load->view('n-header', $data);
+ $user_data=$this->Operator_model->get_webhtuser_by_id($this->admin_data['whu_uid']);
+ $data['whu_ip']=$user_data->whu_ip;
+ $data['whu_mac']=$user_data->whu_mac;
+ $this->load->view('onlineoffice/wakeup',$data);
+ $this->load->view('n-footer');
+ }
+
+
+ public function wakeonlan($ip,$mac,$port=7){
+ //需要在system32目录下放置wolcmd.exe来启动
+ $mac=str_replace(':','',$mac);
+ $last_line = system("wolcmd $mac $ip 255.255.255.0 7", $retval);
+ echo $last_line;
+
+ return true;
+
+ $addr_byte = explode(':', $mac);
+ $hw_addr = '';
+ for ($i=0; $i <6; $i++){
+ $hw_addr .= chr(hexdec($addr_byte[$i]));
+ }
+ $msg = chr(255).chr(255).chr(255).chr(255).chr(255).chr(255);
+ for ($i = 1; $i <= 16; $i++) {
+ $msg .= $hw_addr;
+}
+ $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
+ if ($socket == false) {
+ echo "create socket failed!\n";
+ echo "error:'".socket_last_error($socket)."' - " . socket_strerror(socket_last_error($socket));
+ return FALSE;
+ } else {
+ $opt_ret = socket_set_option($socket,SOL_SOCKET, SO_BROADCAST, TRUE);
+ if($opt_ret <0) {
+ echo "setsockopt() failed, error: " . strerror($opt_ret) . "\n";
+ return FALSE;
+ }
+
+ if(socket_sendto($socket, $msg, strlen($msg), 0, $ip, $port)) {
+ echo "唤醒数据包发送成功!";
+ socket_close($socket);
+ return TRUE;
+ } else {
+ echo "唤醒数据包发送失败!";
+ return FALSE;
+ }
+ }
+ }
+
+ //检查端口是否打开,用来判断电脑是否启动成功
+ public function ping($ip,$port=3389) {
+ $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
+ socket_set_nonblock($sock);
+ @socket_connect($sock,$ip, $port);
+ socket_set_block($sock);
+ //返回值说明:2关闭,1打开,0超时
+ switch(socket_select($r = array($sock), $w = array($sock), $f = array($sock), 5)){
+ case 0:
+ echo '努力启动中...';
+ break;
+ case 1:
+ echo '电脑启动成功!';
+ break;
+ case 2:
+ echo '电脑启动成功,远程端口未打开,联系YCC开启权限';
+ break;
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/webht/models/operator_model.php b/webht/models/operator_model.php
index 720d19f0..0a71edca 100644
--- a/webht/models/operator_model.php
+++ b/webht/models/operator_model.php
@@ -161,6 +161,29 @@ class Operator_model extends CI_Model
}
return $result;
}
+
+ public function get_webhtuser_by_id($whu_uid){
+ $sql="
+ SELECT TOP 1 wu.whu_uid,
+ wu.whu_uname,
+ wu.whu_email,
+ wu.whu_ip,
+ wu.whu_mac,
+ wu.whu_status,
+ wu.whu_isadmin,
+ wu.department
+ FROM webht_user wu
+ WHERE wu.whu_uid = ?
+ ";
+ $query = $this->HT->query($sql,array($whu_uid));
+ if ($query->num_rows() > 0)
+ {
+ $row = $query->row();
+ return $row;
+ }else{
+ return false;
+ }
+ }
public function get_webhtuser_by_name($whu_uname,$filed='whu_uid',$flag=false)
{
@@ -178,6 +201,7 @@ class Operator_model extends CI_Model
$result=$result[0]->$filed;
}
}
+ //print_r($this->HT->queries);
return $result;
}
@@ -188,7 +212,8 @@ class Operator_model extends CI_Model
{
return false;
}
-
+ //echo $OPI_Name;
+
$sql = "SELECT TOP $top oi.OPI_SN, \n"
. " oi.OPI_Name, \n"
. " oi.OPI_Email,OPI_MoveTelephone,OPI_Telephone, \n"
diff --git a/webht/third_party/partners/controllers/index.php b/webht/third_party/partners/controllers/index.php
index abf5a129..2e1b1d00 100644
--- a/webht/third_party/partners/controllers/index.php
+++ b/webht/third_party/partners/controllers/index.php
@@ -53,7 +53,11 @@ class Index extends CI_Controller
$data['status']=$status;
$data['list']=$this->Partners_model->get_orders($user,$status,$date1,$date2,$COLI_ID);
//if ($COLI_ID!==false) {
- $this->load->view('index/order_search',$data);
+ $grouptpl='index/order_search';
+ if ($this->session->userdata('isapp')) {
+ $grouptpl='index/group_app';
+ }
+ $this->load->view($grouptpl,$data);
return;
//}
@@ -62,6 +66,7 @@ class Index extends CI_Controller
$this->load->view('index/group');
$this->load->view('footer');
}
+
//地接与导游信息
public function guideinfo($GRI_SN='')
{
@@ -93,7 +98,11 @@ class Index extends CI_Controller
$data=array();
$this->load->model('Mailinfo_model');
$data['mailinfo']=$this->Mailinfo_model->get_mail_info($COLI_ID);
- $this->load->view('index/mailinfo', $data);
+ $tpl='index/mailinfo';
+ if ($this->session->userdata('isapp')) {
+ $tpl='index/mailinfo_app';
+ }
+ $this->load->view($tpl, $data);
}
//来往邮件正文内容
public function mail_detail($MAI_SN)
@@ -102,7 +111,11 @@ class Index extends CI_Controller
$this->load->model('Mailinfo_model');
$data['maildetail']=$this->Mailinfo_model->mail_detail($MAI_SN);
$data['mailattach']=$this->Mailinfo_model->mail_attach($MAI_SN);
- $this->load->view('index/maildetail', $data);
+ $tpl='index/maildetail';
+ if ($this->session->userdata('isapp')) {
+ $tpl='index/maildetail_app';
+ }
+ $this->load->view($tpl, $data);
}
}
diff --git a/webht/third_party/partners/models/mailinfo_model.php b/webht/third_party/partners/models/mailinfo_model.php
index ca8596c2..9dab7897 100644
--- a/webht/third_party/partners/models/mailinfo_model.php
+++ b/webht/third_party/partners/models/mailinfo_model.php
@@ -17,6 +17,7 @@ class Mailinfo_model extends CI_Model {
{
$sql="SELECT MAI_SN,
MAI_SendDate,
+ MOI_ReadState,
MAI_COLI_SN,
MAI_From,
MAI_To,
diff --git a/webht/third_party/partners/models/partners_model.php b/webht/third_party/partners/models/partners_model.php
index 3cad3b63..7ac8a80f 100644
--- a/webht/third_party/partners/models/partners_model.php
+++ b/webht/third_party/partners/models/partners_model.php
@@ -90,7 +90,8 @@ class Partners_model extends CI_Model {
}
$ApplyDate_sql='';
if ($date1) {
- $ApplyDate_sql=" AND COLI_ApplyDate Between '$date1' AND '$date2' ";
+ //$ApplyDate_sql=" AND COLI_ApplyDate Between '$date1' AND '$date2' ";
+ $ApplyDate_sql=" AND COLI_OrderStartDate Between '$date1' AND '$date2' ORDER BY COLI_OrderStartDate ASC";
}elseif(!$date1 && $status==5) {
$default_date=date("Y-m-d",strtotime("-15 day"));
$ApplyDate_sql=" AND COLI_OrderStartDate>'$default_date' ORDER BY COLI_OrderStartDate ASC";
diff --git a/webht/third_party/partners/views/index/group_app.php b/webht/third_party/partners/views/index/group_app.php
new file mode 100644
index 00000000..f0346a7e
--- /dev/null
+++ b/webht/third_party/partners/views/index/group_app.php
@@ -0,0 +1,42 @@
+ $g) { ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/webht/third_party/partners/views/index/maildetail_app.php b/webht/third_party/partners/views/index/maildetail_app.php
new file mode 100644
index 00000000..71766d46
--- /dev/null
+++ b/webht/third_party/partners/views/index/maildetail_app.php
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+ 邮件正文
+
+
+
+
+
+
+
+
+
MAI_Subject; ?>
+
发送时间: MAI_SendDate; ?>
+ MAI_BlobContent; ?>
+
+
+
\ No newline at end of file
diff --git a/webht/third_party/partners/views/index/mailinfo.php b/webht/third_party/partners/views/index/mailinfo.php
index 84fc9b2b..33c701a4 100644
--- a/webht/third_party/partners/views/index/mailinfo.php
+++ b/webht/third_party/partners/views/index/mailinfo.php
@@ -12,7 +12,7 @@
- MAI_From); ?> MAI_SendDate; ?>
+ MAI_Direction==2 && $v->MOI_ReadState==0)echo '• '; ?>MAI_From); ?> MAI_SendDate; ?>
MAI_Subject; ?>
diff --git a/webht/third_party/partners/views/index/mailinfo_app.php b/webht/third_party/partners/views/index/mailinfo_app.php
new file mode 100644
index 00000000..50f316fe
--- /dev/null
+++ b/webht/third_party/partners/views/index/mailinfo_app.php
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
来往邮件
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/webht/third_party/pay/controllers/iPayLinksService.php b/webht/third_party/pay/controllers/iPayLinksService.php
index 1231650d..b5f5085e 100644
--- a/webht/third_party/pay/controllers/iPayLinksService.php
+++ b/webht/third_party/pay/controllers/iPayLinksService.php
@@ -602,7 +602,9 @@ class IPayLinksService extends CI_Controller
$parent_dealId = $parent_payment->dealId;
$parent_note = $this->Note_model->note($parent_dealId);
// APP 组的退款查不到原始收款记录
- if (empty($parent_note) && true === $this->IPayLinks_model->if_APP_order($parent_order) ) {
+ $pure_orderid = strstr($parent_order,"_",true);
+ $pure_orderid = $pure_orderid===false ? $parent_order : $pure_orderid;
+ if (empty($parent_note) && true === $this->IPayLinks_model->if_APP_order($pure_orderid) ) {
$parent_note = $parent_payment;
// 补充字段
$parent_note->IPL_orderId = $parent_order . '_B';
diff --git a/webht/third_party/pay/models/note_model.php b/webht/third_party/pay/models/note_model.php
index 8f5fc052..21ecf0a0 100644
--- a/webht/third_party/pay/models/note_model.php
+++ b/webht/third_party/pay/models/note_model.php
@@ -218,7 +218,13 @@ class Note_model extends CI_Model {
1=1
$this->date
-- AND (IPL_noticeTime BETWEEN '2018-07-27 00:00:00' AND '2018-07-27 23:59:59' or IPL_sent<>'send')
- or ((ISNULL(gaib.GAI_SN, 0)+ISNULL(gai.GAI_SN, 0))=0 and IPL_payType='pay' AND (IPL_sent<>'closeRecord') and COLI.COLI_ID is null)
+ or (
+ (
+ (ISNULL(gaib.GAI_SN, 0)+ISNULL(gai.GAI_SN, 0))=0 and COLI.COLI_ID is null
+ and IPL_sent not in ('send','closeRecord')
+ )
+ or ISNULL(IPL_sent,'') in ('sendfail','unsend','')
+ )
)
order by isRecord asc,ipl.IPL_sent desc,IPL_sn desc";
$query = $this->INFO->query($sql);
diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php
index b4dfbc2c..33718108 100644
--- a/webht/third_party/paypal/controllers/index.php
+++ b/webht/third_party/paypal/controllers/index.php
@@ -611,6 +611,73 @@ class Index extends CI_Controller {
return ;
}
+ /*!
+ * [paypal_webhook description]
+ * @author LYT
+ * @date 2019-05-23
+ * PAYMENT.SALE.COMPLETED 没有付款人信息
+ * * resource.id=txn_id
+ * * invoice_number=invoice_number
+ */
+ public function paypal_webhook()
+ {
+ $raw_post = file_get_contents('php://input');
+ if (empty($raw_post)) {
+ return;
+ }
+ $post_data = json_decode($raw_post);
+ if ($post_data->event_type != 'PAYMENT.SALE.COMPLETED') {
+ log_message('error',"paypal_webhook" . var_export($raw_post, 1));
+ return;
+ }
+ $pn_txn_id = $post_data->resource->id;
+
+ $pn_invoice = $post_data->resource->invoice_number;
+
+ $pn_mc_gross = $post_data->resource->amount->total;
+
+ // $pn_item_name = $this->input->post('item_name');
+ // if (empty($pn_item_name)) {
+ // $pn_item_name = $this->input->post('item_name1'); //APP用SDK支付的话会是item_name1
+ // empty($pn_item_name) ? $pn_item_name = '' : false;
+ // }
+
+ // $pn_item_number = $this->input->post('item_number');
+ // if (empty($pn_item_number)) {
+ // $pn_item_number = $this->input->post('item_number1'); //APP用SDK支付的话会是item_number1
+ // empty($pn_item_number) ? $pn_item_number = '' : false;
+ // }
+
+ $pn_mc_currency = $post_data->resource->amount->currency;
+ $pn_payment_status = $post_data->resource->state;
+ $pn_payment_date = $post_data->resource->update_time;
+ // $pn_payer = $post_data->resource->amount->currency;
+ // $pn_payer_email = $post_data->resource->amount->currency;
+ $pn_memo = $raw_post;
+ if (!empty($pn_txn_id)) {
+ //把PDT时间转成GMT时间
+ $pn_payment_date = gmdate('Y-m-d H:i:s', strtotime($pn_payment_date));
+ $this->Note_model->save_paypal_note(
+ $pn_txn_id,
+ $pn_invoice,
+ "",
+ $pn_mc_gross,
+ "",
+ "",
+ $pn_mc_currency,
+ $pn_payment_status,
+ "",
+ "",
+ $pn_payment_date,
+ $pn_memo);
+ log_message('error','paypal-webhook-succeed ' . $pn_txn_id . ' # ' . $pn_invoice);
+ // echo 'ok';
+ } else {
+ // echo 'no';
+ }
+ return;
+ }
+
//解析出订单号
public function analysis_orderid($note_invoice_string) {
$data = array();
@@ -718,13 +785,13 @@ class Index extends CI_Controller {
*/
//找到没有发送的记录
- public function send_note($pn_txn_id = false, $old_ssje=NULL) {
+ public function send_note($pn_txn_id = false, $old_ssje=NULL, $pn_sn=NULL) {
$data = array();
$handpick = empty($pn_txn_id) ? false : TRUE;
//优先处理指定的交易号,用于修正交易号直接发送通知
if (!empty($pn_txn_id)) {
- $data['unsend_list'] = array($this->Note_model->note($pn_txn_id));
+ $data['unsend_list'] = array($this->Note_model->note($pn_txn_id, $pn_sn));
}
//找到处理过的的记录
@@ -749,15 +816,27 @@ class Index extends CI_Controller {
if (empty($pn_txn_id)) {
echo ++$show_index . ' ' . $item->pn_txn_id . ' ';
}
+
+ // webhook的跳过
+ $webhook_memo = json_decode($item->pn_memo);
+ $is_webhook = false;
+ if (isset($webhook_memo->id) && substr($webhook_memo->id, 0, 2)==="WH") {
+ $is_webhook = true;
+ }
+ if (true === $is_webhook) {
+ $this->Note_model->update_send($item->pn_txn_id, 'send', $item->pn_sn);
+ continue;
+ }
+
//退款状态默认为已经处理,陆燕在退款前手动通知外联了,系统跳过处理
- if ($item->pn_payment_status == 'Refunded') {
+ if (strtolower($item->pn_payment_status) == 'refunded') {
$this->send_refund($item, $handpick, $old_ssje);
// $this->Note_model->update_send($item->pn_txn_id, 'send');
continue;
}
//只处理完成状态,其他状态由陆燕处理
- if ($item->pn_payment_status !== 'Completed') {
+ if (strtolower($item->pn_payment_status) !== 'completed') {
$this->Note_model->update_send($item->pn_txn_id, 'sendfail');
continue;
}
@@ -785,7 +864,7 @@ class Index extends CI_Controller {
}
$orderid_info = json_decode($orderid_info);
// 仅自动程序发送提醒 false == $handpick &&
- if ($item->pn_payment_status === 'Completed'
+ if (strtolower($item->pn_payment_status) === 'completed'
&& $orderid_info->ordertype == 'A' && strpos($get_order_no, 'China Train Booking') !== false) {
// APP 组的China Train Booking-开头的订单号
// 发送邮件提醒外联核对收款金额, 不写入收款记录
@@ -893,9 +972,8 @@ class Index extends CI_Controller {
continue;
}
-
//添加邮件发送记录
- if ($item->pn_send !== 'send') {
+ if ($item->pn_send !== 'send' && false===$is_webhook) {
//给外联发送通知邮件
$fromName = !empty($item->pn_payer) ? $item->pn_payer : '';
$fromEmail = !empty($item->pn_payer_email) ? $item->pn_payer_email : '';
@@ -909,6 +987,8 @@ class Index extends CI_Controller {
$this->Paypal_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'paypal note');
//添加邮件发送记录 end
+ $this->Note_model->update_send($item->pn_txn_id, 'send');
+ } else {
$this->Note_model->update_send($item->pn_txn_id, 'send');
}
}
@@ -1236,7 +1316,7 @@ class Index extends CI_Controller {
$amount = $this->input->post("set_amount");
$last_record = $this->input->post("date_history");
if (empty($amount)) {
- $export_list = $this->Note_model->date_range($from_date, $to_date, $currency);
+ $export_list = $this->Note_model->date_range($from_date, $to_date, $currency, null, false);
} else {
$allmost_day = intval(ceil($amount/10000));
if ( ! in_array($currency, array('CNY','USD'))) {
@@ -1302,7 +1382,7 @@ class Index extends CI_Controller {
public function target_amount_recursive($currency, $target_amount, $now_amount, $from_date,$days=10,$list=array(), $last_sn=null, $last_flag=null)
{
$to_date = date('Y-m-d', strtotime("+$days days", strtotime($from_date)));
- $former_list = $this->Note_model->date_range($from_date, $to_date, $currency, $last_sn);
+ $former_list = $this->Note_model->date_range($from_date, $to_date, $currency, $last_sn, false);
$list_index = 0;
$last_sn = $last_sn===null ? 0 : $last_sn;
$last_flag = $last_flag===null ? null : $last_flag;
diff --git a/webht/third_party/paypal/models/note_model.php b/webht/third_party/paypal/models/note_model.php
index 0cd9ecd4..ac914479 100644
--- a/webht/third_party/paypal/models/note_model.php
+++ b/webht/third_party/paypal/models/note_model.php
@@ -24,7 +24,8 @@ class Note_model extends CI_Model {
$this->search = false;
$this->pn_payment_status = false;
$this->pn_txn_id = false;
- $this->orderby = ' ORDER BY pn.pn_sn DESC ';
+ // $this->orderby = ' ORDER BY pn.pn_sn DESC ';
+ $this->orderby = ' ORDER BY pn_datetime desc,pn_payer desc ';
//$this->pn_payment_status=' AND pn_payment_status= ';
}
@@ -45,7 +46,7 @@ class Note_model extends CI_Model {
public function search_date($date) {
$this->init();
- $search_sql = " AND (pn.pn_datetime BETWEEN '$date 00:00:00' AND '$date 23:59:59' OR pn_send not in ('send','closeRecord')) ";
+ $search_sql = " AND (pn.pn_datetime BETWEEN '$date 00:00:00' AND '$date 23:59:59' OR isnull(pn_send,'') in ('sendfail','unsend','')) ";
$this->search = $search_sql;
$this->orderby=" ORDER BY CASE pn.pn_send WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.pn_sn DESC ";
return $this->get_list();
@@ -134,12 +135,13 @@ class Note_model extends CI_Model {
}
}
- public function update_send($pn_txn_id, $pn_send) {
+ public function update_send($pn_txn_id, $pn_send, $pn_sn=NULL) {
$sql = "
UPDATE paypal_note
SET pn_send = ?
WHERE pn_txn_id = ?
- ";
+ ";
+ $sql .= ($pn_sn===NULL) ? "" : " and pn_sn=$pn_sn ";
return $this->HT->query($sql, array($pn_send, $pn_txn_id));
}
@@ -153,7 +155,7 @@ class Note_model extends CI_Model {
return $this->HT->query($sql, array($pn_invoice, $pn_txn_id));
}
- public function date_range($from, $to, $currency=NULL, $pn_sn=NULL)
+ public function date_range($from, $to, $currency=NULL, $pn_sn=NULL, $includeWH=true)
{
$this->init();
$search_sql = " AND pn_payment_status in ('Completed','Refunded') ";
@@ -164,6 +166,9 @@ class Note_model extends CI_Model {
if ( ! empty($pn_sn)) {
$search_sql .= " AND pn_sn >= $pn_sn ";
}
+ if (true !== $includeWH) {
+ $search_sql .= " AND isnull(pn_payer,'')<>'' and ISNULL(pn_payer_email,'')<>'' ";
+ }
$this->search = $search_sql;
$this->orderby = " order by pn.pn_sn asc";
return $this->get_list();
diff --git a/webht/third_party/paypal/views/note_list.php b/webht/third_party/paypal/views/note_list.php
index 4dcfcb2d..c40e675e 100644
--- a/webht/third_party/paypal/views/note_list.php
+++ b/webht/third_party/paypal/views/note_list.php
@@ -213,7 +213,7 @@ echo "TEL_SN@" . strstr($vf->TEL_transactionDate, " ", true
$show_send = 'send';
} elseif ($item->pn_send == 'closeRecord') {
$show_send = $show_record = '已忽略';
- } else if ($item->pn_payment_status == 'Completed') {
+ } else if (strtolower($item->pn_payment_status) == 'completed') {
$class_css = 'btn-danger';
$show_send = $item->pn_send;
} else {
diff --git a/webht/third_party/trippestOrderSync/models/orders_model.php b/webht/third_party/trippestOrderSync/models/orders_model.php
index 54a1c821..8e490339 100644
--- a/webht/third_party/trippestOrderSync/models/orders_model.php
+++ b/webht/third_party/trippestOrderSync/models/orders_model.php
@@ -192,8 +192,6 @@ class Orders_model extends CI_Model {
LEFT JOIN BIZ_ConfirmLineDetail cold ON cold.COLD_COLI_SN=coli.COLI_SN
where
GCI_combineNo is not null and GCI_combineNo not in ('cancel','forbidden')
- -- 今天更新一次
- and gci.GCI_createTime < '$last_update_time'
-- 已生成账单的不再自动同步
and NOT exists (
select 1 from report_order where ordernumber=COLI_ID and orderstats=1
diff --git a/webht/third_party/vendorPlanSync/controllers/index.php b/webht/third_party/vendorPlanSync/controllers/index.php
index 95f4d734..25fc9c5d 100644
--- a/webht/third_party/vendorPlanSync/controllers/index.php
+++ b/webht/third_party/vendorPlanSync/controllers/index.php
@@ -1,18 +1,21 @@
load->helper('array');
$this->load->library('vendor');
$this->load->model('UserAuth_model');
$this->load->model('Group_model');
$this->load->model('BIZ_Orders_model');
-
}
/*!
@@ -21,28 +24,33 @@ class Index extends CI_Controller {
* * 使用供应商平台登陆账号获取接口的key
*/
- public function index()
+ public function index($GRI_SN=0)
{
$auto_vendor_str = implode(",", $this->vendor->auto_vendor);
- return $this->push(0, $auto_vendor_str);
+ return $this->push($GRI_SN, $auto_vendor_str);
}
public function push($GRI_SN=0, $vendor_str=null)
{
+log_message('error',"\n\n---------------------------------------------------PUSH------------------------------------------------------------\n");
$start_date = date('Y-m-d');
$end_date = date('Y-m-d 23:59:59', strtotime("+2 months"));
+ // test
+ $start_date = '2019-03-27';
+ $end_date = '2019-07-27 23:59:59';
$ready_to_send = $this->Group_model->get_plan_not_received(1, $GRI_SN, $vendor_str, $start_date, $end_date);
+// log_message('error',var_export($ready_to_send, 1));
if (empty($ready_to_send)) {
return $this->output->set_output("empty");
}
$order = $ready_to_send[0];
if (isset($this->vendor->vendor_fun[strval($order->VAS_VEI_SN)])) {
- $controller_name = $this->vendor->vendor_fun[strval($order->VAS_VEI_SN)];
- require_once($controller_name . ".php");
- $vendor_class = new $controller_name();
- $call_fun = $vendor_class->order_push($order);
- log_message('error',"Call [$controller_name>order_push] " . $order->GRI_SN);
- return $this->output->set_output($call_fun . $order->GRI_SN);
+ $vendor_class = $this->vendor->vendor_fun[strval($order->VAS_VEI_SN)];
+ $this->load->library($vendor_class);
+ $vendor_class_name = mb_strtolower($vendor_class);
+ $call_fun = $this->$vendor_class_name->order_push($order);
+ log_message('error',"Call [$vendor_class>order_push] " . $order->GRI_SN . ". " . $call_fun);
+ return $this->output->set_output($call_fun . ". " . $order->GRI_SN);
}
return $this->output->set_output("Not found vendor function. " . $order->GRI_SN);
}
@@ -170,10 +178,11 @@ class Index extends CI_Controller {
}
// 需要填写导游, 则根据不同的供应商调用相应的方法
if (isset($this->vendor->vendor_fun[strval($input['openId'])])) {
- $controller_name = $this->vendor->vendor_fun[strval($input['openId'])];
- require_once($controller_name . '.php');
- $vendor_class = new $controller_name();
- $ret = $vendor_class->tourguide_update($input, $vps, $eva);
+ $vendor_class = $this->vendor->vendor_fun[strval($input['openId'])];
+ $this->load->library($vendor_class);
+ $vendor_class_name = mb_strtolower($vendor_class);
+ $ret = $this->$vendor_class_name->tourguide_update($input, $vps, $eva);
+
$err_code = $ret['err'];
unset($ret['err']); // 不返回给接收方
$sync_ret = array(
diff --git a/webht/third_party/vendorPlanSync/controllers/Tulanduo.php b/webht/third_party/vendorPlanSync/libraries/Tulanduo.php
similarity index 71%
rename from webht/third_party/vendorPlanSync/controllers/Tulanduo.php
rename to webht/third_party/vendorPlanSync/libraries/Tulanduo.php
index 330f6b24..08fe8ddd 100644
--- a/webht/third_party/vendorPlanSync/controllers/Tulanduo.php
+++ b/webht/third_party/vendorPlanSync/libraries/Tulanduo.php
@@ -3,10 +3,12 @@
if (!defined('BASEPATH'))
exit('No direct script access allowed');
-class Tulanduo extends CI_Controller
+class Tulanduo
{
- /** Live */
- /**
+ protected $ci;
+
+ /*! Live */
+ /*!
目的地
$this->userId = "1134";
$this->key = "73d180d05d425fd192e1c5b3097e75ff";
@@ -14,29 +16,29 @@ class Tulanduo extends CI_Controller
$this->userId = "18";
$this->key = "d05c25e6e6c5d4898161e0aaf700d9c7";
*/
- // private $send_host = array(
- // "30" => array(
- // "userId" => 1134
- // ,"key" => "73d180d05d425fd192e1c5b3097e75ff"
- // )
- // ,"1" => array(
- // "userId" => 18
- // ,"key" => "d05c25e6e6c5d4898161e0aaf700d9c7"
- // )
- // );
- /**
- * test
- */
private $send_host = array(
"30" => array(
- "userId" => 512
- ,"key" => "4d9bde5ce79d6093e4a98bebbd3892c2"
+ "userId" => 1134
+ ,"key" => "73d180d05d425fd192e1c5b3097e75ff"
)
,"1" => array(
- "userId" => 512
- ,"key" => "4d9bde5ce79d6093e4a98bebbd3892c2"
+ "userId" => 18
+ ,"key" => "d05c25e6e6c5d4898161e0aaf700d9c7"
)
);
+ /*!
+ * test
+ */
+ // private $send_host = array(
+ // "30" => array(
+ // "userId" => 6035
+ // ,"key" => "3bd16efd5f4165378f144da1f4829996"
+ // )
+ // ,"1" => array(
+ // "userId" => 6035
+ // ,"key" => "3bd16efd5f4165378f144da1f4829996"
+ // )
+ // );
// userId key
// 1343 2e47c3721e3ff6e816fe6b928d7acc7d
@@ -44,28 +46,28 @@ class Tulanduo extends CI_Controller
// 30548 9db75a2dc17156eb122364295804b7a2
// test
- public $list_url = "http://ltdj.ltsoftware.net:19919/action/api/searchRouteOrder/";
- public $detail_url = "http://ltdj.ltsoftware.net:19919/action/api/detailRouteOrder/";
- public $neworder_url = "http://ltdj.ltsoftware.net:19919/action/api/addOrUpdateRouteOrder/";
+ // public $list_url = "http://ltdj.ltsoftware.net:19919/action/api/searchRouteOrder/";
+ // public $detail_url = "http://ltdj.ltsoftware.net:19919/action/api/detailRouteOrder/";
+ // public $neworder_url = "http://ltdj.ltsoftware.net:19919/action/api/addOrUpdateRouteOrder/";
// Live
- // public $list_url = "http://djb3c.ltsoftware.net:9921/action/api/searchRouteOrder/";
- // public $detail_url = "http://djb3c.ltsoftware.net:9921/action/api/detailRouteOrder/";
- // public $neworder_url = "http://djb3c.ltsoftware.net:9921/action/api/addOrUpdateRouteOrder/";
+ public $list_url = "http://djb3c.ltsoftware.net:9921/action/api/searchRouteOrder/";
+ public $detail_url = "http://djb3c.ltsoftware.net:9921/action/api/detailRouteOrder/";
+ public $neworder_url = "http://djb3c.ltsoftware.net:9921/action/api/addOrUpdateRouteOrder/";
public function __construct(){
- parent::__construct();
+ $this->ci =& get_instance();
mb_regex_encoding("UTF-8");
bcscale(4);
- $this->load->helper('array');
- $this->load->library('trippest');
- $this->load->model('Group_model');
- $this->load->model('orders_model');
- $this->load->model('BIZ_orders_model', 'BIZ_order');
- $this->load->model('TuLanDuo_queryContentBuilder', 'tld_order');
- $this->load->model('TuLanDuo_addOrUpdateRouteOrderContentBuilder', 'tldOrderBuilder');
+ $this->ci->load->helper('array');
+ $this->ci->load->library('trippest');
+ $this->ci->load->model('Group_model');
+ $this->ci->load->model('orders_model');
+ $this->ci->load->model('BIZ_orders_model', 'BIZ_order');
+ $this->ci->load->model('TuLanDuo_queryContentBuilder', 'tld_order');
+ $this->ci->load->model('TuLanDuo_addOrUpdateRouteOrderContentBuilder', 'tldOrderBuilder');
// $this->output->enable_profiler(TRUE);
- $this->vendor_ids = $this->trippest->tulanduo_vei_sn;
+ $this->vendor_ids = array(1343,30548,29188);
}
public function order_push($order=null)
@@ -76,10 +78,12 @@ class Tulanduo extends CI_Controller
}
// 商务
if (strval($order->GRI_OrderType) === "227002") {
+ return false; // for Trippest deploy
return $this->push_tour($order);
}
// 传统订单
if (strval($order->GRI_OrderType) === "227001") {
+ return false; // for Trippest deploy
return $this->push_tour($order);
}
@@ -92,6 +96,7 @@ class Tulanduo extends CI_Controller
*/
public function push_tour($vas=null)
{
+ return false; // for Trippest deploy
$userId = $this->send_host["1"]["userId"];
$userKey = $this->send_host["1"]["key"];
$gri_sn = $vas->GRI_SN;
@@ -104,19 +109,22 @@ class Tulanduo extends CI_Controller
$change_info = $change_arr[0][0];
}
$change_info = str_replace("\n", " ", $change_info);
- $grd_info = $this->Group_model->get_vendor_plan_info($gri_sn, $vei_sn);
+ $grd_info = $this->ci->Group_model->get_vendor_plan_info($gri_sn, $vei_sn);
+ if (empty($grd_info)) {
+ return false;
+ }
$all_day_no = array_map(function($ele){return $ele->GRD_DayNo;}, $grd_info);
- $routeType = "桂林海纳国旅"; // todo 线路类型
- $arrange_info = $this->Group_model->get_arrange_info($gri_sn, $vei_sn);
- $routeName = "中华游" . $arrange_info[0]->tocity . "线路"; // todo 线路名称
+ $arrange_info = $this->ci->Group_model->get_arrange_info($gri_sn, $vei_sn);
+ $routeName = "中华游" . $arrange_info[0]->tocity . "线路"; // TODO 线路名称
+ $routeType = "桂林海纳国旅"; // TODO 线路类型
$agcOrderNo = $vas->GRI_Name . "-" . $arrange_info[0]->citycode;
$agcOrderNo .= "(" . $vas->operator . ")";
$first_date = $grd_info[0]->day_no_raw;
$last_date = count($grd_info)-1;
$end_date = $grd_info[$last_date]->day_no_raw;
- $request_info = $this->Group_model->get_plan_request($gri_sn);
+ $request_info = $this->ci->Group_model->get_plan_request($gri_sn);
$order_type = 1;
- $this->tldOrderBuilder->setUserId($userId)
+ $this->ci->tldOrderBuilder->setUserId($userId)
->setKey($userKey)
->setOrderType($order_type)
->setRouteName($routeName)
@@ -127,33 +135,34 @@ class Tulanduo extends CI_Controller
->setDestination($arrange_info[0]->tocity)
->setTravelDate($first_date)
->setLeavedDate($end_date)
- // ->setOrderRemark($order_remark) // 订单备注
+ // ->setOrderRemark($order_remark) // 订单备注 TODO
->setRoomStandard($request_info->GCI_HotelRequest) // 住房标准
->setRouteStandard($request_info->GCI_Request) // 行程服务标准
;
- $guestlist = $this->orders_model->get_customer_list($gri_sn);
+ $guestlist = $this->ci->orders_model->get_customer_list($gri_sn);
foreach ($guestlist as $key => $vg) {
- $this->tldOrderBuilder->setCustomersName($key, $vg->MemberName )
+ $this->ci->tldOrderBuilder->setCustomersName($key, $vg->MemberName )
->setCustomersPeopleType($key, (calc_age_type($vg->BirthDay)==1 ? "成人" : "儿童"))
->setCustomersDocumentType($key, "护照") // Passport No.
->setCustomersDocumentNo($key, $vg->PassportNo)
->setCustomersOtherInfo($key, $vg->Country);
}
- $travel_fee = 0;
- foreach ($arrange_info as $kaci => $vaci) {
- $travel_fee = bcadd($travel_fee, $vaci->ACI_Amount);
- }
- $this->tldOrderBuilder->setTravelFeesType(0, "Per Group")
- ->setTravelFeesMoney(0, $travel_fee)
- ->setTravelFeesNum(0, 1)
- ->setTravelFeesUnit(0, 1)
- ->setTravelFeesSumMoney(0, $travel_fee)
- ->setTravelFeesRemark(0, "");
- // 补全空的日期,行车为空
+ // $travel_fee = 0;
+ // foreach ($arrange_info as $kaci => $vaci) {
+ // $travel_fee = bcadd($travel_fee, $vaci->ACI_Amount);
+ // }
+ // // TODO 是否需要travelFee
+ // $this->ci->tldOrderBuilder->setTravelFeesType(0, "Per Group")
+ // ->setTravelFeesMoney(0, $travel_fee)
+ // ->setTravelFeesNum(0, 1)
+ // ->setTravelFeesUnit(0, 1)
+ // ->setTravelFeesSumMoney(0, $travel_fee)
+ // ->setTravelFeesRemark(0, "");
+ // 补全空的日期,行程为空
$date1 = new DateTime($first_date);
$date_end = new DateTime($end_date);
$date_diff = $date_end->diff($date1);
- $d = ($date_diff->format("%d"));
+ $d = ($date_diff->format("%a"));
$all_date = array();
for ($j=0; $j < ($d+1); $j++) {
$all_date[] = date('Y-m-d', strtotime("+$j day", strtotime($first_date)));
@@ -161,7 +170,7 @@ class Tulanduo extends CI_Controller
$real_date = array_map(function ($ele){return $ele->day_no_raw;}, $grd_info);
foreach ($all_date as $kd => $vd) {
if ( ! in_array($vd, $real_date)) {
- $this->tldOrderBuilder->setScheduleDetailsTitle($kd, "无")
+ $this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, "无")
->setScheduleDetailsContent($kd, "无")
->setScheduleDetailsAccommodation($kd, "")
// ->setScheduleDetailsTraffic($kd, ($vso->PAG_Vehicle>60001 ? 1 : 0))
@@ -173,7 +182,7 @@ class Tulanduo extends CI_Controller
}
foreach ($grd_info as $kgrd => $vgrd) {
if ($vd==$vgrd->day_no_raw) {
- $this->tldOrderBuilder->setScheduleDetailsTitle($kd, $vgrd->GRD_OrderDate)
+ $this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, $vgrd->GRD_OrderDate)
->setScheduleDetailsContent($kd, $vgrd->GRD_Landscape)
->setScheduleDetailsAccommodation($kd, $vgrd->GRD_Hotel)
->setScheduleDetailsTraffic($kd, ($vgrd->GRD_Traffic))
@@ -184,55 +193,39 @@ class Tulanduo extends CI_Controller
}
}
}
- // 查询是否变更
+ // 查询是否变更 TODO deprecated
$sync_orderstate = 10;
$vps_sn = 0;
$vendor_orderid = 0;
- $plan_detail_page_url = "http://p.mycht.cn/Cooperate/Plan_Detail.aspx?GSN=" . $gri_sn;
- $plan_detail_page = " 计划下载:$plan_detail_page_url ";
- if (intval($is_send_vary)===1) {
- $vps = $this->Group_model->get_sync_info($vas_sn);
- if ( ! empty($vps)) {
- $vps_sn = $vps->VPS_SN;
- $vendor_orderid = $vps->VPS_externalId;
- $sync_orderstate = 11;
- $modifyLogInfo = "$plan_detail_page $change_info ";
- $this->tldOrderBuilder->setOrderId($vendor_orderid)
- ->setModifyLogInfo($modifyLogInfo)
- ;
- }
- } else {
- $modifyLogInfo = $plan_detail_page;
- $this->tldOrderBuilder->clearModifyLogInfo();
- $this->tldOrderBuilder->setModifyLogInfo($modifyLogInfo)
- ;
- }
- $resp = $this->excute_curl($this->neworder_url, $this->tldOrderBuilder);
- // $resp = '{"status":1,"errMsg":"","responseData":{"orderId":' . rand(1000,9999) . '}}'; // test
+ $this->ci->tldOrderBuilder->clearModifyLogInfo();
+ // $resp = $this->excute_curl($this->neworder_url, $this->ci->tldOrderBuilder);
+ $resp = '{"status":1,"errMsg":"","responseData":{"orderId":' . rand(1000,9999) . '}}'; // test
+echo $this->ci->tldOrderBuilder->getBizContent();
+log_message('error',$resp);
$response = json_decode($resp);
if ($response->status == 1) {
/** VendorPlanSync */
$sync_ret = array(
"VPS_VAS_SN" => $vas_sn
- ,"VPS_GRI_SN" => $gri_sn
- ,"VPS_VEI_SN" => $vei_sn
- ,"VPS_startDate" => $first_date
- ,"VPS_endDate" => $end_date
- ,"VPS_sendHost" => $userId
- ,"VPS_externalId" => $response->responseData->orderId
- ,"VPS_externalorderType" => $order_type
- ,"VPS_externalorderState" => $sync_orderstate
- ,"VPS_sendTime" => date('Y-m-d H:i:s')
+ ,"VPS_GRI_SN" => $gri_sn
+ ,"VPS_VEI_SN" => $vei_sn
+ ,"VPS_startDate" => $first_date
+ ,"VPS_endDate" => $end_date
+ ,"VPS_sendHost" => $userId
+ ,"VPS_externalId" => $response->responseData->orderId
+ ,"VPS_externalorderType" => $order_type
+ ,"VPS_externalorderState" => $sync_orderstate
+ ,"VPS_sendTime" => date('Y-m-d H:i:s')
);
if ($vps_sn === 0) {
- $sync_id = $this->Group_model->insert_VendorPlanSync($sync_ret);
+ $sync_id = $this->ci->Group_model->insert_VendorPlanSync($sync_ret);
} else {
- $update = $this->Group_model->update_VendorPlanSync($vps_sn, $sync_ret);
+ $update = $this->ci->Group_model->update_VendorPlanSync($vps_sn, $sync_ret);
}
/** VendorArrangeState VAS_IsReceive */
- $this->Group_model->set_plan_received($vas_sn);
+ $this->ci->Group_model->set_plan_received($vas_sn);
}
- // return $this->tldOrderBuilder->getBizContent() . "[Tulanduo>push_tour] Done. ";
+ // return $this->ci->tldOrderBuilder->getBizContent() . "[Tulanduo>push_tour] Done. ";
return "[Tulanduo>push_tour] Done. ";
}
@@ -243,7 +236,6 @@ class Tulanduo extends CI_Controller
*/
public function push_trippest($vas=null)
{
- // return "[Tulanduo>push_trippest] Done. "; // test
/** 目的地 */
$userId = $this->send_host["30"]["userId"];
$userKey = $this->send_host["30"]["key"];
@@ -259,45 +251,88 @@ class Tulanduo extends CI_Controller
}
$change_info = str_replace("\n", " ", $change_info);
$vei_sn_str = implode(",", $this->vendor_ids);
- $orderinfo = $this->BIZ_order->get_orderinfo_detail($gri_sn, $vei_sn_str);
+ $orderinfo = $this->ci->BIZ_order->get_orderinfo_detail($gri_sn, $vei_sn_str);
if(empty($orderinfo)) {return "[Tulanduo>push_trippest] Not found order detail. ";}
$COLI_ID = $orderinfo[0]->COLI_ID;
- $set_pvt = strval($orderinfo[0]->COLI_PVT);
- $travelFees = $this->BIZ_order->get_paymentDetails($COLI_ID);
- // 按产品拆分 todo:按订单类型拆分? 单团/拼团
+ $set_pvt = strval($orderinfo[0]->is_pvt);
+ // 增加收款方参数, 增加代收款项
+ $vei_with_haina = $GLOBALS['__HAINA_VEI__'] . "," . $vei_sn_str;
+ $all_payment = $this->ci->BIZ_order->get_paymentDetails($COLI_ID, $vei_with_haina);
+ $paid_to_trippest = array();
+ $pay_to_vendor = array();
+ foreach ($all_payment as $kall => $vall) {
+ if (in_array($vall->payment_vei, array($GLOBALS['__HAINA_VEI__'], 0)) ) {
+ $paid_to_trippest[] = $vall;
+ } else {
+ $pay_to_vendor[] = $vall;
+ }
+ }
+ // 收款合并为一条
+ if ( ! empty($paid_to_trippest)) {
+ $travel_fees = $paid_to_trippest[0];
+ $travel_fees->SUM_SSJE = 0;
+ foreach ($paid_to_trippest as $ktf => $vtf) {
+ $travel_fees->SUM_SSJE = bcadd($travel_fees->SUM_SSJE, $vtf->GAI_SSJE);
+ }
+ }
+ // 代收合并为一条
+ if ( ! empty($pay_to_vendor)) {
+ $replace_collections = $pay_to_vendor[0];
+ $replace_collections->SUM_SSJE = 0;
+ $replace_collections->ALL_Memo = "";
+ foreach ($pay_to_vendor as $ktv => $vtv) {
+ $replace_collections->SUM_SSJE = bcadd($replace_collections->SUM_SSJE, $vtv->GAI_SSJE);
+ $replace_collections->ALL_Memo .= $vtv->ALL_Memo;
+ }
+ }
+ // 按产品拆分 按订单类型拆分? 单团/拼团; 未设置则按产品类型:接送
$fill_order = array();
$processed_date = array();
$processed_cold = array();
foreach ($orderinfo as $ko => $cold) {
if ( ! in_array($cold->COLD_SN, $processed_cold) && $cold->pag_code != '') {
$processed_cold[] = $cold->COLD_SN;
- $all_package = $this->trippest->tour_code($cold->pag_code);
- $pag_info = $this->BIZ_order->get_packageDetails(my_implode("'",",",$all_package));
+ $all_package = $this->ci->trippest->tour_code($cold->pag_code);
+ $pag_info = $this->ci->BIZ_order->get_packageDetails(my_implode("'",",",$all_package));
if ($set_pvt==='1') {
$fill_order[0]["cold"][] = $cold;
- $fill_order[0]["package_info"] = $pag_info; // todo ??? 这里是否丢失了产品
} else {
$fill_order[$cold->pag_code]["cold"][] = $cold;
$fill_order[$cold->pag_code]["package_info"] = $pag_info;
}
}
}
+ // 多产品PVT的合并,避免丢失产品
+ $pvt_pagcode = array();
+ if ($set_pvt==='1') {
+ foreach ($fill_order[0]['cold'] as $kcd => $vcd) {
+ $multi_package = $this->ci->trippest->tour_code($vcd->pag_code);
+ $pvt_pagcode = array_merge($pvt_pagcode, $multi_package);
+ }
+ $fill_order[0]["package_info"] = $this->ci->BIZ_order->get_packageDetails(my_implode("'",",",$pvt_pagcode));
+ }
// $fill_order = array_values($fill_order);
$i=0;
$take_apart = count($fill_order)>1 ? true : false;
+ $coli_sn = 0;
foreach ($fill_order as $kf => $vf) {
$i++;
- $this->tldOrderBuilder->resetBizContent();
- $order_type = intval($vf["package_info"][0]->PAG_ExtendType)===39009 ? 1 : 2;
+ $coli_sn = $vf['cold'][0]->COLI_SN;
+ $this->ci->tldOrderBuilder->resetBizContent();
+ $order_type = $set_pvt;
+ if ($set_pvt==='0') {
+ $code_type_arr = array_map(function($pag) { return intval($pag->PAG_ExtendType); }, $vf["package_info"]);
+ $order_type = in_array(39009, $code_type_arr) ? 1 : 2;
+ }
$last_code = count($vf["package_info"])-1;
$last_date = count($vf["cold"])-1;
- $tour_code = "";
- $routeName = $vf["package_info"][0]->PAG2_Name . "(" . mb_strtoupper($vf["cold"][0]->pag_code) . ")";
+ $tour_code = mb_strtoupper($vf["cold"][0]->pag_code);
+ $routeName = $vf["package_info"][0]->PAG2_Name . "(" . $tour_code . ")";
$first_date = strstr($vf["cold"][0]->COLD_StartDate, " ", true);
$end_date = strstr($vf["cold"][$last_date]->COLD_EndDate, " ", true);
- if (isset($this->trippest->special_route[$vf["cold"][0]->pag_code])) {
- $routeName = $this->trippest->special_route[$vf["cold"][0]->pag_code]["name"];
- $extra_day = $this->trippest->special_route[$vf["cold"][0]->pag_code]["day"]-1;
+ if (isset($this->ci->trippest->special_route[$vf["cold"][0]->pag_code])) {
+ $routeName = $this->ci->trippest->special_route[$vf["cold"][0]->pag_code]["name"];
+ $extra_day = $this->ci->trippest->special_route[$vf["cold"][0]->pag_code]["day"]-1;
$end_date = date("Y-m-d", strtotime("+$extra_day day", strtotime($vf["cold"][0]->COLD_StartDate)));
}
$agcOrderNo = $vf["cold"][0]->COLI_GroupCode . "-" . $vf["package_info"][0]->city_code;
@@ -307,12 +342,14 @@ class Tulanduo extends CI_Controller
}
$agcOrderNo .= "(" . $vf["cold"][0]->operator . ")";
$order_remark = "";
- if (trim($vf['cold'][0]->GUT_TEL) != "") {
- $order_remark = "预定人电话:" . trim($vf["cold"][0]->GUT_TEL);
+ if ($i===1) { // 只写一次备注.备注中可能包含代收信息,避免多次收取
+ $order_remark_arr = array_filter(array_map( function($element){return $element->COLD_vendorMemo;}, $vf["cold"] )) ;
+ $order_remark = empty($order_remark_arr) ? "" : implode("\n", $order_remark_arr) ;
}
+
$COLD_SN_str = implode(',', array_map( function($element){return $element->COLD_SN;}, $vf["cold"] )) ;
- $guestlist = $this->BIZ_order->get_guestlist($COLD_SN_str);
- $this->tldOrderBuilder->setUserId($userId)
+ $guestlist = $this->ci->BIZ_order->get_guestlist($COLD_SN_str);
+ $this->ci->tldOrderBuilder->setUserId($userId)
->setKey($userKey)
->setOrderType($order_type)
->setRouteName($routeName)
@@ -324,19 +361,27 @@ class Tulanduo extends CI_Controller
->setTravelDate(strstr($vf["cold"][0]->COLD_StartDate, " ", true))
->setLeavedDate($end_date)
->setOrderRemark($order_remark)
- // ->setOrderRemark(trim($orderinfo[0]->COLI_Memo . "\r\n" . $orderinfo[0]->COLD_Memo . "\r\n" . $orderinfo[0]->COLD_MemoText))
// todo 抵离交通
// ->setToTraffic($toTraffic)
// ->setBackTraffic($backTraffic)
;
+ // 客人列表
foreach ($guestlist as $key => $vg) {
- $this->tldOrderBuilder->setCustomersName($key, $vg->BPE_FirstName . " " . $vg->BPE_LastName )
+ $this_otherinfo = "";
+ $this->ci->tldOrderBuilder->setCustomersName($key, $vg->BPE_FirstName . " " . $vg->BPE_LastName )
->setCustomersPeopleType($key, ($vg->BPE_GuestType==1 ? "成人" : "儿童"))
->setCustomersDocumentType($key, "护照") // Passport No.
->setCustomersDocumentNo($key, $vg->BPE_Passport)
- ->setCustomersOtherInfo($key, $this->BIZ_order->GetNationalityName($vg->BPE_Nationality));
+ ;
+ $this_otherinfo .= $this->ci->BIZ_order->GetNationalityName($vg->BPE_Nationality);
+ if (trim($vf['cold'][0]->GUT_TEL) != "" && $key===0) {
+ $this_otherinfo .= "; 电话:";
+ $this_otherinfo .= trim($vf["cold"][0]->GUT_POST)!=="" ? "+".trim($vf["cold"][0]->GUT_POST) : "" ;
+ $this_otherinfo .= " " . trim($vf["cold"][0]->GUT_TEL);
+ $this->ci->tldOrderBuilder->setCustomersOtherInfo($key, $this_otherinfo);
+ }
}
- $scheduleDetails = $this->BIZ_order->get_scheduleDetails($COLD_SN_str);
+ $scheduleDetails = $this->ci->BIZ_order->get_scheduleDetails($COLD_SN_str);
$schedule_obj = array();
foreach ($scheduleDetails as $ks => $vs) {
$schedule_obj[substr($vs->COLD_StartDate, 0, 10)]['date'] = substr($vs->COLD_StartDate, 0, 10);
@@ -359,10 +404,12 @@ class Tulanduo extends CI_Controller
}
$this_content .= substr($this_guest, 1);
// 酒店
- $hotels = $this->BIZ_order->get_package_order($vs->COLD_SN);
+ $hotels = $this->ci->BIZ_order->get_package_order($vs->COLD_SN);
if (trim($hotels[0]->POI_HotelAddress) != "") {
$this_content .= "\r\n酒店地址:" . $hotels[0]->POI_HotelAddress;
}
+ $this_content .= trim($hotels[0]->POI_HotelCheckInName)!=="" ? "\r\n入住人:".$hotels[0]->POI_HotelCheckInName : "";
+ $this_content .= trim($hotels[0]->POI_HotelCheckIn)!=="" ? "\r\n入住日期:".$hotels[0]->POI_HotelCheckIn : "";
if ($hotels[0]->POI_FlightsNo) {
$this_content .= "\r\n航/车次:" . $hotels[0]->POI_FlightsNo;
if ($hotels[0]->POI_FromCity || $hotels[0]->POI_ToCity) {
@@ -379,16 +426,16 @@ class Tulanduo extends CI_Controller
$schedule_obj[substr($vs->COLD_StartDate, 0, 10)]['accommodation'] = $hotels[0]->POI_Hotel;
// 补充行程
$fill_date = array();
- if (isset($this->trippest->special_route[$vs->PAG_Code])) {
- for ($j=0; $j < $this->trippest->special_route[$vs->PAG_Code]['day']; $j++) {
+ if (isset($this->ci->trippest->special_route[$vs->PAG_Code])) {
+ for ($j=0; $j < $this->ci->trippest->special_route[$vs->PAG_Code]['day']; $j++) {
$e_day = date("Y-m-d", strtotime("+$j day", strtotime($vs->COLD_StartDate)));
if ( ! isset($schedule_obj[$e_day]['content'])) {
$schedule_obj[$e_day]['content'] = "";
}
$schedule_obj[$e_day]['date'] = $e_day;
$fill_date[] = $e_day;
- $schedule_obj[$e_day]['code'] = $this->trippest->special_route[$vs->PAG_Code]['code'][$j];
- $pag_detail = $this->BIZ_order->get_packageDetails("'" . $schedule_obj[$e_day]['code'] . "'");
+ $schedule_obj[$e_day]['code'] = $this->ci->trippest->special_route[$vs->PAG_Code]['code'][$j];
+ $pag_detail = $this->ci->BIZ_order->get_packageDetails("'" . $schedule_obj[$e_day]['code'] . "'");
$schedule_obj[$e_day]['title'] = $pag_detail[0]->PAG2_Name;
$schedule_obj[$e_day]['lunch'] = (in_array($pag_detail[0]->PAG_Meal, array('61002', '61004')) ? 1 : 0);
$schedule_obj[$e_day]['dinner'] = (in_array($pag_detail[0]->PAG_Meal, array('61003', '61004')) ? 1 : 0);
@@ -424,7 +471,7 @@ class Tulanduo extends CI_Controller
$date1 = new DateTime($first_date);
$date_end = new DateTime($end_date);
$date_diff = $date_end->diff($date1);
- $d = ($date_diff->format("%d"));
+ $d = ($date_diff->format("%a"));
$all_date = array();
for ($j=0; $j < ($d+1); $j++) {
$all_date[] = date('Y-m-d', strtotime("+$j day", strtotime($first_date)));
@@ -432,65 +479,50 @@ class Tulanduo extends CI_Controller
$real_date = array_column(array_values($schedule_obj), 'date');
foreach ($all_date as $kd => $vd) {
if ( ! in_array($vd, $real_date)) {
- $this->tldOrderBuilder->setScheduleDetailsTitle($kd, "无")
- ->setScheduleDetailsContent($kd, "无")
- ->setScheduleDetailsAccommodation($kd, "")
- // ->setScheduleDetailsTraffic($kd, ($vso->PAG_Vehicle>60001 ? 1 : 0))
- ->setScheduleDetailsBreakFirst($kd, 0 )
- ->setScheduleDetailsDinner($kd, 0)
- ->setScheduleDetailsLunch($kd, 0)
- ;
+ $this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, "无")
+ ->setScheduleDetailsContent($kd, "无")
+ ->setScheduleDetailsAccommodation($kd, "")
+ // ->setScheduleDetailsTraffic($kd, ($vso->PAG_Vehicle>60001 ? 1 : 0))
+ ->setScheduleDetailsBreakFirst($kd, 0 )
+ ->setScheduleDetailsDinner($kd, 0)
+ ->setScheduleDetailsLunch($kd, 0)
+ ;
continue;
}
foreach (array_values($schedule_obj) as $kso => $vso) {
if ($vd==$vso['date']) {
- $this->tldOrderBuilder->setScheduleDetailsTitle($kd, $vso['date'])
- ->setScheduleDetailsContent($kd, $vso['content'])
- ->setScheduleDetailsAccommodation($kd, $vso['accommodation'])
- // ->setScheduleDetailsTraffic($kd, ($vso->PAG_Vehicle>60001 ? 1 : 0))
- ->setScheduleDetailsBreakFirst($kd, 0 )
- ->setScheduleDetailsDinner($kd, $vso['dinner'] )
- ->setScheduleDetailsLunch($kd, $vso['lunch'])
- ;
+ $this->ci->tldOrderBuilder->setScheduleDetailsTitle($kd, $vso['date'])
+ ->setScheduleDetailsContent($kd, $vso['content'])
+ ->setScheduleDetailsAccommodation($kd, $vso['accommodation'])
+ // ->setScheduleDetailsTraffic($kd, ($vso->PAG_Vehicle>60001 ? 1 : 0))
+ ->setScheduleDetailsBreakFirst($kd, 0 )
+ ->setScheduleDetailsDinner($kd, $vso['dinner'] )
+ ->setScheduleDetailsLunch($kd, $vso['lunch'])
+ ;
}
}
}
// 拆分的订单团款录第一个
if ($i===1) {
- foreach ($travelFees as $kf => $vf) {
- $this->tldOrderBuilder->setTravelFeesType($kf, "Per Group")
- ->setTravelFeesMoney($kf, $vf->GAI_SSJE)
- ->setTravelFeesNum($kf, 1)
- ->setTravelFeesUnit($kf, 1)
- ->setTravelFeesSumMoney($kf, $vf->GAI_SSJE)
- ->setTravelFeesRemark($kf, $vf->GAI_Memo);
+ if ( ! empty($travel_fees) ) {
+ $this->ci->tldOrderBuilder->setTravelFeesType(0, "Per Group")
+ ->setTravelFeesMoney(0, $travel_fees->SUM_SSJE)
+ ->setTravelFeesNum(0, 1)
+ ->setTravelFeesUnit(0, 1)
+ ->setTravelFeesSumMoney(0, $travel_fees->SUM_SSJE);
+ }
+ if ( ! empty($replace_collections) ) {
+ $this->ci->tldOrderBuilder->setReplaceCollectionsType(0, "Per Group")
+ ->setReplaceCollectionsMoney(0, $replace_collections->SUM_SSJE)
+ ->setReplaceCollectionsRemark(0, $replace_collections->ALL_Memo);
}
}
- // 查询是否变更
+ // 查询是否变更 TODO deprecated
$sync_orderstate = 10;
$vps_sn = 0;
$vendor_orderid = 0;
- $plan_detail_page_url = "http://p.mycht.cn/Cooperate/Plan_Detail.aspx?GSN=" . $gri_sn;
- $plan_detail_page = " 计划下载:$plan_detail_page_url ";
- if (intval($is_send_vary)===1) {
- $vps = $this->Group_model->get_sync_info($vas_sn, $tour_code);
- if ( ! empty($vps)) {
- $vps_sn = $vps->VPS_SN;
- $vendor_orderid = $vps->VPS_externalId;
- $sync_orderstate = 11;
- $modifyLogInfo = "$plan_detail_page $change_info ";
- $this->tldOrderBuilder->setOrderId($vendor_orderid)
- ->setModifyLogInfo($modifyLogInfo)
- ;
- }
- } else {
- $modifyLogInfo = $plan_detail_page;
- $this->tldOrderBuilder->clearModifyLogInfo();
- $this->tldOrderBuilder->setModifyLogInfo($modifyLogInfo)
- ;
- }
- $resp = $this->excute_curl($this->neworder_url, $this->tldOrderBuilder);
- // $resp = '{"status":1,"errMsg":"","responseData":{"orderId":' . rand(1000,9999) . '}}'; // test
+ $this->ci->tldOrderBuilder->clearModifyLogInfo();
+ $resp = $this->excute_curl($this->neworder_url, $this->ci->tldOrderBuilder);
$response = json_decode($resp);
if ($response->status == 1) {
/** VendorPlanSync */
@@ -508,19 +540,22 @@ class Tulanduo extends CI_Controller
,"VPS_sendTime" => date('Y-m-d H:i:s')
);
if ($vps_sn === 0) {
- $sync_id = $this->Group_model->insert_VendorPlanSync($sync_ret);
+ $sync_id = $this->ci->Group_model->insert_VendorPlanSync($sync_ret);
+ $this->ci->BIZ_order->insert_biz_order_log($coli_sn, "vendorPlanSendout_" . $tour_code);
} else {
- $update = $this->Group_model->update_VendorPlanSync($vps_sn, $sync_ret);
+ $update = $this->ci->Group_model->update_VendorPlanSync($vps_sn, $sync_ret);
+ $this->ci->BIZ_order->insert_biz_order_log($coli_sn, "vendorPlanUpdateSendout_" . $tour_code);
}
/** VendorArrangeState VAS_IsReceive */
- $this->Group_model->set_plan_received($vas_sn);
+ $this->ci->Group_model->set_plan_received($vas_sn);
}
}
- return "[Tulanduo>push_trippest] Done. ";
+ return "[Tulanduo>push_trippest] Done. " . $COLI_ID;
}
public function tourguide_update($input, $vps, $eva)
{
+ return false; // for Trippest deploy
$ret['status'] = -1;
$ret['err'] = 100;
$ret['errMsg'] = "未知错误";
@@ -594,6 +629,7 @@ class Tulanduo extends CI_Controller
*/
public function order_change()
{
+ return false; // for Trippest deploy
$this->load->model('Order_update');
$ret['status'] = -1;
$ret['errMsg'] = "未知错误";
@@ -658,7 +694,8 @@ class Tulanduo extends CI_Controller
}
- private function excute_curl($url, $content_builder) {
+ private function excute_curl($url, $content_builder)
+ {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
diff --git a/webht/third_party/vendorPlanSync/libraries/trippest.php b/webht/third_party/vendorPlanSync/libraries/trippest.php
index dfc48fe6..ebba5748 100644
--- a/webht/third_party/vendorPlanSync/libraries/trippest.php
+++ b/webht/third_party/vendorPlanSync/libraries/trippest.php
@@ -10,8 +10,6 @@ class Trippest
$this->ci =& get_instance();
}
- public $tulanduo_vei_sn = array(1343,30548,29188);
-
public function tour_name($pag_code)
{
$name = "";
diff --git a/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php b/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php
index bef796ca..50307ec4 100644
--- a/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php
+++ b/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php
@@ -35,12 +35,14 @@ class BIZ_Orders_model extends CI_Model {
public function get_orderinfo_detail($gri_sn, $vei_sn_str)
{
$sql = "SELECT coli.COLI_ID,
+ coli.COLI_SN,
coli.COLI_Department,
cold.COLD_ServiceSN,
(select PAG_Code from biz_packageinfo where PAG_SN=cold.COLD_ServiceSN) as pag_code,
cold.COLD_ServiceSN2,
cold.COLD_ServiceCity,
gut.GUT_NationalityID,
+ isnull(COLI_PVT, 0) is_pvt,
(select opi2_name from tourmanager.dbo.operatorinfo2 where opi2_opi_sn=coli_opi_id and opi2_lgc=2) as operator,
*
FROM BIZ_ConfirmLineInfo coli
@@ -105,13 +107,25 @@ class BIZ_Orders_model extends CI_Model {
return $this->HT->query($sql)->result();
}
- public function get_paymentDetails($COLI_ID)
+ /*!
+ * [get_paymentDetails description]
+ * @date 2019-05-22
+ * VEI:
+ * * 30561 桂林海纳国旅
+ * GAI_Type
+ * * 15006 地接代收
+ * * 15008 现付
+ * * 15017 内部转账
+ * * 15020 地接社代收
+ */
+ public function get_paymentDetails($COLI_ID, $vei_sn_str)
{
- $sql = "SELECT *
+ $sql = "SELECT ISNULL(bgai.GAI_VEI_SN,0) payment_vei
+ ,bgai.*
FROM BIZ_GroupAccountInfo bgai
INNER JOIN BIZ_ConfirmLineInfo coli ON bgai.GAI_COLI_SN=coli.COLI_SN
- WHERE bgai.DeleteFlag=0 AND bgai.GAI_Type NOT IN (15006,15008,15017)
- AND ISNULL(bgai.GAI_VEI_SN,0)<>1343
+ WHERE bgai.DeleteFlag=0 --AND bgai.GAI_Type NOT IN (15006,15008,15017)
+ AND ISNULL(bgai.GAI_VEI_SN,0) in (0,$vei_sn_str)
AND bgai.GAI_SQJE > 0
AND coli_ID = '$COLI_ID'";
$query = $this->HT->query($sql);
@@ -1816,5 +1830,23 @@ class BIZ_Orders_model extends CI_Model {
$query = $this->HT->query($sql);
}
+ /*!
+ * 写入商务订单操作记录
+ * @param [int] $coli_sn
+ * @param [string] $log_info varchar(100)
+ */
+ public function insert_biz_order_log($coli_sn, $log_info)
+ {
+ $db_column = array(
+ "BOL_COLI_SN" => $coli_sn
+ ,"BOL_OPI_SN" => 29
+ ,"BOL_OPType" => $log_info
+ ,"BOL_OPTime" => date('Y-m-d H:i:s')
+ ,"BOL_Creator" => 29
+ ,"BOL_CreateTime" => date('Y-m-d H:i:s')
+ );
+ return $this->HT->insert("BIZ_OrderOperationLog", $db_column);
+ }
+
}
diff --git a/webht/third_party/vendorPlanSync/models/Group_model.php b/webht/third_party/vendorPlanSync/models/Group_model.php
index e17b8b5e..6d2e4d94 100644
--- a/webht/third_party/vendorPlanSync/models/Group_model.php
+++ b/webht/third_party/vendorPlanSync/models/Group_model.php
@@ -22,16 +22,18 @@ class Group_model extends CI_Model {
inner join GRoupInfo gri on GRI_SN=VAS_GRI_SN
where 1=1 ";
$sql .= $gri_sn!==0 ? $gri_sql : "
- and VAS_IsCancel=0 and VAS_Delete=0 and vas.DeleteFlag=0
- and VAS_IsSendSucceed=1
- and VAS_IsConfirm=0
- and EOI_GetDate between '$start_date' and '$end_date'
- and VAS_VEI_SN in ($vendor_str)
- and GRI_operator in (161,443,61) -- test
- and GRI_OrderType=227002 -- test
- and (VAS_IsReceive=0 or (VAS_SendTime > ISNULL(VAS_ReceiveTime,0))) ";
- $sql .= " order by EOI_GetDate asc, vas.VAS_IsConfirm asc";
-// log_message('error',$sql);
+ AND VAS_IsCancel=0 AND VAS_Delete=0 AND vas.DeleteFlag=0
+ AND VAS_IsSendSucceed=1 AND VAS_IsReceive=0
+ AND EOI_GetDate between '$start_date' AND '$end_date'
+ AND VAS_VEI_SN in ($vendor_str)
+ -- Trippest, not confirm, not change -- for Trippest deploy
+ AND GRI_OrderType=227002
+ AND VAS_IsConfirm=0 AND VAS_SendVary=0
+ AND EXISTS (
+ select 1 from OperatorInfo where OPI_SN=GRI_operator AND OPI_DEI_SN=30
+ )
+ ";
+ $sql .= " order by EOI_GetDate asc,vas.VAS_SendTime asc, vas.VAS_IsConfirm asc";
return $this->HT->query($sql)->result();
}
@@ -67,17 +69,19 @@ class Group_model extends CI_Model {
);
$conn = sqlsrv_connect($db['HT']['hostname'], $connection);
$stmt = sqlsrv_query($conn, "EXEC Tourmanager.dbo.SP_VendorPlan_GetPlanInfo $gri_sn, $vendor_id, 0 ");
+ $result_object = array();
+ if (false !== $stmt) { // 无权限返回false,会导致下列sqlsrv_has_rows,sqlsrv_next_result死循环
//存储过程中每一个select都会产生一个结果集,取某个结果集就需要从第一个移动到需要的那个结果集
//如果结果集为空就移到下一个
while (sqlsrv_has_rows($stmt) !== TRUE) {
sqlsrv_next_result($stmt);
}
- $result_object = array();
while ($row = sqlsrv_fetch_object($stmt)) {
$result_object[] = $row;
}
sqlsrv_free_stmt($stmt);
- sqlsrv_close($conn);
+ }
+ sqlsrv_close($conn);
$grd_info = $result_object;
$all_day_no = array_map(function($ele){return $ele->GRD_DayNo;}, $grd_info);
$day_no_str = implode(",", $all_day_no);
@@ -256,6 +260,7 @@ class Group_model extends CI_Model {
public function insert_VendorPlanSync($sync_arr=array())
{
+ $ss = $this->HT->insert_string('VendorPlanSendout', $sync_arr); // testing
$this->HT->insert('VendorPlanSendout', $sync_arr);
return $this->HT->query("SELECT MAX(VPS_SN) VPS_SN from VendorPlanSendout")
->row()->VPS_SN;
diff --git a/webht/views/index/index.php b/webht/views/index/index.php
index e7d9c90a..4f6171ba 100644
--- a/webht/views/index/index.php
+++ b/webht/views/index/index.php
@@ -1,11 +1,11 @@
-
+
+
\ No newline at end of file
diff --git a/webht/views/verify.php b/webht/views/verify.php
index 45897e97..caab44da 100644
--- a/webht/views/verify.php
+++ b/webht/views/verify.php
@@ -13,12 +13,13 @@
您的IP:
-
+