短信发送平台和订单来源查询系统

feature/pay
cyc 6 years ago
parent 5a639a518f
commit 7b5ff8a08f

@ -123,6 +123,12 @@ class ctrip_train extends CI_Controller{
$rwNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '一等双软下'){
$ydrwPrice = $Seats->Price * 10;
$SeaType .= '"I":"'.$ydrwPrice.'","AI":"¥'.$Seats->Price.'",';
$ydrwNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '软座'){
$rzPrice = $Seats->Price * 10;
$SeaType .= '"2":"'.$rzPrice.'","A2":"¥'.$Seats->Price.'",';
@ -167,6 +173,12 @@ class ctrip_train extends CI_Controller{
$ywNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '二等双软下'){
$errwPrice = $Seats->Price * 10;
$SeaType .= '"J":"'.$errwPrice.'","AJ":"¥'.$Seats->Price.'",';
$errwNum = $Seats->TicketLeft;
}
if($Seats->SeatName == '动卧下'){
$SeaType .= '"F":"¥'.$Seats->Price.'",';
$dwNum = $Seats->TicketLeft;
@ -175,6 +187,7 @@ class ctrip_train extends CI_Controller{
$PriceStr = $SeaType.'"train_no":'.'"'.$TrainInfo->TrainNo.'"';
}
//对返回的数据进行容错处理
$gjrwNum = isset($gjrwNum) ? ticket_exchange($gjrwNum,$iseven) : '';
$rwNum = isset($rwNum) ? ticket_exchange($rwNum,$iseven) : '';
@ -187,6 +200,17 @@ class ctrip_train extends CI_Controller{
$ydzNum = isset($ydzNum) ? ticket_exchange($ydzNum,$iseven) : '';
$swzNum = isset($swzNum) ? ticket_exchange($swzNum,$iseven) : '';
$dwNum = isset($dwNum) ? ticket_exchange($dwNum,$iseven) : '';
$ydrwNum = isset($ydrwNum) ? ticket_exchange($ydrwNum,$iseven) : '';
$errwNum = isset($errwNum) ? ticket_exchange($errwNum,$iseven) : '';
if($rwNum == '' && $ydrwNum != ''){
$rwNum = $ydrwNum;
}
if($ywNum == '' && $errwNum != ''){
$ywNum = $errwNum;
}
$runMin = $TrainInfo->DurationMinutes % 60;
$runHour = ($TrainInfo->DurationMinutes - $runMin) / 60;

@ -17,7 +17,11 @@ $config['tripadvisor_website'] = array(
'Lijiang' => 'http://www.tripadvisor.com/Attraction_Review-g303783-d8464335-Reviews{PAGENUM}China_Highlights_Lijiang-Lijiang_Yunnan.html',
'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'
'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'
);

@ -11,6 +11,11 @@ class Index extends CI_Controller {
public function __construct() {
parent::__construct();
//$this->output->enable_profiler(TRUE);
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');
$this->load->model('Tripadvisor_Review_model');
}
@ -187,4 +192,155 @@ class Index extends CI_Controller {
echo json_encode(array('group_result' => $this->load->view('find_group_result', $data, true), 'tr_content' => $data['ta_review']->tr_content));
}
//第三方数据导入
public function third_party_input(){
$this->load->view('bootstrap3/header');
$this->load->view('third_party_input');
$this->load->view('bootstrap3/footer');
}
function ensure_writable_dir($dir) {
if(!file_exists($dir)) {
mkdir($dir, 0766, true);
chmod($dir, 0766);
chmod($dir, 0777);
}else if(!is_writable($dir)) {
chmod($dir, 0766);
chmod($dir, 0777);
if(!is_writable($dir)) {
throw new FileSystemException("目录 $dir 不可写");
}
}
}
//第三方数据录入
public function analysis_excel(){
$filename = date('Y').date('m').date('d').date('h').date('i').date('s').'.'.explode('.',$_FILES['fileArray']['name'])[1];
$tmp = $_FILES['fileArray']['tmp_name'];
$error = $_FILES['fileArray']['error'];
if($error > 0){
header("HTTP/1.1 404 Not Found");
echo '{"status":404,"message":'.$_FILES["fileArray"]["error"].'}';
}else{
$path = 'upload/'.date('Y').'/'.date('m').'/';
$this->ensure_writable_dir($path);
if(move_uploaded_file($tmp,$path.$filename)){
require_once "PHPExcel/IOFactory.php";
$phpExcel = PHPExcel_IOFactory::load($path.$filename);
//创建返回的数组
$data = [];
foreach ($phpExcel->getSheetNames() as $key=>$destination){
$data[$key] = new stdClass();
$data[$key]->destination = $destination;
$data[$key]->list_name = array();
$data[$key]->list_data = array();
//循环获取每个表格的行/列数
$row = $phpExcel->getActiveSheet()->getHighestRow();
$column = $phpExcel->getActiveSheet()->getHighestColumn();
$j = 0;
// 行数循环
for ($i = 1; $i <= $row; $i++) {
// 列数循环
for ($c = 'A'; $c <= $column; $c++) {
if($phpExcel->getActiveSheet($key)->getCell('A' . $i)->getValue() == ''){
continue;
}else{
if($i == 1){
array_push($data[$key]->list_name,$phpExcel->getActiveSheet($key)->getCell($c . $i)->getValue());
}else{
$data[$key]->list_data[$j][] = $phpExcel->getActiveSheet($key)->getCell($c . $i)->getValue();
}
}
}
$j++;
}
}
//返回处理完后的json
print_r(json_encode($data));
}else{
header("HTTP/1.1 404 Not Found");
echo '{"status":404,"message":"文件上传失败!","picname":""}';
}
}
}
public function get_destination_reviews($destination = null){
$ta_website = $this->config->item('tripadvisor_website');
//根据传入的目的地简码获取TA的相应评论列表
if(isset($ta_website[$destination])){
$url = $ta_website[$destination];
//根据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;
}
}
}
function get_reviews_detail(){
set_time_limit(0);
$url = $this->input->get_post('url');
$destination = $this->input->get_post('destination');
//$url = 'https://www.tripadvisor.com/ShowUserReviews-g294212-d4006739-r666168101-The_Trippest_Mini_Group_Tours-Beijing.html';
$destination = 'tp_Beijing';
if($url != ''){
$content = GET_HTTP($url);
$html_object = str_get_html($content);
//做一个数组用于存储数据
$detail_data = new stdClass();
$detail_data->destination = $destination;
//提取局部,不做整个页面的寻找元素,提升效率
$meta_inner = $html_object->find('.meta_inner');
foreach($meta_inner as $detail_info){
//获取评论者帐号
foreach($detail_info->find('.info_text') as $review_name){
$detail_data->review_name = $review_name->first_child()->innertext;
}
//获取评论者ID
foreach($detail_info->find('.reviewSelector') as $review_id){
$detail_data->review_id = str_replace('review_','',$review_id->id);
}
//获取标题
foreach($detail_info->find('#HEADING') as $title){
$detail_data->title = $title->innertext;
}
//获取星级
foreach($detail_info->find('.ui_bubble_rating') as $star_nums){
$detail_data->star_nums = str_replace('ui_bubble_rating ','',$star_nums->getAttribute('class'));
$detail_data->star_nums = str_replace(array('bubble_50','bubble_40','bubble_30','bubble_20'),array(5,4,3,2),$detail_data->star_nums);
}
//获取评论内容
foreach($detail_info->find('.partial_entry .fullText') as $content){
$detail_data->content = $content->innertext;
}
//获取评论时间
foreach($detail_info->find('.prw_reviews_stay_date_hsx') as $review_date){
$detail_data->review_date = str_replace('<span class="stay_date_label">Date of experience:</span> ','',$review_date->innertext);
}
}
//拿到数据后进行入库
print_r(json_encode($detail_data));
}
}
}

@ -0,0 +1,183 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Index extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper('message');
$this->key = '3d15821171548bf7d0a93afab66e797b';
$this->sendsms = 'https://yun.tim.qq.com/v5/tlssmssvr/sendsms';
}
public function test(){
echo phpinfo();
/*try {
echo '1';
} finally {
echo '2';
}*/
}
public function index(){
$this->load->view('n-header');
$this->load->view('message_index');
}
//新建短信模板
public function add_templete(){
$templete = htmlspecialchars($this->input->post('templete'));
$title = $this->input->post('title');
if(empty($templete)){
header("HTTP/1.1 404 Not Found");
exit('{"status":"404","reason":"传参为空!"}');
}
if(empty($title)){
$title = 'trippset'.rand(1,100);
}
$random = rand(1000,9999);
$time = time();
$sig = 'appkey='.$this->key.'&random='.$random.'&time='.$time;
$sig = hash("sha256", $sig);
$post_str = '{
"remark": "",
"sig": "'.$sig.'",
"text": "'.$templete.'",
"time": '.$time.',
"title": "'.$title.'",
"type": 1
}';
$url = 'https://yun.tim.qq.com/v5/tlssmssvr/add_template?sdkappid=1400082793&random='.$random;
$back_json = sms_post($url,$post_str,'POST');
$back_data = json_decode($back_json);
print_r($back_data);
}
//查询短信模板状态
public function search_templete_status(){
$random = rand(1000,9999);
$time = time();
$sig = 'appkey='.$this->key.'&random='.$random.'&time='.$time;
$sig = hash("sha256", $sig);
$post_str = '{
"sig": "'.$sig.'",
"time": '.$time.',
"tpl_page": {
"max": 10,
"offset": 0
}
}';
$url = 'https://yun.tim.qq.com/v5/tlssmssvr/get_template?sdkappid=1400082793&random='.$random;
$back_json = sms_post($url,$post_str,'POST');
$back_data = json_decode($back_json);
print_r($back_data);
}
//短信模板更新
public function update_templete($id,$title){
$contents = "Hi {1}, your guide on {2} is {3}, localmobile is {4}. He/she'll call you at the hotel, or leave a message tonight. You can find more info by inputting booking No. {5} at https://www.trippest.com/track-your-trip. Wish you a wonderful day with Trippest!";
$random = rand(1000,9999);
$time = time();
$sig = 'appkey='.$this->key.'&random='.$random.'&time='.$time;
$sig = hash("sha256", $sig);
$post_str = '{
"sig": "'.$sig.'",
"text": "'.$contents.'",
"time": '.$time.',
"title": "'.$title.'",
"tpl_id": '.$id.',
"type": 0
}';
$url = 'https://yun.tim.qq.com/v5/tlssmssvr/mod_template?sdkappid=1400082793&random='.$random;
$back_json = sms_post($url,$post_str,'POST');
$back_data = json_decode($back_json);
print_r($back_data);
}
//删除模板
public function delete_templete(){
$random = rand(1000,9999);
$time = time();
$sig = 'appkey='.$this->key.'&random='.$random.'&time='.$time;
$sig = hash("sha256", $sig);
$post_str = '{
"sig": "'.$sig.'",
"time": '.$time.',
"tpl_id": [
212919,
213082
]
}';
$url = 'https://yun.tim.qq.com/v5/tlssmssvr/del_template?sdkappid=1400082793&random='.$random;
$back_json = sms_post($url,$post_str,'POST');
$back_data = json_decode($back_json);
print_r($back_data);
}
//发送短信
public function send_message(){
//接收参数
//1-4为四个参数依次排序 字符格式不做限制
$one = $this->input->post('one');
$two = $this->input->post('two');
$three = $this->input->post('three');
$four = $this->input->post('four');
$five = $this->input->post('five');
//手机号 * 必填
$phone = $this->input->post('phone');
//区号 * 必填
$nation_code = $this->input->post('nation_code');
if(empty($phone) || empty($nation_code)){
header("HTTP/1.1 404 Not Found");
exit('{"status":"404","reason":"传参为空!"}');
}
//构造发送短信的报文
$random = rand(1000,9999);
$time = time();
$sig = 'appkey='.$this->key.'&random='.$random.'&time='.$time.'&mobile='.$phone;
$sig = hash("sha256", $sig);
$mysign = '[ChinaHighlights]';
if($nation_code == 86){
$mysign = '【桂林海纳国旅】';
}
$post_str = '{
"ext": "",
"extend": "",
"msg": "Hi '.$one.', your guide on '.$two.' is '.$three.', (local) mobile is '.$four.'. He/she\'ll call you at the hotel, or leave a message tonight. You can find more info by inputting booking No. '.$five.' at https://www.trippest.com/track-your-trip. Wish you a wonderful day with Trippest!",
"sig": "'.$sig.'",
"tel": {
"mobile": "'.$phone.'",
"nationcode": "'.$nation_code.'"
},
"time": '.$time.',
"type": 0
}';
$url = 'https://yun.tim.qq.com/v5/tlssmssvr/sendsms?sdkappid=1400082793&random='.$random;
$back_json = sms_post($url,$post_str,'POST');
$back_data = json_decode($back_json);
print_r($back_json);
}
}
?>

@ -0,0 +1,31 @@
<?php
//发送请求函数
function sms_post($url, $data = '', $method = 'GET') {
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
//curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
if ($method == 'POST' && !empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json;charset=UTF-8'));
}
curl_setopt($curl, CURLOPT_TIMEOUT, 45); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
$tmpInfo = curl_exec($curl); // 执行操作
$errno = curl_errno($curl);
if ($errno !== 0) {
return false;
echo $errno . curl_error($curl); //记录错误日志
}
curl_close($curl); //关闭CURL会话
return $tmpInfo; //返回数据
}
function hello(){
echo 'hello';
}

@ -0,0 +1,52 @@
<div style="width:90%;margin:30px auto;">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
<li role="presentation"><a href="#manager" aria-controls="manager" role="tab" data-toggle="tab">管理页面</a></li>
<li role="presentation"><a href="#sendsms" aria-controls="sendsms" role="tab" data-toggle="tab">发送短信页面</a></li>
</ul>
</div>
<div class="tab-content" style="padding:0 30px">
<div role="tabpanel" class="tab-pane active" id="home">
<div class="text-center">
<h1>短信发送中心</h1>
<p>版本1.0</p>
<p>可以正常添加模板,但是只有一个模板可以发送</p>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="manager">
<form action="http://www.mycht.cn/webht.php/apps/messagecenter/index/add_templete" method="post" name="add_template">
<p>模板示例Hi {1}, your guide on {2} is {3}, localmobile is {4}. He/she'll call you at the hotel, or leave a message tonight. You can find more info by inputting booking No. {5} at https://www.trippest.com/track-your-trip. Wish you a wonderful day with Trippest!</p>
<label for="addtemplate">输入模板:</label>
<textarea id="addtemplate" class="form-control" name="templete"></textarea>
<br>
<button type="submit" class="btn btn-default">添加模板</button>
</form>
</div>
<div role="tabpanel" class="tab-pane" id="sendsms">
<p>模板示例Hi {1}, your guide on {2} is {3}, localmobile is {4}. He/she'll call you at the hotel, or leave a message tonight. You can find more info by inputting booking No {5} at https://www.trippest.com/track-your-trip. Wish you a wonderful day with Trippest!</p>
<form action="http://www.mycht.cn/webht.php/apps/messagecenter/index/send_message" method="post" name="add_template">
<label for="addtemplate">输入信息:</label>
<br>
<label>区号:<input type="text" name="nation_code"></label>
<br>
<label>手机号:<input type="text" name="phone"></label>
<br>
<label>元素一:<input type="text" name="one"></label>
<br>
<label>元素二:<input type="text" name="two"></label>
<br>
<label>元素三:<input type="text" name="three"></label>
<br>
<label>元素四:<input type="text" name="four"></label>
<br>
<label>元素五:<input type="text" name="five"></label>
<br>
<button type="submit" class="btn btn-default">发送短信</button>
</form>
</div>
</div>
</div>

@ -0,0 +1,81 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Index extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('ordersfrom_model');
}
public function index(){
$data = array();
$data['startime'] = $this->input->get_post('startime');
$data['endtime'] = $this->input->get_post('endtime');
$data['webcode'] = $this->input->get_post('webcode');
$data['total_nums'] = 0;
if($data['startime'] && $data['endtime'] && $data['webcode']){
$all_orders = $this->ordersfrom_model->get_all_orders($data['startime'],$data['endtime'],$data['webcode']);
$data['total_nums'] = count($all_orders);
$data['orders'] = $this->group_order_arr($all_orders);
}else{
$data['orders'] = null;
}
$this->load->view('index',$data);
}
function group_order_arr($all_orders){
$data = array();
$num = 0;
foreach ($all_orders as $item){
preg_match('/(https|http):[\/]{2}[a-z]+[.]{1}[a-z\d\-]+[.a-z\d-\/.htm]*/',$item->COLI_OrderDetailText,$matches);
if(!empty($matches[0])){
if(isset($data[$matches[0]])){
$data[$matches[0]]['num'] +=1;
array_push($data[$matches[0]]['order'],$item->coli_id);
}else{
$data[$matches[0]] = array();
$data[$matches[0]]['num'] = 1;
$data[$matches[0]]['order'] = array();
array_push($data[$matches[0]]['order'],$item->coli_id);
}
}
}
return $this->array_sort($data,'num','desc');
}
function array_sort($arr,$keys,$type='asc'){
$keysvalue = $new_array = array();
foreach ($arr as $k=>$v){
$keysvalue[$k] = $v[$keys];
}
if($type == 'asc'){
asort($keysvalue);
}else{
arsort($keysvalue);
}
reset($keysvalue);
foreach ($keysvalue as $k=>$v){
$new_array[$k] = $arr[$k];
}
return $new_array;
}
public function count_ah_orders(){
$data = array();
$ah_product_obj = $this->ordersfrom_model->ah_productions();
foreach($ah_product_obj as $item){
$data[$item->cli_no] = array();
$orders_arr = $this->ordersfrom_model->get_orders($item->cli_no);
$data[$item->cli_no] = $orders_arr;
}
$mdata['orders'] = $data;
$this->load->view('ah_orders',$mdata);
}
}
?>

@ -0,0 +1,45 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class ordersfrom_model extends CI_Model {
function __construct(){
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
public function get_all_orders($fromtime,$totime,$website){
$sql = "select
COLI_OrderDetailText,coli_id
from
ConfirmLineInfo
where
COLI_WebCode = ?
and
COLI_ApplyDate > ?
and
COLI_ApplyDate < ?
and
DeleteFlag = 0
and
COLI_OrderDetailText like '%https:%'
";
$query = $this->HT->query($sql,array($website,$fromtime,$totime));
return $query->result();
}
public function ah_productions(){
$sql = "select cli_no from CustomerLineInfo WHERE CLI_DEI_SN = '28' AND DeleteFlag = '0'";
$query = $this->HT->query($sql);
return $query->result();
}
public function get_orders($productsn){
$sql = "select COLI_ID from ConfirmLineInfo where COLI_WebCode = 'AH' and DeleteFlag = 0 and COLI_OrderDetailText like '%{$productsn}%'";
$query = $this->HT->query($sql);
return $query->result();
}
}

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>订单来源页面搜索</title>
<link href="/css/webht/bootstrap.min.css" rel="stylesheet">
<link href="/css/nav/nav.css?v=20150723" rel="stylesheet">
<link href="/css/webht/jquery-ui-1.10.0.custom.css" rel="stylesheet">
<script src="/min?f=/js/jquery.min.js,/js/bootstrap.min.js,/js/navigation.js,/js/jquery.form.min.js"></script>
<script src="/js/jquery-ui.min.js?v=1"></script>
<!--[if lt IE 9]>
<script src="/js/respond.min.js" type="text/javascript"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverses" style="margin-bottom:0;border-bottom:1px solid #ddd;">
<div class="container-fluid search_container nopadding">
<div class="navbar-header" style="float:none;">
<a class="navbar-brand text-muted" style="padding-top: 7px;padding-left: 30px;" href="<?php echo site_url('index/index'); ?>">
<img width="150" style="height:40px;" src="/css/nav/img/6000.png">
</a>
</div>
</div>
</nav>
<h1 class="text-center">AH订单统计(按线路代号)</h1>
<table class="table table-bordered">
<tr>
<th>线路代号</th>
<th>订单数量</th>
<th>具体订单号</th>
</tr>
<?php
$table_body = '';
//print_r($orders);
foreach ($orders as $key=>$items){
$table_body .= '<tr>';
$table_body .= '<td>'.$key.'</td>';
$table_body .= '<td>'.count($items).'</td>';
$table_body .= '<td class="order_detail">';
$orders_num = 0;
foreach ($items as $value){
$orders_num++;
if($orders_num == count($items)){
$table_body .= $value->COLI_ID;
}else{
$table_body .= $value->COLI_ID.'、';
}
}
$table_body .= '</td>';
$table_body .= '</tr>';
}
echo $table_body;
?>
</table>
</body>
</html>

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>订单来源页面搜索</title>
<link href="/css/webht/bootstrap.min.css" rel="stylesheet">
<link href="/css/nav/nav.css?v=20150723" rel="stylesheet">
<link href="/css/webht/jquery-ui-1.10.0.custom.css" rel="stylesheet">
<script src="/min?f=/js/jquery.min.js,/js/bootstrap.min.js,/js/navigation.js,/js/jquery.form.min.js"></script>
<script src="/js/jquery-ui.min.js?v=1"></script>
<!--[if lt IE 9]>
<script src="/js/respond.min.js" type="text/javascript"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverses" style="margin-bottom:0;border-bottom:1px solid #ddd;">
<div class="container-fluid search_container nopadding">
<div class="navbar-header" style="float:none;">
<a class="navbar-brand text-muted" style="padding-top: 7px;padding-left: 30px;" href="<?php echo site_url('index/index'); ?>">
<img width="150" style="height:40px;" src="/css/nav/img/6000.png">
</a>
</div>
</div>
</nav>
<div class="container">
<h1 class="text-center">订单来源页面查询</h1>
<div class="content" style="margin-top:20px;">
<form method="post" class="form-inline" action="http://www.mycht.cn/webht.php/apps/ordersfrom/index/">
<div class="col-sm-8">
<div class="form-group">
<label for="startime">开始时间</label>
<input id="startime" name="startime" class="form-control" type="text" value="<?php echo empty($startime) ? '' :$startime;?>" autocomplete="off"/>
</div>
</div>
<div class="col-sm-8">
<div class="form-group">
<label for="endtime">结束时间</label>
<input id="endtime" name="endtime" class="form-control" type="text" value="<?php echo empty($endtime) ? '' :$endtime;?>" autocomplete="off"/>
</div>
</div>
<div class="col-sm-8">
<div class="form-group">
<label for="webcode">站点选择</label>
<select class="form-control" name="webcode" id="webcode">
<option value="gm">GM</option>
<option value="cht">CH</option>
<option value="ah">AH</option>
<option value="CT">CT</option>
<option value="YZ">YZ</option>
<option value="SHT">SHT</option>
<option value="GL">GL</option>
<option value="MBJ">MBJ</option>
<option value="TBT">TBT</option>
</select>
</div>
<button id="ordersfrom" type="submit" class="btn btn-default">查询</button>
</div>
</form>
</div>
</div>
<?php if(!empty($orders)){?>
<div class="orderscontent">
<div>
<h3 class="text-center">统计分组结果</h3>
<p class="text-center">总订单数:<?php echo $total_nums;?></p>
</div>
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th>订单来源</th>
<th>订单数量</th>
<th>具体订单号</th>
</tr>
<?php
$table_body = '';
foreach ($orders as $key=>$items){
$table_body .= '<tr>';
$table_body .= '<td>'.$key.'</td>';
$table_body .= '<td>'.$items['num'].'</td>';
$table_body .= '<td class="order_detail">';
$orders_num = 0;
foreach ($items['order'] as $value){
$orders_num++;
if($orders_num == count($items['order'])){
$table_body .= $value;
}else{
$table_body .= $value.'、';
}
}
$table_body .= '</td>';
$table_body .= '</tr>';
}
echo $table_body;
?>
</table>
</div>
</div>
<?php }?>
<script>
$(function(){
$('#startime,#endtime').datepicker({
dateFormat: "yy-mm-dd",
changeMonth: true,
changeYear: true
});
//获取站点
var sitecode = "<?php echo $webcode;?>";
if(sitecode != ''){
$('#webcode option[value='+sitecode+']').attr("selected","selected");
}
});
</script>
</html>
Loading…
Cancel
Save