Merge branch 'master' of gitee.com:hainatravel/information-system

hotfix/远程访问多媒体中心
cyc 6 years ago
commit e55d65c924

@ -1,5 +1,5 @@
<?php <?php
//途牛接口创建请求签名 //途牛接口创建请求签名
function create_sign(){ function create_sign(){
$time = date('Y-m-d H:i:s',time()); $time = date('Y-m-d H:i:s',time());
$secretKey = 'qvHMJVywEQqsd4EneHQl'; $secretKey = 'qvHMJVywEQqsd4EneHQl';
@ -9,20 +9,20 @@ function create_sign(){
return strtoupper(md5($sign)); return strtoupper(md5($sign));
} }
//证件名称转id //证件名称转id
function strexchangeid($name){ function strexchangeid($name){
if($name != ''){ if($name != ''){
switch ($name){ switch ($name){
case '二代身份证': case '二代身份证':
return '1'; return '1';
break; break;
case '护照': case '护照':
return 'B'; return 'B';
break; break;
case '台湾通行证': case '台湾通行证':
return 'G'; return 'G';
break; break;
case '港澳通行证': case '港澳通行证':
return 'C'; return 'C';
break; break;
default : default :
@ -32,46 +32,46 @@ function strexchangeid($name){
} }
} }
//特殊字符转换 //特殊字符转换
function chk_sp_name($name){ function chk_sp_name($name){
$name = str_replace( $name = str_replace(
array('á', 'é', 'è', 'í', 'ó', 'ú', '?', 'á', 'é', 'í', 'ó', 'ú', '?',' ','/',' ',','), array('á','ë','é','è','í','ó','ú','á','é','í','ó','ú',' ','/',' ',','),
array('a', 'e', 'e', 'i', 'o', 'u', 'n', 'A', 'E', 'I', 'O', 'U', 'N','','','',''), array('a','e','e','e','i','o','u','A','E','I','O','U','','','',''),
$name $name
); );
return substr(strtoupper($name),0,30); return substr(strtoupper($name),0,30);
} }
//发送请求函数 //发送请求函数
function GetPost_http($url, $data = '',$format='') { function GetPost_http($url, $data = '',$format='') {
if(!isset($_SERVER['HTTP_USER_AGENT'])){ if(!isset($_SERVER['HTTP_USER_AGENT'])){
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400'; $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400';
} }
$curl = curl_init(); // 启动一个CURL会话 $curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
if (!empty($data)) { if (!empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求 curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包 curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
if($format == 'json'){ if($format == 'json'){
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
} }
} }
curl_setopt($curl, CURLOPT_TIMEOUT, 40); // 设置超时限制防止死循环 curl_setopt($curl, CURLOPT_TIMEOUT, 40); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_TIMEOUT_MS, 40000); // 设置超时限制防止死循环 curl_setopt($curl, CURLOPT_TIMEOUT_MS, 40000); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作 $tmpInfo = curl_exec($curl); // 执行操作
$errno = curl_errno($curl); $errno = curl_errno($curl);
if ($errno !== 0) { if ($errno !== 0) {
log_message('error', 'ctripost'.$errno.curl_error($curl)); log_message('error', 'ctripost'.$errno.curl_error($curl));
} }
curl_close($curl); //关闭CURL会话 curl_close($curl); //关闭CURL会话
return $tmpInfo; //返回数据 return $tmpInfo; //返回数据
} }
function get_microtime (){ function get_microtime (){

@ -93,6 +93,12 @@ class WxpayService extends CI_Controller {
} }
async_curl($this->config->item('send_notify_url', 'wxpay')); async_curl($this->config->item('send_notify_url', 'wxpay'));
async_curl('https://www.mycht.cn/webht.php/apps/pay/alipaytradeservice/get_billfile'); async_curl('https://www.mycht.cn/webht.php/apps/pay/alipaytradeservice/get_billfile');
/**
* 每月20号发送退款给财务
*/
if (date('d')==='20') {
async_curl('https://www.mycht.cn/webht.php/apps/pay/paymentservice/refund_finance_notify');
}
return; return;
} }

@ -41,6 +41,7 @@ class Vendor_money extends CI_Controller {
,"default_date2" => $end_date ,"default_date2" => $end_date
,"default_vendor" => $vendors ,"default_vendor" => $vendors
,"trippest_order_vendor_money" => array() ,"trippest_order_vendor_money" => array()
,"trippest_order_multi_city" => array()
,"transfer_sum" => 0 ,"transfer_sum" => 0
/** 列总计 */ /** 列总计 */
,"col_sum" => array( ,"col_sum" => array(
@ -68,6 +69,7 @@ class Vendor_money extends CI_Controller {
) )
) )
); );
$result['trippest_order_multi_city'] = array_merge($result['trippest_order_multi_city'], $this->money_model->trippest_order_multi_city($start_date, $end_date, implode(',', $vendors)));
/** 团款 */ /** 团款 */
foreach ($vendors as $key => $vendor) { foreach ($vendors as $key => $vendor) {
$sourcetype = $vendor_sourcetype[strval($vendor)]["sourcetype"]; $sourcetype = $vendor_sourcetype[strval($vendor)]["sourcetype"];
@ -78,7 +80,8 @@ class Vendor_money extends CI_Controller {
"trippest_sum" => 0, "trippest_sum" => 0,
"vendor_sum" => 0, "vendor_sum" => 0,
"other_sum_cost" => 0, "other_sum_cost" => 0,
"other_sum" => 0 "other_sum" => 0,
"other_vendor_sum" => 0
), ),
"vendor" => "vendor" =>
array( array(
@ -86,7 +89,8 @@ class Vendor_money extends CI_Controller {
"vendor_sum" => 0, "vendor_sum" => 0,
"transfer_sum" => 0, "transfer_sum" => 0,
"other_sum_cost" => 0, "other_sum_cost" => 0,
"other_sum" => 0 "other_sum" => 0,
"other_vendor_sum" => 0
) )
); );
// 按照海纳的算法 // 按照海纳的算法
@ -100,6 +104,7 @@ class Vendor_money extends CI_Controller {
$ret['trippest']['other_sum'] = bcadd($ret['trippest']['other_sum'], $opi_money['other_price_sum']); $ret['trippest']['other_sum'] = bcadd($ret['trippest']['other_sum'], $opi_money['other_price_sum']);
$ret['trippest']['other_sum_cost'] = bcadd($ret['trippest']['other_sum_cost'], $opi_money['other_cost_sum']); $ret['trippest']['other_sum_cost'] = bcadd($ret['trippest']['other_sum_cost'], $opi_money['other_cost_sum']);
$ret["trippest"]['trippest_sum'] = bcsub($ret["trippest"]['trippest_sum'], $opi_money['other_price_sum']); $ret["trippest"]['trippest_sum'] = bcsub($ret["trippest"]['trippest_sum'], $opi_money['other_price_sum']);
$ret['trippest']['other_vendor_sum'] = bcadd($ret['trippest']['other_vendor_sum'], $opi_money['other_vendorprice_RMB_sum']);
} }
// 按照图兰朵算法: Trippest自营订单的代收算在海纳收款 // 按照图兰朵算法: Trippest自营订单的代收算在海纳收款
foreach ($opi_summoney as $kv => $opi_money_v) { foreach ($opi_summoney as $kv => $opi_money_v) {
@ -112,6 +117,7 @@ class Vendor_money extends CI_Controller {
$ret['vendor']['other_sum'] = bcadd($ret['vendor']['other_sum'], $opi_money_v['other_price_sum']); $ret['vendor']['other_sum'] = bcadd($ret['vendor']['other_sum'], $opi_money_v['other_price_sum']);
$ret['vendor']['other_sum_cost'] = bcadd($ret['vendor']['other_sum_cost'], $opi_money_v['other_cost_sum']); $ret['vendor']['other_sum_cost'] = bcadd($ret['vendor']['other_sum_cost'], $opi_money_v['other_cost_sum']);
$ret["vendor"]['trippest_sum'] = bcsub($ret["vendor"]['trippest_sum'], $opi_money_v['other_price_sum']); $ret["vendor"]['trippest_sum'] = bcsub($ret["vendor"]['trippest_sum'], $opi_money_v['other_price_sum']);
$ret['vendor']['other_vendor_sum'] = bcadd($ret['vendor']['other_vendor_sum'], $opi_money['other_vendorprice_RMB_sum']);
} }
$ret["vendor"]["transfer_sum"] = bcsub($ret["vendor"]['vendor_sum'], $ret["trippest"]['vendor_sum']); $ret["vendor"]["transfer_sum"] = bcsub($ret["vendor"]['vendor_sum'], $ret["trippest"]['vendor_sum']);
if ($ret["vendor"]["transfer_sum"] != 0) { if ($ret["vendor"]["transfer_sum"] != 0) {

@ -17,6 +17,7 @@ class Vendor_money_model extends CI_Model {
$sql = "SELECT sum_opi.COLI_OPI_ID,sum(sum_opi.海纳收款) as trippest_sum,sum(sum_opi.地接社收款) as vendor_sum, $sql = "SELECT sum_opi.COLI_OPI_ID,sum(sum_opi.海纳收款) as trippest_sum,sum(sum_opi.地接社收款) as vendor_sum,
sum(sum_opi.other_price_RMB) as other_price_sum sum(sum_opi.other_price_RMB) as other_price_sum
, sum(sum_opi.other_cost_RMB) as other_cost_sum , sum(sum_opi.other_cost_RMB) as other_cost_sum
,sum(sum_opi.other_vendorprice_RMB) as other_vendorprice_RMB_sum
from ( from (
SELECT SELECT
(select isnull(SUM(COLD_TotalPrice),0) from BIZ_ConfirmLineDetail cold (select isnull(SUM(COLD_TotalPrice),0) from BIZ_ConfirmLineDetail cold
@ -31,6 +32,11 @@ class Vendor_money_model extends CI_Model {
and COLD_PlanVEI_SN IN ($all_vendor) and COLD_PlanVEI_SN IN ($all_vendor)
and cold.DeleteFlag=0 and cold.DeleteFlag=0
) as other_cost_RMB, ) as other_cost_RMB,
(dbo.ConvertToRMB('USD',other_vendor_price)) as other_vendorprice_RMB,
case when other_vendor_price > 0 then
(总收款-dbo.ConvertToRMB('USD',other_vendor_price))
else 海纳收款_origin end
as 海纳收款,
* *
from ( from (
select select
@ -40,6 +46,13 @@ class Vendor_money_model extends CI_Model {
and COLD_ServiceType='D' and COLD_ServiceType='D'
and DeleteFlag=0 and DeleteFlag=0
) as service_cnt, ) as service_cnt,
(select isnull(SUM(COLD_TotalPrice),0) from BIZ_ConfirmLineDetail
where COLD_COLI_SN=COLI_SN
--and COLD_ServiceType='D'
and DeleteFlag=0
and COLD_PlanVEI_SN<>$vendor
and COLD_PlanVEI_SN not in ($all_vendor)
) as other_vendor_price,
COLI.COLI_sourcetype, COLI.COLI_sourcetype,
COLI.COLI_Price, COLI.COLI_Price,
coli.COLI_Currency, coli.COLI_Currency,
@ -54,9 +67,10 @@ class Vendor_money_model extends CI_Model {
(select isnull(SUM(GAI_SSJE),0) from BIZ_GroupAccountInfo (select isnull(SUM(GAI_SSJE),0) from BIZ_GroupAccountInfo
where DeleteFlag=0 and GAI_COLI_SN=COLI_SN where DeleteFlag=0 and GAI_COLI_SN=COLI_SN
and GAI_Type not in (" . PAY_OTHER . ") and GAI_Type not in (" . PAY_OTHER . ")
) as 海纳收款, ) as 海纳收款_origin,
(select isnull(SUM(GAI_SSJE),0) from BIZ_GroupAccountInfo (select isnull(SUM(GAI_SSJE),0) from BIZ_GroupAccountInfo
where DeleteFlag=0 and GAI_COLI_SN=COLI_SN where DeleteFlag=0 and GAI_COLI_SN=COLI_SN
and GAI_VEI_SN=$vendor
and GAI_Type in (" . PAY_OTHER . ") and GAI_Type in (" . PAY_OTHER . ")
) as 地接社收款 ) as 地接社收款
,coli.COLI_OPI_ID ,coli.COLI_OPI_ID
@ -71,8 +85,12 @@ class Vendor_money_model extends CI_Model {
) )
and CGI_Checked=1 and CGI_Checked=1
and GRI_OrderType=227002 and GRI_OrderType=227002
and exists (
and COLI_sourcetype=$sourcetype select 1 from BIZ_ConfirmLineDetail where COLD_COLI_SN=coli.COLI_SN
and DeleteFlag=0
and COLD_PlanVEI_SN=$vendor
)
-- and COLI_sourcetype=$sourcetype
) as cgi_group ) as cgi_group
) as sum_opi ) as sum_opi
group by sum_opi.COLI_OPI_ID group by sum_opi.COLI_OPI_ID
@ -154,6 +172,58 @@ class Vendor_money_model extends CI_Model {
return $query->result_array(); return $query->result_array();
} }
public function trippest_order_multi_city($start_date, $end_date, $all_vendor)
{
$sql = "SELECT COLI_SN,COLI_ID,COLI_GroupCode,
(select top 1 ISNULL(GCI_combineNo,'') from GroupCombineInfo where GCI_GRI_SN=COLI_GRI_SN) as gci_no,
convert(date,cgi.CGI_ArriveDate) CGI_ArriveDate,
COLI.COLI_sourcetype, COLI.COLI_Price, coli.COLI_Currency,
(select isnull(SUM(dbo.ConvertToRMB('USD',COLD_TotalPrice)),0) from BIZ_ConfirmLineDetail
where COLD_COLI_SN=COLI_SN
and DeleteFlag=0
and COLD_PlanVEI_SN not in ($all_vendor)
) as other_vendorprice_RMB
,(select isnull(SUM(dbo.ConvertToRMB('USD',COLD_TotalPrice)),0) from BIZ_ConfirmLineDetail
where COLD_COLI_SN=COLI_SN
and DeleteFlag=0
and COLD_PlanVEI_SN in ($all_vendor)
) as this_vendorprice_RMB
,(SELECT isnull(SUM(GAI_SSJE),0)
FROM BIZ_GroupAccountInfo
WHERE DeleteFlag=0
AND GAI_COLI_SN=COLI_SN
) AS money_sum
,(select dbo.[GetVendorName](COLD_PlanVEI_SN,2) from BIZ_ConfirmLineDetail
where COLD_COLI_SN=COLI_SN
and DeleteFlag=0
and COLD_PlanVEI_SN in ($all_vendor)
) as vendor_name
FROM CK_GroupInfo cgi
INNER JOIN GRoupInfo gri ON CGI_GRI_SN=GRI_SN
INNER JOIN BIZ_ConfirmLineInfo coli ON COLI_GRI_SN=GRI_SN
WHERE 1=1
AND CGI_ArriveDate BETWEEN '$start_date' and '$end_date'
AND EXISTS
(SELECT 1
FROM OperatorInfo
WHERE OPI_DEI_SN=30
AND OPI_SN=CGI_OPI_SN)
AND CGI_Checked=1
AND GRI_OrderType=227002
AND COLI_OPI_ID <> 435
AND exists (
select 1 from BIZ_ConfirmLineDetail where COLD_COLI_SN=COLI_SN
and COLD_PlanVEI_SN in ($all_vendor) --in ($all_vendor)
)
AND exists (
select 1 from BIZ_ConfirmLineDetail where COLD_COLI_SN=COLI_SN
and COLD_PlanVEI_SN not in ($all_vendor)
)
ORDER BY COLI_sourcetype ";
$query = $this->HT->query($sql);
return $query->result_array();
}
} }

@ -119,6 +119,21 @@
<?php <?php
} }
?> ?>
<?php
if ($trippest['trippest']['other_vendor_sum'] > 0) {
?>
<tr class="bg-grey">
<td >已扣减的其他地接的团款 <br></td>
<td ><?php echo $trippest['trippest']['other_vendor_sum'] ?></td>
<td ></td>
<td ></td>
<td ></td>
<td ></td>
<td colspan="4"></td>
</tr>
<?php
}
?>
<?php <?php
} }
} ?> } ?>
@ -136,8 +151,32 @@
<td><?php echo $col_sum['trippest']['sum_payout'] ?></td> <td><?php echo $col_sum['trippest']['sum_payout'] ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if ( ! empty($trippest_order_multi_city)) {
?>
<tr class="text-bold">
<th >多地预订的团号</th>
<th >拼团号</th>
<th >总报价/USD</th>
<th >总收款/RMB</th>
<th >计入上表海纳收团款</th>
<th colspan="4">应扣除的其他地接收款: (实时计算, 存在汇率误差)</th>
</tr>
<?php foreach ($trippest_order_multi_city as $ko => $order) {
?>
<tr>
<td class="text-left"><?php echo $order['COLI_GroupCode'] ?></td>
<td class="text-left"><?php echo $order['gci_no'] ?></td>
<td ><?php echo $order['COLI_Price'] ?></td>
<td ><?php echo $order['money_sum'] ?></td>
<td ><?php echo bcsub($order['money_sum'],$order["other_vendorprice_RMB"]) ?>
<br> <?php echo ($order["vendor_name"]) ?>
</td>
<td colspan="4" class="text-left"><?php echo $order["other_vendorprice_RMB"] ?></td>
</tr>
<?php } } ?>
</tbody> </tbody>
</table> </table>
<!--
<p>旧的算法, 需扣除Trippest自营订单的地接代收款项:</p> <p>旧的算法, 需扣除Trippest自营订单的地接代收款项:</p>
<table class="table table-bordered table-hover"> <table class="table table-bordered table-hover">
<thead> <thead>
@ -218,6 +257,7 @@
<?php } } ?> <?php } } ?>
</tbody> </tbody>
</table> </table>
-->
</div> </div>
</body> </body>
<script src="/js/jquery.min.js" type="text/javascript"></script> <script src="/js/jquery.min.js" type="text/javascript"></script>

Loading…
Cancel
Save