diff --git a/application/config/config.php b/application/config/config.php
index 978011b8..054fed73 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -368,7 +368,7 @@ $config['site'] = array(
'vc' => array('site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'http://www.voyageschine.com', 'site_image_url' => 'http://images.voyageschine.com', 'site_authors' => array('JE', 'kq', 'lya', 'lyz', 'zyh'), 'site_user' => ',ycc,lmr, zyh,JE,htc,kq,lya,bhn,Tony,zyh,B,J,lyz,LYY,'),
'jp' => array('site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'http://www.arachina.com', 'site_image_url' => 'http://images.arachina.com', 'site_authors' => array('hql', 'LLM', 'SHX', 'lmr', 'zyh', 'zb'), 'site_user' => ',ycc,lmr, zyh,hql,LLM,SHX,htc,zpl,Tony,zyh,J,B,zb,LYY,'),
'vac' => array('site_code' => 'vac', 'site_id' => 95, 'site_lgc' => '6', 'site_url' => 'http://www.viaje-a-china.com', 'site_image_url' => 'http://imagenes.viaje-a-china.com', 'site_authors' => array('I', 'cyt', 'lmr', 'zyh', 'LLM'), 'site_user' => ',ycc,lmr, zyh,I,cyt,htc,bhn,Tony,zyh,B,J,LLM,LYY,'),
- 'it' => array('site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'http://www.viaggio-in-cina.it', 'site_image_url' => 'http://images.viaggio-in-cina.it', 'site_authors' => array('LZY', 'ZQQ', 'lmr', 'zyh'), 'site_user' => ',ycc,lmr, zyh,LZY,htc,ZQQ,Tony,zyh,B,J,LYY,'),
+ 'it' => array('site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'https://www.viaggio-in-cina.it', 'site_image_url' => 'http://images.viaggio-in-cina.it', 'site_authors' => array('LZY', 'ZQQ', 'lmr', 'zyh'), 'site_user' => ',ycc,lmr, zyh,LZY,htc,ZQQ,Tony,zyh,B,J,LYY,'),
'ru' => array('site_code' => 'ru', 'site_id' => 102, 'site_lgc' => '7', 'site_url' => 'http://www.chinahighlights.ru', 'site_image_url' => 'http://images.chinahighlights.ru', 'site_authors' => array('xjj', 'zyy'), 'site_user' => ',ycc,lmr, zyh,xjj,htc,DX,zyy,bhn,Tony,zyh,B,J,LYY,'),
'wt' => array('site_code' => 'wt', 'site_id' => 172, 'site_lgc' => '2', 'site_url' => 'http://www.iiiyooo.com', 'site_image_url' => '', 'site_authors' => array('ylh', 'lfj', 'wx', 'lzh', 'shw', 'lx'), 'site_user' => ',ycc,lmr, zyh,ylh,lfj,wx,lzh,shw,lx,bhn,B,J,'),
'tbt' => array('site_code' => 'tbt', 'site_id' => 169, 'site_lgc' => '1', 'site_url' => 'http://www.tibettravel.info', 'site_image_url' => '/images', 'site_authors' => array('wj', 'sfx'), 'site_user' => ',ycc,wj,bhn,wx,lzh,lfj,hwt,thf,sfx,J,ZP,'),
diff --git a/application/controllers/author.php b/application/controllers/author.php
index 47c567ad..c19d27db 100644
--- a/application/controllers/author.php
+++ b/application/controllers/author.php
@@ -20,17 +20,19 @@ class Author extends CI_Controller {
$this->load->model('Infoauthors_model');
$this->load->model('InfoSMS_model');
}
- public function index($loadexcel='notexcel',$page=1){
+
+ public function index($loadexcel = 'notexcel', $page = 1) {
$this->load->library('accesscheck');
$this->accesscheck->check_access();
//获取任务状态
- $request_form='get';
- if($loadexcel=='loadexcel')$request_form='post';
- $t_status=$this->input->$request_form('taskstatus');
- if($t_status=="-")$t_status=false;
+ $request_form = 'get';
+ if ($loadexcel == 'loadexcel')
+ $request_form = 'post';
+ $t_status = $this->input->$request_form('taskstatus');
+ if ($t_status == "-")
+ $t_status = false;
//根据任务状态加载视图模板
- switch (trim($t_status))
- {
+ switch (trim($t_status)) {
case 'edit':
$this->in_edit_tasks($loadexcel);
break;
@@ -39,7 +41,7 @@ class Author extends CI_Controller {
break;
case 'reviewed':
$this->in_reviewed_tasks($loadexcel);
- break;
+ break;
case 'complete':
$this->in_complete_tasks($loadexcel);
break;
@@ -49,14 +51,14 @@ class Author extends CI_Controller {
default:
//获取作者列表
$data['author_list'] = $this->Infoauthors_model->active_list();
- $task_list = $this->_get_tasks_list(false,$loadexcel,$page,site_url("author/index/$loadexcel"));
+ $task_list = $this->_get_tasks_list(false, $loadexcel, $page, site_url("author/index/$loadexcel"));
$data['task_list'] = $task_list['task_list'];
//导出数据到excel表格
- if ($loadexcel=='loadexcel') {
+ if ($loadexcel == 'loadexcel') {
$this->load_to_excel($data['task_list']);
return;
}
- $data['page']=$task_list['page'];
+ $data['page'] = $task_list['page'];
$data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'all_tasks'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view("bootstrap/author/index");
@@ -65,15 +67,15 @@ class Author extends CI_Controller {
}
//进行中任务列表
- public function in_edit_tasks($loadexcel='notexcel',$page=false) {
- $task_list = $this->_get_tasks_list('edit',$loadexcel,$page,site_url("author/in_edit_tasks/$loadexcel"));
+ public function in_edit_tasks($loadexcel = 'notexcel', $page = false) {
+ $task_list = $this->_get_tasks_list('edit', $loadexcel, $page, site_url("author/in_edit_tasks/$loadexcel"));
$data['task_list'] = $task_list['task_list'];
//导出数据到excel表格
- if ($loadexcel=='loadexcel') {
+ if ($loadexcel == 'loadexcel') {
$this->load_to_excel($data['task_list']);
return;
}
- $data['page']=$task_list['page'];
+ $data['page'] = $task_list['page'];
$data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_edit'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/author/welcome');
@@ -81,15 +83,15 @@ class Author extends CI_Controller {
}
//待审核任务列表
- public function in_review_tasks($loadexcel='notexcel',$page=false) {
- $task_list = $this->_get_tasks_list('review',$loadexcel,$page,site_url("author/index/$loadexcel"));
+ public function in_review_tasks($loadexcel = 'notexcel', $page = false) {
+ $task_list = $this->_get_tasks_list('review', $loadexcel, $page, site_url("author/index/$loadexcel"));
$data['task_list'] = $task_list['task_list'];
//导出数据到excel表格
- if ($loadexcel=='loadexcel') {
+ if ($loadexcel == 'loadexcel') {
$this->load_to_excel($data['task_list']);
return;
}
- $data['page']=$task_list['page'];
+ $data['page'] = $task_list['page'];
$data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_review'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/author/welcome');
@@ -97,9 +99,9 @@ class Author extends CI_Controller {
}
//待结算任务列表
- public function in_reviewed_tasks($loadexcel='notexcel',$page=false) {
+ public function in_reviewed_tasks($loadexcel = 'notexcel', $page = false) {
//获取任务列表
- $task_list = $this->_get_tasks_list('reviewed',$loadexcel,$page,site_url("author/index/$loadexcel"));
+ $task_list = $this->_get_tasks_list('reviewed', $loadexcel, $page, site_url("author/index/$loadexcel"));
$data['task_list'] = $task_list['task_list'];
//获取作者列表
$data['author_list'] = $this->Infoauthors_model->active_list();
@@ -107,18 +109,18 @@ class Author extends CI_Controller {
$task->last_version = $this->Infotaskarticles_model->version_last($task->t_id);
}
//导出数据到excel表格
- if ($loadexcel=='loadexcel') {
+ if ($loadexcel == 'loadexcel') {
$this->load_to_excel($data['task_list']);
return;
}
//获取最活跃作者
- $active_author=array();
- $data['isset_active_author']=$this->Infotasks_model->is_active_author();
- if (!empty($data['task_list']) && $data['isset_active_author']!=1) {
- $active_author=$this->Infotasks_model->get_author_count();
+ $active_author = array();
+ $data['isset_active_author'] = $this->Infotasks_model->is_active_author();
+ if (!empty($data['task_list']) && $data['isset_active_author'] != 1) {
+ $active_author = $this->Infotasks_model->get_author_count();
}
- $data['page']=$task_list['page'];
- $data['active_author']=$active_author;
+ $data['page'] = $task_list['page'];
+ $data['active_author'] = $active_author;
$data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_reviewed'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/author/task_list_reviewed');
@@ -126,16 +128,16 @@ class Author extends CI_Controller {
}
//待审核投稿
- public function in_wait_tasks($loadexcel='notexcel',$page=false) {
+ public function in_wait_tasks($loadexcel = 'notexcel', $page = false) {
$admin_info = $this->session->userdata('session_admin');
- $task_list = $this->_get_tasks_list('wait',$loadexcel,$page,site_url("author/index/$loadexcel"));
+ $task_list = $this->_get_tasks_list('wait', $loadexcel, $page, site_url("author/index/$loadexcel"));
$data['task_list'] = $task_list['task_list'];
//导出数据到excel表格
- if ($loadexcel=='loadexcel') {
+ if ($loadexcel == 'loadexcel') {
$this->load_to_excel($data['task_list']);
return;
}
- $data['page']=$task_list['page'];
+ $data['page'] = $task_list['page'];
$data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_wait'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/author/welcome');
@@ -143,20 +145,20 @@ class Author extends CI_Controller {
}
//已完成任务列表
- public function in_complete_tasks($loadexcel='notexcel',$page=1) {
+ public function in_complete_tasks($loadexcel = 'notexcel', $page = 1) {
$data['author_list'] = $this->Infoauthors_model->active_list();
- $task_list = $this->_get_tasks_list('complete',$loadexcel,$page,site_url("author/in_complete_tasks/$loadexcel"));
+ $task_list = $this->_get_tasks_list('complete', $loadexcel, $page, site_url("author/in_complete_tasks/$loadexcel"));
$data['task_list'] = $task_list['task_list'];
foreach ($data['task_list'] as $t) {
$t->last_version = $this->Infotaskarticles_model->version_last($t->t_id);
}
//导出数据到excel表格
- if ($loadexcel=='loadexcel') {
+ if ($loadexcel == 'loadexcel') {
$this->load_to_excel($data['task_list']);
return;
}
- $data['page']=$task_list['page'];
- $data['site_config']=$this->config->item('site');
+ $data['page'] = $task_list['page'];
+ $data['site_config'] = $this->config->item('site');
$data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_complete'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/author/task_list_complete');
@@ -164,42 +166,50 @@ class Author extends CI_Controller {
}
//查询任务列表
- public function _get_tasks_list($t_status=false,$loadexcel=false,$page=false,$pageurl=false){
+ public function _get_tasks_list($t_status = false, $loadexcel = false, $page = false, $pageurl = false) {
//异步获取任务列表时数据提交方式为get,导出数据时则为post
- $request_form='get';
- if($loadexcel=='loadexcel')$request_form='post';
+ $request_form = 'get';
+ if ($loadexcel == 'loadexcel')
+ $request_form = 'post';
//任务过滤参数初始化
- $t_a_id=$t_td_type=$start_date=$tasktitle=false;
- $end_date=date('Y-m-d');
- if($this->input->$request_form('author') && $this->input->$request_form('author')!=0) $t_a_id=$this->input->$request_form('author');
- if($this->input->$request_form('tasktype') && $this->input->$request_form('tasktype')!='-') $t_td_type=$this->input->$request_form('tasktype');
- if($this->input->$request_form('startdate') && $this->input->$request_form('startdate')!='') $start_date=$this->input->$request_form('startdate');
- if($this->input->$request_form('enddate') && $this->input->$request_form('enddate')!='') $end_date=$this->input->$request_form('enddate');
- if($this->input->$request_form('tasktitle') && $this->input->$request_form('tasktitle')!='') $tasktitle=$this->input->$request_form('tasktitle');
+ $t_a_id = $t_td_type = $start_date = $tasktitle = false;
+ $end_date = date('Y-m-d');
+ if ($this->input->$request_form('author') && $this->input->$request_form('author') != 0)
+ $t_a_id = $this->input->$request_form('author');
+ if ($this->input->$request_form('tasktype') && $this->input->$request_form('tasktype') != '-')
+ $t_td_type = $this->input->$request_form('tasktype');
+ if ($this->input->$request_form('startdate') && $this->input->$request_form('startdate') != '')
+ $start_date = $this->input->$request_form('startdate');
+ if ($this->input->$request_form('enddate') && $this->input->$request_form('enddate') != '')
+ $end_date = $this->input->$request_form('enddate');
+ if ($this->input->$request_form('tasktitle') && $this->input->$request_form('tasktitle') != '')
+ $tasktitle = $this->input->$request_form('tasktitle');
$admin_info = $this->session->userdata('session_admin');
//获取任务列表
- if ($loadexcel=='loadexcel') {
- $task_list['task_list'] = $this->Infotasks_model->get_tasks_list($t_status,$admin_info['OPI_Code'],$t_a_id,$t_td_type,$start_date,$end_date,$tasktitle);
+ if ($loadexcel == 'loadexcel') {
+ $task_list['task_list'] = $this->Infotasks_model->get_tasks_list($t_status, $admin_info['OPI_Code'], $t_a_id, $t_td_type, $start_date, $end_date, $tasktitle);
return $task_list;
}
//分页
- $page_task=$this->Infotasks_model->get_tasks_list($t_status,$admin_info['OPI_Code'],$t_a_id,$t_td_type,$start_date,$end_date,$tasktitle,$page);
- $pages['total']=count($page_task);//数据总条数
- $pages['pageSize']= 50;//每页展示数量
- $pages['url'] = $pageurl;//页码链接
- $pages['current']=$page;//当前页码
- $task_list['page']=show_page($pages);
+ $page_task = $this->Infotasks_model->get_tasks_list($t_status, $admin_info['OPI_Code'], $t_a_id, $t_td_type, $start_date, $end_date, $tasktitle, $page);
+ $pages['total'] = count($page_task); //数据总条数
+ $pages['pageSize'] = 50; //每页展示数量
+ $pages['url'] = $pageurl; //页码链接
+ $pages['current'] = $page; //当前页码
+ $task_list['page'] = show_page($pages);
//获取任务列表
- $task_id_str=0;
- if($page) $page_task=array_slice($page_task,$pages['pageSize']*($page-1),$pages['pageSize']);
+ $task_id_str = 0;
+ if ($page)
+ $page_task = array_slice($page_task, $pages['pageSize'] * ($page - 1), $pages['pageSize']);
foreach ($page_task as $v) {
- $task_id_str.=','.$v->t_id;
+ $task_id_str.=',' . $v->t_id;
}
- $flag=false;
- if($t_status=='reviewed') $flag=TRUE;
- $task_list['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str,$flag);
+ $flag = false;
+ if ($t_status == 'reviewed')
+ $flag = TRUE;
+ $task_list['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str, $flag);
return $task_list;
}
@@ -246,7 +256,7 @@ class Author extends CI_Controller {
$t_id = $this->input->post('t_id');
$t_rating = $this->input->post('t_rating');
$t_rating_total = $this->input->post('t_rating_total');
-
+
$task = $this->Infotasks_model->detail($t_id);
if (empty($task)) {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound'));
@@ -271,44 +281,40 @@ class Author extends CI_Controller {
echo json_encode($data);
return false;
} else {
- $flag=false;
- if ($this->input->post('ispublish')==1)
- {
- $ispublished=$this->publish_task($task);
- $flag=$ispublished;
+ $flag = false;
+ if ($this->input->post('ispublish') == 1) {
+ $ispublished = $this->publish_task($task);
+ $flag = $ispublished;
//发布失败
- if(!$ispublished){
+ if (!$ispublished) {
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('publish_task_failed'));
echo json_encode($data);
return false;
}
}
- $this->Infotasks_model->reviwed($t_id, $reviewed, $t_rating,$t_rating_total);
+ $this->Infotasks_model->reviwed($t_id, $reviewed, $t_rating, $t_rating_total);
//保存审核字数和金额
- if($reviewed=='reviewed')
- {
+ if ($reviewed == 'reviewed') {
$this->Infotaskarticles_model->update_review($t_id, $this->input->post('ta_count'), $this->input->post('ta_charge'));
}
- $msg='';
- if($flag!=false) $msg = ' 跳转到信息平台发布页';
- $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_review_submit').$msg);
+ $msg = '';
+ if ($flag != false)
+ $msg = ' 跳转到信息平台发布页';
+ $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_review_submit') . $msg);
$data[] = array('name' => 'ok_go', 'value' => site_url('author/in_review_tasks'));
echo json_encode($data);
-
- //发送邮件通知给作者
- $admin_info = $this->session->userdata('session_admin');
- $author=$this->Infoauthors_model->detail_by_id($task->t_a_id);
- //通过审核
- if($reviewed=='reviewed')
- {
- $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_success_subject'),$task->t_title), $this->lang->line('author_email_review_task_success_body'));
- }
- else
- {
- $this->Infotasks_model->reviwed($t_id, 'unreviewed',$t_rating,$t_rating_total);
- $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_failed_subject'),$task->t_title), $this->lang->line('author_email_review_task_failed_body'));
- }
+
+ //发送邮件通知给作者
+ $admin_info = $this->session->userdata('session_admin');
+ $author = $this->Infoauthors_model->detail_by_id($task->t_a_id);
+ //通过审核
+ if ($reviewed == 'reviewed') {
+ $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_success_subject'), $task->t_title), $this->lang->line('author_email_review_task_success_body'));
+ } else {
+ $this->Infotasks_model->reviwed($t_id, 'unreviewed', $t_rating, $t_rating_total);
+ $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_failed_subject'), $task->t_title), $this->lang->line('author_email_review_task_failed_body'));
+ }
}
$this->InfoSMS_model->add('task', $t_id, $task->t_a_id, $task->t_ht_op_code, $this->input->post('review_m_content'));
}
@@ -316,7 +322,7 @@ class Author extends CI_Controller {
public function publish_task($task) {
$this->load->model('Logs_model');
$t_id = $this->input->post('t_id');
- $ic_is_id=$this->input->post('choose_ic_is_id');
+ $ic_is_id = $this->input->post('choose_ic_is_id');
$task_last_version = $this->Infotaskarticles_model->version_last($task->t_id);
if (empty($task_last_version->ta_ic_id)) {
@@ -332,7 +338,7 @@ class Author extends CI_Controller {
, $task_last_version->ta_summary, $task_last_version->ta_seo_title, $task_last_version->ta_seo_description, $task_last_version->ta_seo_keywords
, 0, 0, '', $task_last_version->ta_photo, 0, 0, '', '', $information->ic_ht_area_id, $information->ic_ht_area_type, 0, '', $task->t_a_id);
if ($this->InfoStructures_model->Add($information->is_id, $this->InfoContents_model->insert_id)) {
- $result =site_url('information/edit/' . $this->InfoStructures_model->insert_id);
+ $result = site_url('information/edit/' . $this->InfoStructures_model->insert_id);
} else {
$result = false;
}
@@ -361,24 +367,25 @@ class Author extends CI_Controller {
public function publish_task_submit() {
$this->load->model('Logs_model');
$t_id = $this->input->post('t_id');
- $ic_is_id=$this->input->post('ic_is_id');
+ $ic_is_id = $this->input->post('ic_is_id');
$task = $this->Infotasks_model->detail($t_id);
if ($task === false) {
show_404();
return false;
}
- $action_result=true;
+ $action_result = true;
$task_last_version = $this->Infotaskarticles_model->version_last($task->t_id);
$information = false;
- if (!empty($task_last_version->ta_ic_id)) $information = $this->Information_model->detail_by_ic_id($task_last_version->ta_ic_id);
- if (empty($task_last_version->ta_ic_id) or !$information) {
+ if (!empty($task_last_version->ta_ic_id))
+ $information = $this->Information_model->detail_by_ic_id($task_last_version->ta_ic_id);
+ if (empty($task_last_version->ta_ic_id) or ! $information) {
$selected_name = $this->input->post('selected_is_ic_name');
$is_id = mb_substr($selected_name, strpos($selected_name, '{') + 1, -1);
$information = $this->Information_model->Detail($is_id);
if (empty($information)) {
- $action_result=false;
+ $action_result = false;
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('structures_error_notfound'));
echo json_encode($data);
return false;
@@ -389,18 +396,18 @@ class Author extends CI_Controller {
, $task_last_version->ta_summary, $task_last_version->ta_seo_title, $task_last_version->ta_seo_description, $task_last_version->ta_seo_keywords
, 0, 0, '', $task_last_version->ta_photo, 0, 0, '', '', $information->ic_ht_area_id, $information->ic_ht_area_type, 0, '', $task->t_a_id);
if ($this->InfoStructures_model->Add($information->is_id, $this->InfoContents_model->insert_id)) {
- $im_ic_id=$this->InfoContents_model->insert_id;
+ $im_ic_id = $this->InfoContents_model->insert_id;
$data[] = array('name' => 'ok_modal', 'value' => sprintf($this->lang->line('publish_task_success'), site_url('information/edit/' . $this->InfoStructures_model->insert_id)));
//$this->Infotasks_model->reviwed($t_id,'published');//标识已经发布
} else {
- $action_result=false;
+ $action_result = false;
$data[] = array('name' => 'no_modal', 'value' => $this->lang->line('publish_task_failed'));
}
//把任务和信息做关联
$this->Infotaskarticles_model->link($task_last_version->ta_id, $this->InfoContents_model->insert_id);
} else {
//已经有信息关联,只需要更新对应的字段
- $im_ic_id=$information->ic_id;
+ $im_ic_id = $information->ic_id;
$this->InfoContents_model->Update($information->ic_id, $information->ic_url, $information->ic_url_title, $information->ic_type, $task_last_version->ta_title, $task_last_version->ta_content
, $task_last_version->ta_summary, $task_last_version->ta_seo_title, $task_last_version->ta_seo_description, $task_last_version->ta_seo_keywords
, $information->ic_show_bread_crumbs, $information->ic_status, $information->ic_template, $task_last_version->ta_photo, $information->ic_photo_width
@@ -414,8 +421,8 @@ class Author extends CI_Controller {
}
if ($action_result) {
//若作者平台的作者推荐了相关推荐信息,则先删除旧的推荐信息再添加新的推荐信息
- $author_recommend_info=get_meta($t_id, 'meta_author_recommend_info');
- $author_related_info=get_meta($t_id, 'meta_author_related_info');
+ $author_recommend_info = get_meta($t_id, 'meta_author_recommend_info');
+ $author_related_info = get_meta($t_id, 'meta_author_related_info');
if (!empty($author_recommend_info)) {
delete_meta($im_ic_id, 'meta_recommend_info');
add_meta($im_ic_id, 'meta_recommend_info', $author_recommend_info);
@@ -439,14 +446,12 @@ class Author extends CI_Controller {
return false;
}
foreach ($t_ids as $t_id) {
- $this->Infotasks_model->reviwed($t_id,'complete');
+ $this->Infotasks_model->reviwed($t_id, 'complete');
}
//设置月度活跃作者
- if ($this->input->post('isset_active_author')==0) {
+ if ($this->input->post('isset_active_author') == 0) {
$this->Infotasks_model->set_active_author(
- $this->input->post('active_t_id'),
- date('Y-m-d H:i:s'),
- $this->input->post('active_ta_id')
+ $this->input->post('active_t_id'), date('Y-m-d H:i:s'), $this->input->post('active_ta_id')
);
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('task_complete_success'));
@@ -467,7 +472,7 @@ class Author extends CI_Controller {
if ($task_detail) {
$data['information'] = $this->Information_model->detail_by_ic_id($task_detail->ta_ic_id);
//判断任务是否已上线
- $data['task_status']=$this->Infotasks_model->is_in_used($task_detail->ta_id);
+ $data['task_status'] = $this->Infotasks_model->is_in_used($task_detail->ta_id);
}
$data['task_detail_list'] = $this->Infotaskarticles_model->version_list($data['task']->t_id);
$data['task_last_version'] = $this->Infotaskarticles_model->version_last($data['task']->t_id);
@@ -510,45 +515,37 @@ class Author extends CI_Controller {
//获取该任务审核次数并计算奖励的百分比
$review_count = $this->Infotaskarticles_model->get_review_count($t_id);
- switch ($review_count)
- {
- case 1:
- $data['discount'] = array('1.1','110%');
- break;
- case 2:
- $data['discount'] = array('1.05','105%');
- break;
- case 0:
- case 3:
- $data['discount'] = array('1','100%');
- break;
- default:
- $data['discount'] = array('0.9','90%');
+ switch ($review_count) {
+ case 1:
+ $data['discount'] = array('1.1', '110%');
+ break;
+ case 2:
+ $data['discount'] = array('1.05', '105%');
+ break;
+ case 0:
+ case 3:
+ $data['discount'] = array('1', '100%');
+ break;
+ default:
+ $data['discount'] = array('0.9', '90%');
}
-
+
$this->load->view('bootstrap/header', $data);
- if ($data['task']->t_status=='wait') {
+ if ($data['task']->t_status == 'wait') {
$this->load->view('bootstrap/author/task_contribute');
- }else{
+ } else {
$this->load->view('bootstrap/author/task_create');
}
$this->load->view('bootstrap/footer');
}
//修改任务详细信息
- public function save_task_datailinfo(){
- $result=$this->Infotaskarticles_model->update(
- $this->input->post('ta_id'),
- $this->input->post('ta_title'),
- $this->input->post('ta_content'),
- $this->input->post('ta_summary'),
- $this->input->post('ta_seo_title'),
- $this->input->post('ta_seo_description'),
- $this->input->post('ta_seo_keywords'),
- $this->input->post('ta_photo'));
+ public function save_task_datailinfo() {
+ $result = $this->Infotaskarticles_model->update(
+ $this->input->post('ta_id'), $this->input->post('ta_title'), $this->input->post('ta_content'), $this->input->post('ta_summary'), $this->input->post('ta_seo_title'), $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords'), $this->input->post('ta_photo'));
if ($result) {
$data[] = array('name' => 'ok', 'value' => 'success!');
- }else{
+ } else {
$data[] = array('name' => 'no', 'value' => 'error!');
}
echo json_encode($data);
@@ -556,26 +553,24 @@ class Author extends CI_Controller {
}
//审核投稿申请
- public function change_wait_tast_status($t_status='edit'){
- $t_id=$this->input->post('t_id');
- $t_a_id=$this->input->post('t_a_id');
- $refuse_msg=$this->input->post('refuse_msg');
-
+ public function change_wait_tast_status($t_status = 'edit') {
+ $t_id = $this->input->post('t_id');
+ $t_a_id = $this->input->post('t_a_id');
+ $refuse_msg = $this->input->post('refuse_msg');
+
$admin_info = $this->session->userdata('session_admin');
- $author=$this->Infoauthors_model->detail_by_id($t_a_id);
- if ($t_status=='edit' && $this->Infotasks_model->reviwed($t_id,$t_status)) {
- if(!empty($author))
- {
+ $author = $this->Infoauthors_model->detail_by_id($t_a_id);
+ if ($t_status == 'edit' && $this->Infotasks_model->reviwed($t_id, $t_status)) {
+ if (!empty($author)) {
$this->InfoSMS_model->add('task', $t_id, $t_a_id, $admin_info['OPI_Code'], 'Your proposal has been approved!');
- $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, 'Your proposal has been approved.', 'Your proposal has been approved!Please log in at http://a.cdnch.com/author.php');
+ $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, 'Your proposal has been approved.', 'Your proposal has been approved!Please log in at http://author.mycht.cn');
}
$data[] = array('name' => 'ok', 'value' => 'success');
- }elseif ($t_status=='refuse' && $this->Infotasks_model->reviwed($t_id,$t_status)) {
+ } elseif ($t_status == 'refuse' && $this->Infotasks_model->reviwed($t_id, $t_status)) {
//如果指定用户则发送邮件通知
- if(!empty($author))
- {
+ if (!empty($author)) {
$this->InfoSMS_model->add('task', $t_id, $t_a_id, $admin_info['OPI_Code'], $refuse_msg);
- $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, 'Your proposal has been rejected.', 'Your proposal has been rejected: '.$refuse_msg.' Please log in at http://a.cdnch.com/author.php');
+ $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, 'Your proposal has been rejected.', 'Your proposal has been rejected: ' . $refuse_msg . ' Please log in at http://author.mycht.cn');
}
$data[] = array('name' => 'no', 'value' => 'success');
}
@@ -601,25 +596,14 @@ class Author extends CI_Controller {
//$t_id 查找一次任务详细,用来判断当前用户是否有权限修改,暂时省略
$this->Infotasks_model->update(
- $t_id,
- $this->input->post('t_title'),
- $this->input->post('t_content'),
- $this->input->post('t_a_id'),
- $this->input->post('t_td_type'),
- $this->input->post('t_expires')
+ $t_id, $this->input->post('t_title'), $this->input->post('t_content'), $this->input->post('t_a_id'), $this->input->post('t_td_type'), $this->input->post('t_expires')
);
$data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit'));
echo json_encode($data);
} else {
$admin_info = $this->session->userdata('session_admin');
$this->Infotasks_model->add(
- $this->input->post('t_title'),
- $this->input->post('t_content'),
- $this->input->post('t_a_id'),
- $admin_info['OPI_Code'],
- $this->input->post('t_td_type'),
- $this->input->post('t_expires'),
- $this->config->item('site_code')
+ $this->input->post('t_title'), $this->input->post('t_content'), $this->input->post('t_a_id'), $admin_info['OPI_Code'], $this->input->post('t_td_type'), $this->input->post('t_expires'), $this->config->item('site_code')
);
//新建
$is_id = $this->input->post('is_id');
@@ -632,8 +616,8 @@ class Author extends CI_Controller {
}
//添加推荐文章信息
- $meta_recommend_info=get_meta($information->ic_id, 'meta_recommend_info');
- $meta_related_info=get_meta($information->ic_id, 'meta_related_info');
+ $meta_recommend_info = get_meta($information->ic_id, 'meta_recommend_info');
+ $meta_related_info = get_meta($information->ic_id, 'meta_related_info');
if (!empty($meta_recommend_info)) {
add_meta($this->Infotasks_model->insert_id, 'meta_author_recommend_info', $meta_recommend_info);
}
@@ -641,7 +625,8 @@ class Author extends CI_Controller {
add_meta($this->Infotasks_model->insert_id, 'meta_author_related_info', $meta_related_info);
}
- if(empty($information->ic_summary))$information->ic_summary='';
+ if (empty($information->ic_summary))
+ $information->ic_summary = '';
$this->Infotaskarticles_model->add($this->Infotasks_model->insert_id, $information->ic_id, $information->ic_title
, $information->ic_content, $information->ic_summary, $information->ic_seo_title, $information->ic_seo_description
, $information->ic_seo_keywords, $information->ic_photo);
@@ -649,26 +634,38 @@ class Author extends CI_Controller {
$this->Infotaskarticles_model->add($this->Infotasks_model->insert_id, 0, '', '', '', '', '', '', '');
}
- $add_articles_res=$this->Infotaskarticles_model->detail($this->Infotasks_model->insert_id);
+ $add_articles_res = $this->Infotaskarticles_model->detail($this->Infotasks_model->insert_id);
if (!$add_articles_res) {
$this->Infotasks_model->delete($this->Infotasks_model->insert_id);
- $data[] = array('name' => 'no', 'value' => "创建任务失败".$this->Infotaskarticles_model->insert_id);
+ $data[] = array('name' => 'no', 'value' => "创建任务失败" . $this->Infotaskarticles_model->insert_id);
echo json_encode($data);
return false;
}
- //如果指定用户则发送邮件通知
- $t_a_id=$this->input->post('t_a_id');
- $author=$this->Infoauthors_model->detail_by_id($t_a_id);
- if(!empty($author))
- {
- $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_new_task_subject'),$this->input->post('t_title')), $this->lang->line('author_email_new_task_body'));
- }else{
- //给所有作者发送一封邮件
- $author_list = $this->Infoauthors_model->active_list();
- foreach ($author_list as $a) {
- $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $a->a_name, $a->a_email, sprintf($this->lang->line('author_email_new_task_subject'),$this->input->post('t_title')), $this->lang->line('author_email_new_task_body2'));
- }
+ //如果指定用户则发送邮件通知
+ $t_a_id = $this->input->post('t_a_id');
+ //所有作者
+ $author_list = $this->Infoauthors_model->active_list();
+ switch ($t_a_id) {
+ case 0://cht所有用户
+ foreach ($author_list as $a) {
+ if ($a->a_sitecode == 'cht' || empty($a->a_sitecode)) {
+ $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $a->a_name, $a->a_email, sprintf($this->lang->line('author_email_new_task_subject'), $this->input->post('t_title')), $this->lang->line('author_email_new_task_body2'));
+ }
+ }
+ break;
+ case -1://ah所有用户
+ foreach ($author_list as $a) {
+ if ($a->a_sitecode == 'ah') {
+ $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $a->a_name, $a->a_email, sprintf($this->lang->line('author_email_new_task_subject'), $this->input->post('t_title')), $this->lang->line('author_email_new_task_body2'));
+ }
+ }
+ break;
+ default://指定用户
+ $author = $this->Infoauthors_model->detail_by_id($t_a_id);
+ if (!empty($author)) {
+ $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_new_task_subject'), $this->input->post('t_title')), $this->lang->line('author_email_new_task_body'));
+ }
}
$data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit'));
@@ -732,13 +729,12 @@ class Author extends CI_Controller {
$this->InfoSMS_model->add('task', $task->t_id, $task->t_a_id, $task->t_ht_op_code, $this->input->post('m_content'));
$data[] = array('name' => 'ok', 'value' => $this->lang->line('send_sms_success'));
echo json_encode($data);
- $admin_info = $this->session->userdata('session_admin');
- $author=$this->Infoauthors_model->detail_by_id($task->t_a_id);
- if(!empty($author))
- {
- $this->InfoSMS_model->send_mail($admin_info['OPI_Name'], $admin_info['OPI_Email'], $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_message_subject'),$task->t_title), $this->lang->line('author_email_message_body'));
+ $admin_info = $this->session->userdata('session_admin');
+ $author = $this->Infoauthors_model->detail_by_id($task->t_a_id);
+ if (!empty($author)) {
+ $this->InfoSMS_model->send_mail($admin_info['OPI_Name'], $admin_info['OPI_Email'], $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_message_subject'), $task->t_title), $this->lang->line('author_email_message_body'));
}
- return true;
+ return true;
}
}
@@ -747,17 +743,16 @@ class Author extends CI_Controller {
if (empty($a_id)) {
show_404();
}
- $this->Infoauthors_model->update_site($a_id,$this->input->post('a_sitecode'));
+ $this->Infoauthors_model->update_site($a_id, $this->input->post('a_sitecode'));
$this->Infoauthors_model->reviwed($a_id, $this->input->post('a_active'));
$admin_info = $this->session->userdata('session_admin');
- $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $this->input->post('edit_a_name'), $this->input->post('edit_a_email'), 'Sign Up For China Highlights Online Writers Platform','Welcom to China Highlights Online Writers Platform:
China Highlights Online Writers Platform');
+ $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $this->input->post('edit_a_name'), $this->input->post('edit_a_email'), 'Sign Up For China Highlights Online Writers Platform', 'Welcom to China Highlights Online Writers Platform:
China Highlights Online Writers Platform');
$data[] = array('name' => 'ok', 'value' => $this->lang->line('author_review_submit'));
echo json_encode($data);
}
//编辑作者资料
- public function profile_submit()
- {
+ public function profile_submit() {
$a_id = $this->input->post('a_id');
if (empty($a_id)) {
show_404();
@@ -767,105 +762,95 @@ class Author extends CI_Controller {
$this->form_validation->set_rules('a_name', 'lang:signup_a_name', 'required');
$this->form_validation->set_rules('a_bank', 'lang:a_bank', 'required');
$this->form_validation->set_rules('a_bank_card', 'lang:a_bank_card', 'required');
- if ($this->form_validation->run() == FALSE)
- {
+ if ($this->form_validation->run() == FALSE) {
$data = array();
- foreach ($this->form_validation->_error_array as $key => $value)
- {
+ foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
return FALSE;
- }
- else
- {
+ } else {
//头像处理
- $a_photo=$this->input->post('a_photo');
- if ($this->input->post('profile_url')!='') {
- $profile_file_path=getcwd().'/author/document/profile_photo';
- $profile_url=$this->input->post('profile_url');
- $profile_array=explode('.', $profile_url);
- $profile_ext='jpg';//end($profile_array);
- $new_profile=$profile_file_path.'/profile_'.$this->input->post('a_email').'.'.$profile_ext;
- if(file_exists($new_profile))unlink($new_profile);
- rename($profile_file_path.'/'.$profile_url,$new_profile);
- rename($profile_file_path.'/'.str_replace('_thumb', '', $profile_url),$profile_file_path.'/profile_'.$this->input->post('a_email').'_org.'.$profile_ext);
- $a_photo='profile_'.$this->input->post('a_email').'.'.$profile_ext;
+ $a_photo = $this->input->post('a_photo');
+ if ($this->input->post('profile_url') != '') {
+ $profile_file_path = getcwd() . '/author/document/profile_photo';
+ $profile_url = $this->input->post('profile_url');
+ $profile_array = explode('.', $profile_url);
+ $profile_ext = 'jpg'; //end($profile_array);
+ $new_profile = $profile_file_path . '/profile_' . $this->input->post('a_email') . '.' . $profile_ext;
+ if (file_exists($new_profile))
+ unlink($new_profile);
+ rename($profile_file_path . '/' . $profile_url, $new_profile);
+ rename($profile_file_path . '/' . str_replace('_thumb', '', $profile_url), $profile_file_path . '/profile_' . $this->input->post('a_email') . '_org.' . $profile_ext);
+ $a_photo = 'profile_' . $this->input->post('a_email') . '.' . $profile_ext;
}
//处理上传的身份证复印件
- if ($this->input->post('ID_file_name')!='') {
- $ID_file_path=getcwd().'/author/document/ID_CARD';
- $a_id_file=$this->input->post('ID_file_name');
- $file_array=explode('.', $a_id_file);
- $ext='jpg';//end($file_array);
- $new_file=$ID_file_path.'/id_card_'.$this->input->post('a_email').'.'.$ext;
- if(file_exists($new_file))unlink($new_file);
- rename($ID_file_path.'/'.$a_id_file,$new_file);
+ if ($this->input->post('ID_file_name') != '') {
+ $ID_file_path = getcwd() . '/author/document/ID_CARD';
+ $a_id_file = $this->input->post('ID_file_name');
+ $file_array = explode('.', $a_id_file);
+ $ext = 'jpg'; //end($file_array);
+ $new_file = $ID_file_path . '/id_card_' . $this->input->post('a_email') . '.' . $ext;
+ if (file_exists($new_file))
+ unlink($new_file);
+ rename($ID_file_path . '/' . $a_id_file, $new_file);
}
- $a_name=trim($this->input->post('a_name'));
- $a_name_cn=trim($this->input->post('a_name_cn'));
- $this->Infoauthors_model->update($a_id, $this->input->post('a_email'),
- $a_name, $a_name_cn, $a_photo,
- $this->input->post('a_mobile_phone'),$this->input->post('a_phone'), $this->input->post('a_id_card'),
- $this->input->post('a_gender'),$this->input->post('a_address'), $this->input->post('a_school'),
- $this->input->post('a_bank'),$this->input->post('a_bank_card'), $this->input->post('a_resume'));
-
+ $a_name = trim($this->input->post('a_name'));
+ $a_name_cn = trim($this->input->post('a_name_cn'));
+ $this->Infoauthors_model->update($a_id, $this->input->post('a_email'), $a_name, $a_name_cn, $a_photo, $this->input->post('a_mobile_phone'), $this->input->post('a_phone'), $this->input->post('a_id_card'), $this->input->post('a_gender'), $this->input->post('a_address'), $this->input->post('a_school'), $this->input->post('a_bank'), $this->input->post('a_bank_card'), $this->input->post('a_resume'));
+
$this->Infoauthors_model->set_title($a_id, $this->input->post('a_title'));
-
+
$data[] = array('name' => 'ok', 'value' => $this->lang->line('setting_profile_success'));
echo json_encode($data);
return TRUE;
- }
+ }
}
-
+
//上传头像、身份证复印件等
- public function upload_ID_file($profile=false){
- $save_path='ID_CARD';
- $jsfunction='get_id_card_file';
- $upload_id='ID_file';
+ public function upload_ID_file($profile = false) {
+ $save_path = 'ID_CARD';
+ $jsfunction = 'get_id_card_file';
+ $upload_id = 'ID_file';
if ($profile) {
- $save_path='profile_photo';
- $jsfunction='get_photo_url';
- $upload_id='Profile_file';
+ $save_path = 'profile_photo';
+ $jsfunction = 'get_photo_url';
+ $upload_id = 'Profile_file';
}
- $path=APPPATH;
- $config['upload_path'] = getcwd().'/author/document/'.$save_path;
+ $path = APPPATH;
+ $config['upload_path'] = getcwd() . '/author/document/' . $save_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = true;
-
+
$this->load->library('upload', $config);
- if (!$this->upload->do_upload($upload_id))
- {
+ if (!$this->upload->do_upload($upload_id)) {
$error = array('error' => $this->upload->display_errors());
var_dump($error);
- }
- else
- {
+ } else {
$data = array('upload_data' => $this->upload->data());
- $file_name=$data['upload_data']['file_name'];
+ $file_name = $data['upload_data']['file_name'];
if ($profile) {
- $baseurl_array=explode('application', dirname(__FILE__));
- $baseurls=$baseurl_array[0];
+ $baseurl_array = explode('application', dirname(__FILE__));
+ $baseurls = $baseurl_array[0];
$config['image_library'] = 'gd2';
- $config['source_image'] = $baseurls.'author/document/profile_photo/'.$file_name;
+ $config['source_image'] = $baseurls . 'author/document/profile_photo/' . $file_name;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = false;
$config['width'] = 175;
$config['height'] = 175;
- $this->load->library('image_lib', $config);
+ $this->load->library('image_lib', $config);
$this->image_lib->resize();
- $profile_array=explode('.', $file_name);
- $file_name=$profile_array[0].'_thumb.'.$profile_array[1];
+ $profile_array = explode('.', $file_name);
+ $file_name = $profile_array[0] . '_thumb.' . $profile_array[1];
}
echo "";
}
}
- //修改职称
- public function submit_author_title()
- {
+ //修改职称
+ public function submit_author_title() {
$a_id = $this->input->post('a_id');
if (empty($a_id)) {
show_404();
@@ -873,53 +858,56 @@ class Author extends CI_Controller {
$this->Infoauthors_model->set_title($a_id, $this->input->post('a_title'));
$data[] = array('name' => 'ok', 'value' => $this->lang->line('author_title_submit'));
echo json_encode($data);
- }
+ }
//公告管理
- public function announce_list(){
- $data['announce_list']=$this->Infotaskarticles_model->get_announce('','announce');
- $data['notice_list']=$this->Infotaskarticles_model->get_announce();
+ public function announce_list() {
+ $data['announce_list'] = $this->Infotaskarticles_model->get_announce('', 'announce');
+ $data['notice_list'] = $this->Infotaskarticles_model->get_announce();
$data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'announce_list'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/author/announce_list');
$this->load->view('bootstrap/footer');
}
+
//公告详情
- public function announce_detail($announce_id,$type='notice'){
- $announce=$this->Infotaskarticles_model->get_announce($announce_id,$type);
- $data['announce_detail']=$announce[0];
+ public function announce_detail($announce_id, $type = 'notice') {
+ $announce = $this->Infotaskarticles_model->get_announce($announce_id, $type);
+ $data['announce_detail'] = $announce[0];
$data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'announce_list'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/author/announce_list');
$this->load->view('bootstrap/footer');
}
+
//编辑公告
- public function announce_edit($announce_id="",$type='notice'){
- if ($announce_id!="") {
- $announce=$this->Infotaskarticles_model->get_announce($announce_id,$type);
- $data['announce']=$announce[0];
+ public function announce_edit($announce_id = "", $type = 'notice') {
+ if ($announce_id != "") {
+ $announce = $this->Infotaskarticles_model->get_announce($announce_id, $type);
+ $data['announce'] = $announce[0];
}
$data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'announce_edit'), true);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/author/announce_edit');
$this->load->view('bootstrap/footer');
}
+
//公告更新
- public function add_announce(){
- $title=$this->input->post('title');
- $announce=$this->input->post('announce');
- $announce_id=$this->input->post('announce_id');
- $announce_type=$this->input->post('announce_type');
- $result=false;
+ public function add_announce() {
+ $title = $this->input->post('title');
+ $announce = $this->input->post('announce');
+ $announce_id = $this->input->post('announce_id');
+ $announce_type = $this->input->post('announce_type');
+ $result = false;
if (!empty($announce_id)) {
- $result=$this->Infotaskarticles_model->update($this->input->post('announce_id'), $title, $announce, '', $announce_type, '', '', '');
- }else{
- $result=$this->Infotaskarticles_model->add(0,0, $title, $announce, '', $announce_type, '', '', '','announce');
+ $result = $this->Infotaskarticles_model->update($this->input->post('announce_id'), $title, $announce, '', $announce_type, '', '', '');
+ } else {
+ $result = $this->Infotaskarticles_model->add(0, 0, $title, $announce, '', $announce_type, '', '', '', 'announce');
}
if ($result) {
$datas[] = array('name' => 'ok', 'value' => 'success!');
echo json_encode($datas);
- }else{
+ } else {
$datas[] = array('name' => 'no', 'value' => 'error!');
echo json_encode($datas);
}
@@ -927,35 +915,35 @@ class Author extends CI_Controller {
}
//删除公告
- public function announce_delete($announce_id){
+ public function announce_delete($announce_id) {
if ($this->Infotaskarticles_model->delete_announce($announce_id)) {
$datas[] = array('name' => 'ok', 'value' => 'success!');
- }else{
+ } else {
$datas[] = array('name' => 'no', 'value' => 'error!');
}
echo json_encode($datas);
}
//优秀文章评优处理
- public function set_task_charge(){
- $ta_isbest=NULL;
- if ($this->input->post('ta_isbest')==1) {
- $ta_isbest=date('Y-m-d H:i:s');
+ public function set_task_charge() {
+ $ta_isbest = NULL;
+ if ($this->input->post('ta_isbest') == 1) {
+ $ta_isbest = date('Y-m-d H:i:s');
}
- $result=$this->Infotaskarticles_model->update_review($this->input->post('t_id'), $this->input->post('ta_count'), $this->input->post('ta_charge'), $ta_isbest);
+ $result = $this->Infotaskarticles_model->update_review($this->input->post('t_id'), $this->input->post('ta_count'), $this->input->post('ta_charge'), $ta_isbest);
if ($result) {
- $datas = array('name' => 'ok', 'value' => 'success!');
- }else{
+ $datas = array('name' => 'ok', 'value' => 'success!');
+ } else {
$datas = array('name' => 'no', 'value' => 'error!');
}
echo json_encode($datas);
}
//标识所有收录信息为已读
- public function set_msg_to_read(){
- $msg_ids=array();
- $ic_id_str=$this->input->post('msg_ids');
- $msg_ids=explode(',', $ic_id_str);
+ public function set_msg_to_read() {
+ $msg_ids = array();
+ $ic_id_str = $this->input->post('msg_ids');
+ $msg_ids = explode(',', $ic_id_str);
foreach ($msg_ids as $key => $v) {
$this->InfoSMS_model->readed_for_info($v);
}
@@ -964,91 +952,93 @@ class Author extends CI_Controller {
//下载数据列表
public function load_to_excel($task_list) {
- $sum_count=$sum_charge=0;
- $exceldata=array();
- $exceldata[0]=array('任务号','任务名称','类型','作者','编辑','发布时间','完成时间','字数','金额');
- foreach($task_list as $key=>$task){
+ $sum_count = $sum_charge = 0;
+ $exceldata = array();
+ $exceldata[0] = array('任务号', '任务名称', '类型', '作者', '编辑', '发布时间', '完成时间', '字数', '金额');
+ foreach ($task_list as $key => $task) {
if (isset($task->last_version->ta_count)) {
$sum_count+=$task->last_version->ta_count;
- }else{
- $task->last_version->ta_count='-';
+ } else {
+ $task->last_version->ta_count = '-';
}
if (isset($task->last_version->ta_charge)) {
$sum_charge+=$task->last_version->ta_charge;
- }else{
- $task->last_version->ta_charge='-';
+ } else {
+ $task->last_version->ta_charge = '-';
}
if (!isset($task->last_version->ta_datetime)) {
- $task->last_version->ta_datetime=$task->t_expires;
- $exceldata[0][6]='截止时间';
+ $task->last_version->ta_datetime = $task->t_expires;
+ $exceldata[0][6] = '截止时间';
}
- $k=$key+1;
- $exceldata["$k"][]=$task->t_id;//任务号
- $exceldata["$k"][]=$task->t_title;//任务名称
- $exceldata["$k"][]=$task->t_td_type;//任务类型
- $exceldata["$k"][]=get_author_name($task->t_a_id);//作者
- $exceldata["$k"][]=get_author_name($task->t_ht_op_code);//编辑
- $exceldata["$k"][]=date('m/d/Y',strtotime($task->t_datetime));//任务发布时间
- $exceldata["$k"][]=date('m/d/Y',strtotime($task->last_version->ta_datetime));//完成时间或者截止时间
- $exceldata["$k"][]=$task->last_version->ta_count;//完成的字数
- $exceldata["$k"][]=$task->last_version->ta_charge;//金额
+ $k = $key + 1;
+ $exceldata["$k"][] = $task->t_id; //任务号
+ $exceldata["$k"][] = $task->t_title; //任务名称
+ $exceldata["$k"][] = $task->t_td_type; //任务类型
+ $exceldata["$k"][] = get_author_name($task->t_a_id); //作者
+ $exceldata["$k"][] = get_author_name($task->t_ht_op_code); //编辑
+ $exceldata["$k"][] = date('m/d/Y', strtotime($task->t_datetime)); //任务发布时间
+ $exceldata["$k"][] = date('m/d/Y', strtotime($task->last_version->ta_datetime)); //完成时间或者截止时间
+ $exceldata["$k"][] = $task->last_version->ta_count; //完成的字数
+ $exceldata["$k"][] = $task->last_version->ta_charge; //金额
}
- $exceldata[]=array('','','','','','','总计',$sum_count,$sum_charge);
+ $exceldata[] = array('', '', '', '', '', '', '总计', $sum_count, $sum_charge);
$this->_excel($exceldata);
}
//导出数据到excel
//$output要填充到excel的数据,必须是一个二维数组
- public function _excel($output=array()){
+ public function _excel($output = array()) {
header("Content-Type: application/vnd.ms-excel;");
- header("Content-Disposition:attachment;filename=".time().".csv");
- header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
- header('Expires:0');
+ header("Content-Disposition:attachment;filename=" . time() . ".csv");
+ header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
+ header('Expires:0');
header('Pragma:public');
- $excel_str="";
+ $excel_str = "";
foreach ($output as $item) {
foreach ($item as $v) {
- $v=str_replace(',',' ',$v);
- $excel_str.=$v.",";//设置某一单元格的值
+ $v = str_replace(',', ' ', $v);
+ $excel_str.=$v . ","; //设置某一单元格的值
}
- $excel_str.="\n";//添加行结束符
+ $excel_str.="\n"; //添加行结束符
}
$filetype = $this->input->post('filetype');
- if($filetype==2) $excel_str=iconv('UTF-8','GB2312',$excel_str);//excel简体中文版使用gb2312编码
+ if ($filetype == 2)
+ $excel_str = iconv('UTF-8', 'GB2312', $excel_str); //excel简体中文版使用gb2312编码
echo "$excel_str";
}
//返回指定页面路径pagepath在指定时间内的成效信息
- public function get_analytics_by_date($loadtotal=0){
- $data=array();
+ public function get_analytics_by_date($loadtotal = 0) {
+ $data = array();
//获取请求的日期范围以及请求的页面路径
- $startdate=$this->input->post('startdate');
- $enddate=$this->input->post('enddate');
- $pagepath=$this->input->post('pagepath');
- $sitecode=$this->input->post('sitecode');
+ $startdate = $this->input->post('startdate');
+ $enddate = $this->input->post('enddate');
+ $pagepath = $this->input->post('pagepath');
+ $sitecode = $this->input->post('sitecode');
if (empty($pagepath)) {
echo '';
return false;
}
//如果开始时间为空则把开始时间设为往前七天
if ($startdate == '') {
- $startdate = time()-7*24*60*60;
- }else{
+ $startdate = time() - 7 * 24 * 60 * 60;
+ } else {
$startdate = strtotime($startdate);
}
//如果结束时间为空,则把结束时间设为当天
if ($enddate == '') {
$enddate = time();
- }else{
+ } else {
$enddate = strtotime($enddate);
}
- if ($startdate>$enddate) {
- echo "请选择正确的日期";die();
+ if ($startdate > $enddate) {
+ echo "请选择正确的日期";
+ die();
}
//查取google分析数据
- $data['analytics_list'] = $this->Infotaskarticles_model->get_analytics_list($pagepath,$sitecode,50,$startdate,$enddate);
- $total_visit['pv'] = $total_visit['uv']=$total_visit['agv_time']=$total_visit['entrances']=0;
- $analytics_count=0;
+ $data['analytics_list'] = $this->Infotaskarticles_model->get_analytics_list($pagepath, $sitecode, 50, $startdate, $enddate);
+ $total_visit['pv'] = $total_visit['uv'] = $total_visit['agv_time'] = $total_visit['entrances'] = 0;
+ $analytics_count = 0;
//访问量汇总
foreach ($data['analytics_list'] as $v) {
$total_visit['pv']+=$v->kwa_pageviews;
@@ -1057,13 +1047,13 @@ class Author extends CI_Controller {
$total_visit['entrances']+=$v->kwa_entrances;
$analytics_count++;
}
- $analytics_count==0 ? $analytics_count=1 : null;
- $total_visit['agv_time']=ceil($total_visit['agv_time']/$analytics_count);
- $data['total_visit']=$total_visit;
+ $analytics_count == 0 ? $analytics_count = 1 : null;
+ $total_visit['agv_time'] = ceil($total_visit['agv_time'] / $analytics_count);
+ $data['total_visit'] = $total_visit;
//如果loadtotal==1,则只返回google分析的汇总数据;如果loadtotal==0,则返回明细数据表
- $data['loadtotal']=$loadtotal;
-
- $this->load->view('bootstrap/author/analytics',$data);
+ $data['loadtotal'] = $loadtotal;
+
+ $this->load->view('bootstrap/author/analytics', $data);
}
-}
+}
diff --git a/application/controllers/ht_flight.php b/application/controllers/ht_flight.php
index 11a531b6..1242f479 100644
--- a/application/controllers/ht_flight.php
+++ b/application/controllers/ht_flight.php
@@ -22,7 +22,8 @@ class Ht_flight extends CI_Controller {
} else {
$depart_city_name = $this->Air_model->get_city_by_code($depart_city_code);
$arrive_city_name = $this->Air_model->get_city_by_code($arrive_city_code);
- redirect("http://flight.elong.com/$depart_city_name-$arrive_city_name/?departdate=$depart_date");
+ //redirect("http://flight.elong.com/$depart_city_name-$arrive_city_name/?departdate=$depart_date");
+ redirect("http://flight.elong.com/search/$depart_city_code-$arrive_city_code/?departdate=$depart_date");
}
}
diff --git a/application/controllers/information.php b/application/controllers/information.php
index 1a5f0529..52f1e0ca 100644
--- a/application/controllers/information.php
+++ b/application/controllers/information.php
@@ -27,8 +27,6 @@ class Information extends CI_Controller {
public function index() {
echo '信息首页';
- $this->load->model('pictureUseStat_model');
- $this->pictureUseStat_model->test();
}
public function add($is_parent_id) {
@@ -68,6 +66,33 @@ class Information extends CI_Controller {
return TRUE;
}
+ //把文章移动到任意板块文章下
+ //is_id 信息结构ID,is_parent_id即将转移到的信息结构id
+ public function move_by_is_id() {
+ $data = array();
+ $is_id = $this->input->post('is_id');
+ $is_parent_id = $this->input->post('is_parent_id');
+ if ($is_id == $is_parent_id || empty($is_id) || empty($is_parent_id)) {
+ return false;
+ }
+ //即将移动到文章结构信息
+ $Structure = $this->InfoStructures_model->Detail($is_id);
+ //目标文章结构信息
+ $Structure_parent = $this->InfoStructures_model->Detail($is_parent_id);
+ //只能移动到本站点下
+ if ($Structure->is_sitecode == $Structure_parent->is_sitecode) {
+ //不能搬迁到自己的子节点下
+ if (strpos(',' . $Structure_parent->is_path, ',' . $is_id . ',') == false) {
+ $this->InfoStructures_model->set_path($is_parent_id, $is_id);
+ }
+ //信息的区域类型和id也要修改 todo
+ }
+ $data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
+ echo json_encode($data);
+ $this->Logs_model->move($is_id);
+ return TRUE;
+ }
+
public function delete($is_id) {
//查询结构信息
$Structure = $this->InfoStructures_model->Detail($is_id);
@@ -259,7 +284,7 @@ class Information extends CI_Controller {
//echo $request;
}
- // 分享数 lzq
+ // 分享数 lzq
public function statistical_sharing() {
//$info_ic = $this->Information_model->get_ic_url_by_code('mbj');
@@ -292,7 +317,7 @@ class Information extends CI_Controller {
//$sstt = $this->config->item('site');
//foreach($infolist as $k=>$v){
- // $aabb[] = $v->ic_sitecode;
+ // $aabb[] = $v->ic_sitecode;
//}
//$url_count = $this->Information_model->get_count_by_code('mbj');
//$surl = site_url('/information/fengxiangshu');
@@ -361,13 +386,17 @@ class Information extends CI_Controller {
$this->update_cache($this->input->post('ic_url'), true);
}
- //德语站FAQ版块需要删除原来的文件才能更新静态 by TDY @20150113
- if ($this->config->item('site_code') == 'gm' && substr($this->input->post('ic_url'), 0, 5) == '/faq/') {
- $this->update_cache($this->input->post('ic_url'), true);
- } else {
- $this->update_cache($this->input->post('ic_url'));
+ //德语站FAQ版块需要删除原来的文件才能更新静态
+ $site_code = $this->config->item('site_code');
+ $ic_url = $this->input->post('ic_url');
+ $auto_update_cache = $this->input->get_post('auto_update_cache_checkbox');
+ if ($site_code == 'gm' && substr($ic_url, 0, 5) == '/faq/') {
+ $this->update_cache($ic_url, true);
+ } else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) {
+ $this->update_cache($ic_url);
+ } else if (strcasecmp($site_code, "cht") != 0) {
+ $this->update_cache($ic_url);
}
- // }
$data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'));
$this->Logs_model->backup($information->is_id, $this->input->post('ic_content'));
@@ -445,6 +474,7 @@ class Information extends CI_Controller {
//更新静态文件
//不用参数提交的原因是可能url带有特殊字符,CI会报错
public function update_cache($static_html_url = false, $delete_only = false) {
+
$url = $static_html_url;
if (empty($url)) {
$url = $this->input->post('cache_url');
@@ -502,7 +532,7 @@ class Information extends CI_Controller {
$url = $this->config->item('site_url') . $url . '@cache@refresh';
}
- //关闭错误提示,防止file_get_contents请求特殊字符的时候会报错或者404、500,特殊字符需要用urlencode编码第一个/后面的url
+ //关闭错误提示,防止file_get_contents请求特殊字符的时候会报错或者404、500,特殊字符需要用urlencode编码第一个/后面的url
//error_reporting(NULL);
//ini_set('display_errors', 'Off');
diff --git a/application/controllers/keyworlds.php b/application/controllers/keyworlds.php
index f5b13762..d6c2c1a9 100644
--- a/application/controllers/keyworlds.php
+++ b/application/controllers/keyworlds.php
@@ -3,148 +3,149 @@
if (!defined('BASEPATH'))
exit('No direct script access allowed');
-class Keyworlds extends CI_Controller
-{
+class Keyworlds extends CI_Controller {
- function __construct()
- {
+ function __construct() {
parent::__construct();
$this->permission->is_admin(false);
- $this->load->model('InfoKeywords_model','Keywords_model');
- $this->load->model('InfoKeywordsrank_model','Keywordsrank_model');
- $this->load->model('InfoKeywordsanalytics_model','analytics_model');
+ $this->load->model('InfoKeywords_model', 'Keywords_model');
+ $this->load->model('InfoKeywordsrank_model', 'Keywordsrank_model');
+ $this->load->model('InfoKeywordsanalytics_model', 'analytics_model');
$this->load->model('InfoStructures_model');
}
- public function index($kw_is_id='')
- {
+ public function index($kw_is_id = '') {
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
-
+
$this->permission->is_admin();
//查询结构列表信息
$data['keyworldsList'] = $this->Keywords_model->get_structure_list();
if (empty($data['keyworldsList'])) {
- $this->add(0,false);
+ $this->add(0, false);
redirect(site_url("Keyworlds/index"));
}
- $root_key=false;
- $data['keyworldsList'][0]->id==$kw_is_id?$kw_is_id='':null;
+ $root_key = false;
+ $data['keyworldsList'][0]->id == $kw_is_id ? $kw_is_id = '' : null;
- if (empty($kw_is_id) || $kw_is_id=='asc' || $kw_is_id=='desc') {
- $root_key=true;
- $data['order']=empty($kw_is_id)?'asc':$kw_is_id;
+ if (empty($kw_is_id) || $kw_is_id == 'asc' || $kw_is_id == 'desc') {
+ $root_key = true;
+ $data['order'] = empty($kw_is_id) ? 'asc' : $kw_is_id;
$kw_is_id = $data['keyworldsList'][0]->id;
}
- $today=date('Y-m-d',time());
+ $today = date('Y-m-d', time());
$startdate = strtotime("$today -1 month");
- $enddate=time();
- if($this->input->post('startdate')!='')$startdate=strtotime($this->input->post('startdate'));
- if($this->input->post('enddate')!='')$enddate=strtotime($this->input->post('enddate'));
+ $enddate = time();
+ if ($this->input->post('startdate') != '')
+ $startdate = strtotime($this->input->post('startdate'));
+ if ($this->input->post('enddate') != '')
+ $enddate = strtotime($this->input->post('enddate'));
//查询当前关键词的排名情况
- $data['rank_json']='';
+ $data['rank_json'] = '';
$data['current_keyworld'] = $this->Keywords_model->get_keyworld_bytreeid($kw_is_id);
-
+
//如果是根目录,则展示最新关键词排名变化情况
if ($root_key) {
- $data['compare_rank']=$this->Keywords_model->get_compare_rank($data['order']);
- $this->load->view('bootstrap/header',$data);
+ $data['compare_rank'] = $this->Keywords_model->get_compare_rank($data['order']);
+ $this->load->view('bootstrap/header', $data);
$this->load->view('keyworlds/compare_rank');
$this->load->view('bootstrap/footer');
return;
}
- $data['wordcount']=1;
+ $data['wordcount'] = 1;
if ($data['current_keyworld']) {
//获取当前节所有直接子节点
- $is_id_string=$data['current_keyworld']->kw_id;
- $i=0;
+ $is_id_string = $data['current_keyworld']->kw_id;
+ $i = 0;
foreach ($data['keyworldsList'] as $kw) {
- if ($i>9) break;
- if($kw->pId==$kw_is_id){
- $is_id_string.=','.$kw->kw_id;
+ if ($i > 9)
+ break;
+ if ($kw->pId == $kw_is_id) {
+ $is_id_string.=',' . $kw->kw_id;
$i++;
- $data['wordcount']=2;
+ $data['wordcount'] = 2;
}
}
- $data['rank_info'] = $this->Keywordsrank_model->get_rank_list($is_id_string,30,$startdate,$enddate);
- empty($data['rank_info']) && $data['rank_info'] = $this->Keywordsrank_model->get_rank_list($is_id_string,30);
+ $data['rank_info'] = $this->Keywordsrank_model->get_rank_list($is_id_string, 30, $startdate, $enddate);
+ empty($data['rank_info']) && $data['rank_info'] = $this->Keywordsrank_model->get_rank_list($is_id_string, 30);
if (!empty($data['rank_info'])) {
$rank_info = $data['rank_info'];
asort($rank_info);
- $data_time=array();
- foreach ($rank_info as $key=>$r) {
- if(!in_array(date('Y-m-d',$r->kwr_datetime), $data_time)) $data_time[] = date('Y-m-d',$r->kwr_datetime);
- $rank_json[$r->kwr_kw_id][date('Y-m-d',$r->kwr_datetime)]=$r;
- $rank_json2[$r->kwr_kw_id][]=$r;
+ $data_time = array();
+ foreach ($rank_info as $key => $r) {
+ if (!in_array(date('Y-m-d', $r->kwr_datetime), $data_time))
+ $data_time[] = date('Y-m-d', $r->kwr_datetime);
+ $rank_json[$r->kwr_kw_id][date('Y-m-d', $r->kwr_datetime)] = $r;
+ $rank_json2[$r->kwr_kw_id][] = $r;
}
foreach ($data_time as $d) {
foreach ($rank_json as $kw_id => &$value) {
- if(!isset($pre[$kw_id])) $pre[$kw_id]=$rank_json2[$kw_id][0];
+ if (!isset($pre[$kw_id]))
+ $pre[$kw_id] = $rank_json2[$kw_id][0];
if (!isset($value[$d])) {
- $value[$d]=$pre[$kw_id];
- }else{
+ $value[$d] = $pre[$kw_id];
+ } else {
$pre[$kw_id] = $value[$d];
}
}
}
- $data['rank_json'] ='[';
+ $data['rank_json'] = '[';
foreach ($rank_json as &$ra) {
ksort($ra);
- $data['rank_json'] .='{"name":"'.$ra[$data_time[0]]->kw_keyworlds.'","data":[';
+ $data['rank_json'] .='{"name":"' . $ra[$data_time[0]]->kw_keyworlds . '","data":[';
foreach ($ra as $v) {
$kwr_rank = $v->kwr_rank;
- if ($v->kwr_rank=='>150') $kwr_rank=100;
- if (strtolower($this->config->item('site_code'))=='gm') {
- $data['rank_json'] .=-$kwr_rank.',';
- }else{
- $data['rank_json'] .=$kwr_rank.',';
+ if ($v->kwr_rank == '>150')
+ $kwr_rank = 100;
+ if (strtolower($this->config->item('site_code')) == 'gm') {
+ $data['rank_json'] .=-$kwr_rank . ',';
+ } else {
+ $data['rank_json'] .=$kwr_rank . ',';
}
}
- $data['rank_json'] = substr($data['rank_json'],0,-1);
+ $data['rank_json'] = substr($data['rank_json'], 0, -1);
$data['rank_json'] .=']},';
}
- $data['rank_json']=substr($data['rank_json'],0,-1).']';
+ $data['rank_json'] = substr($data['rank_json'], 0, -1) . ']';
$data['data_time'] = json_encode($data_time);
- $data['rank_info']='';
- isset($rank_json[$data['current_keyworld']->kw_id]) && $data['rank_info']=$rank_json[$data['current_keyworld']->kw_id];
+ $data['rank_info'] = '';
+ isset($rank_json[$data['current_keyworld']->kw_id]) && $data['rank_info'] = $rank_json[$data['current_keyworld']->kw_id];
}
- }else{
+ } else {
redirect(site_url("Keyworlds/index"));
}
- $data['analytics']=$this->analytics_model->get_keyword_analytics($data['current_keyworld']->kw_keyworlds,30);
- $data['site_code']=strtolower($this->config->item('site_code'));
+ $data['analytics'] = $this->analytics_model->get_keyword_analytics($data['current_keyworld']->kw_keyworlds, 30);
+ $data['site_code'] = strtolower($this->config->item('site_code'));
- $this->load->view('bootstrap/header',$data);
+ $this->load->view('bootstrap/header', $data);
$this->load->view('keyworlds/index');
$this->load->view('bootstrap/footer');
}
//搜索关键词
- public function search_keywords(){
- $keyworlds=$this->input->post('keyworlds');
- if (empty($keyworlds))
- {
+ public function search_keywords() {
+ $keyworlds = $this->input->post('keyworlds');
+ if (empty($keyworlds)) {
echo 0;
return;
}
- $data['keyworld']=$keyworlds;
- $data['keyworld_info']=$this->Keywords_model->get_keyworld_by_word($keyworlds);
- $this->load->view('keyworlds/search',$data);
+ $data['keyworld'] = $keyworlds;
+ $data['keyworld_info'] = $this->Keywords_model->get_keyworld_by_word($keyworlds);
+ $this->load->view('keyworlds/search', $data);
}
//添加关键词
- public function add($is_parent_id,$is_ajax=true)
- {
+ public function add($is_parent_id, $is_ajax = true) {
$insert_id = $this->InfoStructures_model->Add($is_parent_id);
- if ($insert_id && $kw_id=$this->Keywords_model->add_keyworlds('New Keywords',$this->config->item('site_code'),time(),$insert_id)){
+ if ($insert_id && $kw_id = $this->Keywords_model->add_keyworlds('New Keywords', $this->config->item('site_code'), time(), $insert_id)) {
$data[] = array('name' => 'ok', 'value' => $this->Keywords_model->get_keyworld($kw_id));
- }else{
+ } else {
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
}
if ($is_ajax) {
@@ -155,24 +156,21 @@ class Keyworlds extends CI_Controller
}
//编辑关键词
- public function edit(){
+ public function edit() {
$this->form_validation->set_rules('keyworlds', 'lang:kw_keyworlds', 'required');
$this->form_validation->set_rules('kw_id', 'lang:kw_id', 'required');
- if ($this->form_validation->run() == FALSE)
- {
+ if ($this->form_validation->run() == FALSE) {
$data = array();
- foreach ($this->form_validation->_error_array as $key => $value)
- {
+ foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
- }else
- {
- $isupdate=$this->Keywords_model->edit_keyworlds($this->input->post('keyworlds'),$this->input->post('kw_id'),$this->input->post('status'));
+ } else {
+ $isupdate = $this->Keywords_model->edit_keyworlds($this->input->post('keyworlds'), $this->input->post('kw_id'), $this->input->post('status'));
if ($isupdate) {
$data[] = array('name' => 'ok', 'value' => $this->lang->line('form_keyworlds_success'));
echo json_encode($data);
- }else{
+ } else {
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_keyworlds_error'));
echo json_encode($data);
}
@@ -180,32 +178,29 @@ class Keyworlds extends CI_Controller
}
//删除某个排名
- public function delete_one_rank($kwr_id){
+ public function delete_one_rank($kwr_id) {
$this->Keywordsrank_model->delete_one_rank($kwr_id);
- header("Location:".$_SERVER['HTTP_REFERER']);
+ header("Location:" . $_SERVER['HTTP_REFERER']);
}
//删除关键词
- public function delete_keyworlds(){
+ public function delete_keyworlds() {
$this->form_validation->set_rules('kw_id', 'lang:kw_id', 'required');
$this->form_validation->set_rules('kw_is_id', 'lang:kw_is_id', 'required');
- if ($this->form_validation->run() == FALSE)
- {
+ if ($this->form_validation->run() == FALSE) {
$data = array();
- foreach ($this->form_validation->_error_array as $key => $value)
- {
+ foreach ($this->form_validation->_error_array as $key => $value) {
$data[] = array('name' => $key, 'value' => $value);
}
echo json_encode($data);
- }else
- {
- $isdelete=$this->Keywords_model->delete($this->input->post('kw_id'));
+ } else {
+ $isdelete = $this->Keywords_model->delete($this->input->post('kw_id'));
if ($isdelete) {
$this->Keywordsrank_model->delete($this->input->post('kw_id'));
$this->InfoStructures_model->Delete($this->input->post('kw_is_id'));
$data[] = array('name' => 'ok', 'value' => site_url('keyworlds/index'));
echo json_encode($data);
- }else{
+ } else {
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_keyworlds_error'));
echo json_encode($data);
}
@@ -213,16 +208,13 @@ class Keyworlds extends CI_Controller
}
//移动关键词排序顺序
- public function move()
- {
+ public function move() {
//网站会提交一个同级节点id列表字符串,按照这个去排序
$parent_id = $this->input->post('pid');
$idsStr = $this->input->post('ids');
$idsArray = explode(',', $idsStr);
- foreach ($idsArray as $key => $value)
- {
- if ($value)
- {
+ foreach ($idsArray as $key => $value) {
+ if ($value) {
//设置排序
$this->InfoStructures_model->set_sort($value, $key);
//设置path
@@ -234,278 +226,196 @@ class Keyworlds extends CI_Controller
return TRUE;
}
- public function get_google_rank()
- {
+ public function get_google_rank() {
$keyworlds = $this->input->post('keyworlds'); //搜索关键字
- $kw_id = $this->input->post('kw_id');
- $site_url = $this->config->item('site_url');
+ $kw_id = $this->input->post('kw_id');
+ $site_url = $this->config->item('site_url');
//$engines = array('cht'=>'get_search_content_by_aol','gm' =>'get_search_content_by_google','vc' =>'get_search_content_by_google','jp' =>'get_search_content_by_yahoo','vac'=>'get_search_content_by_google','it' =>'get_search_content_by_google','ru' =>'get_search_content_by_google','wt' =>'get_search_content_by_baidu','tbt'=>'get_search_content_by_aol','sht'=>'get_search_content_by_aol','yz' =>'get_search_content_by_aol','gl' =>'get_search_content_by_aol','mbj'=>'get_search_content_by_aol','ct' =>'get_search_content_by_aol','mct'=>'get_search_content_by_aol','dct'=>'get_search_content_by_aol','cits' =>'get_search_content_by_baidu',);
//$engines = array('cht'=>'get_search_content_by_google','gm' =>'get_search_content_by_google','vc' =>'get_search_content_by_google','jp' =>'get_search_content_by_yahoo','vac'=>'get_search_content_by_google','it' =>'get_search_content_by_google','ru' =>'get_search_content_by_google','wt' =>'get_search_content_by_baidu','tbt'=>'get_search_content_by_google','sht'=>'get_search_content_by_google','yz' =>'get_search_content_by_google','gl' =>'get_search_content_by_google','mbj'=>'get_search_content_by_google','ct' =>'get_search_content_by_google','mct'=>'get_search_content_by_google','dct'=>'get_search_content_by_google','cits' =>'get_search_content_by_baidu');
- $engines = array('cht'=>'get_search_content_by_google','gm' =>'get_search_content_by_google','vc' =>'get_search_content_by_google','jp' =>'get_search_content_by_google','vac'=>'get_search_content_by_google','it' =>'get_search_content_by_google','ru' =>'get_search_content_by_google','wt' =>'get_search_content_by_baidu','tbt'=>'get_search_content_by_google','sht'=>'get_search_content_by_google','yz' =>'get_search_content_by_google','gl' =>'get_search_content_by_google','mbj'=>'get_search_content_by_google','ct' =>'get_search_content_by_google','mct'=>'get_search_content_by_google','dct'=>'get_search_content_by_google','cits' =>'get_search_content_by_baidu','ah' =>'get_search_content_by_google');
- $site_code=$this->config->item('site_code');
- $method=$engines[$site_code];
-
- if($site_code=='wt')$site_url='www.iiiyooo.com';
- if($site_code=='cits')$site_url='www.guilincits.c';
+ $engines = array('cht' => 'get_search_content_by_google', 'gm' => 'get_search_content_by_google', 'vc' => 'get_search_content_by_google', 'jp' => 'get_search_content_by_google', 'vac' => 'get_search_content_by_google', 'it' => 'get_search_content_by_google', 'ru' => 'get_search_content_by_google', 'wt' => 'get_search_content_by_baidu', 'tbt' => 'get_search_content_by_google', 'sht' => 'get_search_content_by_google', 'yz' => 'get_search_content_by_google', 'gl' => 'get_search_content_by_google', 'mbj' => 'get_search_content_by_google', 'ct' => 'get_search_content_by_google', 'mct' => 'get_search_content_by_google', 'dct' => 'get_search_content_by_google', 'cits' => 'get_search_content_by_baidu', 'ah' => 'get_search_content_by_google');
+ $site_code = $this->config->item('site_code');
+ $method = $engines[$site_code];
- $last_rank=$this->Keywordsrank_model->get_rank_list($kw_id,$top=1);
- if (isset($last_rank[0]->kwr_datetime) and (time()-$last_rank[0]->kwr_datetime)<300) {
+ if ($site_code == 'wt')
+ $site_url = 'www.iiiyooo.com';
+ if ($site_code == 'cits')
+ $site_url = 'www.guilincits.c';
+
+ $last_rank = $this->Keywordsrank_model->get_rank_list($kw_id, $top = 1);
+ if (isset($last_rank[0]->kwr_datetime) and ( time() - $last_rank[0]->kwr_datetime) < 300) {
$data[] = array('name' => 'rank', 'value' => '查询过于频繁,请等待三分钟!');
echo json_encode($data);
return TRUE;
}
//获取排名详细情况,排名超过150的停止搜索
- for ($i=1; $i <=15 ; $i++) {
- $j=$i;
- $rank = $this->$method($keyworlds,$site_url,$j,$site_code);
- if ($rank['rank']!=0){
- if ($rank['rank']>150) $rank['rank'] = '151';
+ for ($i = 1; $i <= 15; $i++) {
+ $j = $i;
+ $rank = $this->$method($keyworlds, $site_url, $j, $site_code);
+ if ($rank['rank'] != 0) {
+ if ($rank['rank'] > 150)
+ $rank['rank'] = '151';
break;
- }elseif($i==15){
+ }elseif ($i == 15) {
$rank['rank'] = '151';
break;
- }elseif ($rank['rank']==-2) {
+ } elseif ($rank['rank'] == -2) {
break;
}
}
//保存排名数据
if ($rank['rank'] == '151') {
$this->Keywords_model->update_time($kw_id);
- }elseif (isset($last_rank[0]->kwr_datetime) and $last_rank[0]->kwr_datetime>strtotime(date('Y-m-d'))) {
- if ($rank['rank']!=-1 and $rank['rank']!=-2 and $this->Keywordsrank_model->update_rank($last_rank[0]->kwr_id,$rank['rank'],$rank['source'])) {
+ } elseif (isset($last_rank[0]->kwr_datetime) and $last_rank[0]->kwr_datetime > strtotime(date('Y-m-d'))) {
+ if ($rank['rank'] != -1 and $rank['rank'] != -2 and $this->Keywordsrank_model->update_rank($last_rank[0]->kwr_id, $rank['rank'], $rank['source'])) {
$this->Keywords_model->update_time($kw_id);
}
- }else{
- if ($rank['rank']!=-1 and $rank['rank']!=-2 and $this->Keywordsrank_model->add_rank($kw_id,$rank['rank'],$rank['source'],$rank['engines'])) {
+ } else {
+ if ($rank['rank'] != -1 and $rank['rank'] != -2 and $this->Keywordsrank_model->add_rank($kw_id, $rank['rank'], $rank['source'], $rank['engines'])) {
$this->Keywords_model->update_time($kw_id);
}
- }
+ }
$data[] = array('name' => 'rank', 'value' => $rank['rank']);
echo json_encode($data);
return TRUE;
}
//自动爬取排名
- public function get_auto_rank($engines=''){
+ public function get_auto_rank($engines = '', $fix_site_code = '') {
$rank = array();
$site_config = $this->config->item('site');
- $engines=trim($engines);
+ $engines = trim($engines);
//取出需要更新排名的关键词
- if ($engines==''){
- $worldsList = $this->Keywords_model->get_keyworld_list(1);
- }else{
- $worldsList = $this->Keywords_model->get_keyworld_list(1,$engines);
- }
+ $worldsList = $this->Keywords_model->get_keyworld_list(1, $engines, $fix_site_code);
+ //print_r($worldsList);die();
//如果没有需要更新的则返回
- if (empty($worldsList))
- {
+ if (empty($worldsList)) {
+ echo 'all done';
return;
}
- $last_rank=$this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id);
+ $last_rank = $this->Keywordsrank_model->get_rank_list($worldsList[0]->kw_id);
//获取排名并保存
- foreach ($worldsList as $v)
- {
+ foreach ($worldsList as $v) {
$site_config = $site_config[$v->kw_sitecode];
$site_url = $site_config['site_url'];
$site_code = $site_config['site_code'];
- for ($i=1; $i <=15 ; $i++) {
- //没有输入搜索引擎的时候根据站点自动分配获取排名的搜索引擎
- if($engines=='' || $engines=='en' || $engines=='eu')
- {
- if (in_array($v->kw_sitecode,array('gm','vc','vac','it','ru','jp'))) {
- $rank = $this->get_search_content_by_google($v->kw_keyworlds,$site_url,$i,$site_code);
- }
- //elseif ($v->kw_sitecode=='jp') {
- // $rank = $this->get_search_content_by_yahoo($v->kw_keyworlds,$site_url,$i,$site_code);
- //}
- /*elseif ($v->kw_sitecode=='ru') {
- $rank = $this->get_search_content_by_yandex($v->kw_keyworlds,$site_url,$i-1);
- }*/
- elseif($v->kw_sitecode=='cits' or $v->kw_sitecode=='wt'){
- if($site_code=='wt')$site_url='www.iiiyooo.com';
- $rank = $this->get_search_content_by_baidu($v->kw_keyworlds,$site_url,$i);
- }else{
- //$rank = $this->get_search_content_by_aol($v->kw_keyworlds,$site_url,$i);
- $rank = $this->get_search_content_by_google($v->kw_keyworlds,$site_url,$i,$site_code);
- }
- }
- elseif ($engines=='baidu') {
- if($site_code=='wt')$site_url='www.iiiyooo.com';
- $rank = $this->get_search_content_by_baidu($v->kw_keyworlds,$site_url,$i);
+ for ($i = 1; $i <= 15; $i++) {
+ if ($engines == '' || $engines == 'en' || $engines == 'eu') {//没有输入搜索引擎的时候根据站点自动分配获取排名的搜索引擎
+ $rank = $this->get_search_content_by_google($v->kw_keyworlds, $site_url, $i, $site_code);
+ } else if ($engines == 'yandex') {//俄语站的yangdex
+ $rank = $this->get_search_content_by_yandex($v->kw_keyworlds, $site_url, $i - 1);
+ } elseif ($engines == 'yahoo') {
+ $rank = $this->get_search_content_by_yahoo($v->kw_keyworlds, $site_url, $i, $site_code);
}
- //俄语站的yangdex
- else if ($engines=='yandex')
- {
- $rank = $this->get_search_content_by_yandex($v->kw_keyworlds,$site_url,$i-1);
- }elseif ($engines=='yahoo') {
- $rank = $this->get_search_content_by_yahoo($v->kw_keyworlds,$site_url,$i,$site_code);
- }
-
- if ($rank['rank']!=0){
- if ($rank['rank']>150) $rank['rank'] = '151';
+
+ if ($rank['rank'] != 0) {
+ if ($rank['rank'] > 150)
+ $rank['rank'] = '151';
break;
- }elseif($i==15){
+ }elseif ($i == 15) {
$rank['rank'] = '151';
- }elseif ($rank['rank']==-2) {
+ } elseif ($rank['rank'] == -2) {
break;
}
}
//if ($rank['rank'] == '151') {
- if (1==2) {
- if ($engines!='yandex') $this->Keywords_model->update_time($v->kw_id);
- }elseif ($rank['rank']!=-1 and $rank['rank']!=-2 and $this->Keywordsrank_model->add_rank($v->kw_id,$rank['rank'],$rank['source'],$rank['engines'])) {
+ if ($rank['rank'] != -1 and $rank['rank'] != -2 and $this->Keywordsrank_model->add_rank($v->kw_id, $rank['rank'], $rank['source'], $rank['engines'])) {
$this->load->model('InfoSMS_model');
- $last_rank=isset($last_rank[0])?$last_rank[0]->kwr_rank:$rank['rank'];
- $this->InfoSMS_model->readed_for_info($v->kw_id,'keywords_rank');
- $this->InfoSMS_model->add('keywords_rank',$v->kw_id,$rank['rank'],$last_rank,(string)($rank['rank']-$last_rank));
- if ($engines!='yandex') $this->Keywords_model->update_time($v->kw_id);
- }
- }
- var_dump($worldsList[0]->kw_keyworlds,$rank);
- }
-
- //计算关键词在aol搜索引擎的排名
- public function get_search_content_by_aol($keyworlds,$site_url,$page,$sitecode=false)
- {
- $rank['rank'] = 0;
- $rank['source'] = $site_url;
- $rank['engines'] = 'aol';
- $startrank=($page-1)*10;
-
- //拼接关键词
- $key_array = explode(' ',$keyworlds);
- $search_worlds='';
- foreach ($key_array as $v) {
- $search_worlds.='+'.$v;
- }
- $search_worlds = substr($search_worlds,1);
-
- //抓取AOL搜索结果
- $this->load->library('Snoopy');
- $snoopy = $this->snoopy;
- $snoopy->maxredirs=0;
- $snoopy->agent = '(Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0)';//模拟浏览器
- if($snoopy->fetch("http://search.aol.com/aol/search?s_chn=prt_ct8&s_it=comsearch&q=$search_worlds&page=$page&s_it=topsearchbox.search"))
- {
-
- $response = $snoopy->results;
-
- //分析AOL搜索结果,计算排名
- if (false !== stripos($response,'
Sur name/First and Middle name:
-Passport No.:
-Passport Expiration Date:
-Birthday:
- - -Land line:
-Mobile:
-Home Address:
- -Arrival China Flight No.:
-- Arrival time: -
-- Departure China Flight no.: -
-- Departure time: -
-
-
-
-
-
-
-
- Contact person name: -
-- Relationship with him/her: -
-- E-mail address: -
-- Telephone no.: -
\ No newline at end of file diff --git a/application/third_party/train/controllers/auto.php b/application/third_party/train/controllers/auto.php index a6d1dff4..5f1b5dfb 100644 --- a/application/third_party/train/controllers/auto.php +++ b/application/third_party/train/controllers/auto.php @@ -1,5 +1,4 @@ -load->model("BIZ_train_model");//加载模型 } - - //用于自动出票,接收COLI_SN + //用于自动出票 public function auto_pay_ticket(){ date_default_timezone_set('Asia/Shanghai'); - // $coli_sn="473013018"; - $coli_sn = $this->input->post("coli_sn"); - $list=new StdClass; - $back_data = 1; - - if(!empty($coli_sn)){ - $cold_sn=$this->BIZ_train_model->get_cold_sn($coli_sn); - $coli_id = $this->BIZ_train_model->coli_sn_get_coli_id($coli_sn); - $i = 0; - $list->info=array(); - foreach ($cold_sn as $v) { - if($v->COLD_SPFS > 1){ - //寄送票 - $back_data = 0; - break; - } - $list->info[$i]=new StdClass; - $list->info[$i]->people=$this->BIZ_train_model->biz_people($v->COLD_SN); - $list->info[$i]->train=$this->BIZ_train_model->get_biz_foi($v->COLD_SN); - $list->info[$i]->status=$this->BIZ_train_model->get_biz_jol($v->COLD_SN); - - if(count($list->info[$i]->people) > 5){ - $back_data = 0; - break; - }; - if((strtotime($list->info[$i]->train[0]->DepartureTime) - time())/3600 < 3 or (strtotime($list->info[$i]->train[0]->DepartureTime) - time())/24/3600 >29){ - $back_data = 0; - break; - } - if($list->info[$i]->train[0]->adultcost > 1000){ - $back_data = 0; - break; - } - $i++; - } - if($back_data == 0){ - echo 0; - return false; - }else{ - foreach ($cold_sn as $v) { - $reback = $this->submit_juhe_order($v->COLD_SN,$coli_id[0]->COLI_ID); - if($reback["status"] && !empty($reback["order"])){ - $back_data .= ",".$reback["order"]; - } - } - } - $back_data = substr($back_data, 2); - if($back_data){ //这里 $back_data 还有可能没数据,所以判断一下 - echo $back_data; - }else{ - echo 0; - } - return false; - } - + $list=new StdClass; + $ticket_info = $this->BIZ_train_model->auto_check_ticket(); + //print_r($ticket_info); + foreach($ticket_info as $item){ + $back_data = 1; + $coli_sn = $item->COLI_SN; + if(!empty($coli_sn)){ + $cold_sn = $this->BIZ_train_model->get_cold_sn($coli_sn); + $coli_id = $this->BIZ_train_model->coli_sn_get_coli_id($coli_sn); + $i = 0; + $list->info=array(); + foreach ($cold_sn as $v) { + //是否已经出过票(通过查询聚合数据判断此订单是否已经请求过聚合) + if(empty($this->BIZ_train_model->get_biz_jol($v->COLD_SN))){ + //邮寄的不自动出票 + if($v->COLD_SPFS > 1){ + //寄送票 + $back_data = 0; + break; + } + $list->info[$i]=new StdClass; + $list->info[$i]->people=$this->BIZ_train_model->biz_people($v->COLD_SN); + $list->info[$i]->train=$this->BIZ_train_model->get_biz_foi($v->COLD_SN); + //print_r($list->info[$i]->people); + //print_r($list->info[$i]->train); + + //护照位数大于18位则不自动出票 + if(strlen($list->info[$i]->people[$i]->BPE_Passport) >= 18){ + $back_data = 0; + break; + } + + //乘客人数大于5人不出票 + if(count($list->info[$i]->people) > 5){ + $back_data = 0; + break; + }; + + //3小时以内或者大于29天的不出票 + if((strtotime($list->info[$i]->train[0]->DepartureTime) - time())/3600 < 3 or (strtotime($list->info[$i]->train[0]->DepartureTime) - time())/24/3600 >29){ + $back_data = 0; + break; + } + + //金额不能大于1000人民币 + if($list->info[$i]->train[0]->adultcost > 1000){ + $back_data = 0; + break; + } + $i++; + } + } + + if($back_data == 0){ + echo 0; + return false; + }else{ + foreach ($cold_sn as $v) { + $reback = $this->submit_juhe_order($v->COLD_SN,$coli_id[0]->COLI_ID); + if($reback["status"] && !empty($reback["order"])){ + $back_data .= ",".$reback["order"]; + } + } + } + $back_data = substr($back_data, 2); + if($back_data){ //这里 $back_data 还有可能没数据,所以判断一下 + echo $back_data; + }else{ + echo 0; + } + return false; + } + } } + //根据汉特订单明细表SN来获取车次,乘客信息,拼接成聚合提交订单的url public function submit_juhe_order($cold_sn,$coli_id) { // $cold_sn=$this->input->get("order"); @@ -130,6 +147,7 @@ class Auto extends CI_Controller{ echo json_encode($reback); return false; } + //前面做过判断,为什么还要再判断一次 if (count($data['people_list']) > 5) { //显示错误,用户超过五个 $reback["mes"]="乘客不能超过五个"; @@ -144,8 +162,8 @@ class Auto extends CI_Controller{ foreach ($data['people_list'] as $key => $item) { $zwcode = $db_train_zw[$data['train']->Aircraft]; //座位简码 $zwname = $train_zw[$db_train_zw[$data['train']->Aircraft]]; //座位名称 - //乘客姓名 - $passengersename = trim($item->BPE_FirstName) . trim($item->BPE_MiddleName) . trim($item->BPE_LastName); + //乘客姓名(聚合要求名字中不能出现空格字符) + $passengersename = str_replace(' ','',$item->BPE_FirstName) . str_replace(' ','',$item->BPE_MiddleName) . str_replace(' ','',$item->BPE_LastName); //乘客类型 switch ($item->BPE_GuestType) { case 1: @@ -181,7 +199,11 @@ class Auto extends CI_Controller{ "passengers"=>$passengers, "checi"=>$data["train"]->FlightsNo ); - // $bakc_json=$this->post_data($url,$post_data); + + print_r($url); + print_r($post_data); + die(); + //$bakc_json=$this->post_data($url,$post_data); $bakc=json_decode($bakc_json);//json=>obj $add_data=new StdClass(); @@ -201,17 +223,21 @@ class Auto extends CI_Controller{ $reback["status"]=1; $reback["order"]=$bakc->result->orderid; $reback["mes"]="订单提交成功,等待回调"; - $this->send_mail_to_wl("订单:{$coli_id} 提交成功","翰特订单号:{$coli_id} ;聚合订单号:{$bakc->result->orderid}"); + $this->send_mail_to_wl("订单:{$coli_id} 提交成功","翰特订单号:{$coli_id} ;聚合订单号:{$bakc->result->orderid}"); + //聚合返回成功信息后,将处理过的订单标记为付款已出票(61) + $this->BIZ_train_model->update_ticket_state($coli_id); }else{ $add_data->JOL_JuheOrder=null; $reback["mes"]= $bakc_json; $add_data->JOL_Status="e"; $this->send_mail_to_wl("订单:{$coli_id} 提交失败","翰特订单号:{$coli_id}"); } + //聚合返回数据之后记录到聚合订单表 $add_back_data=$this->BIZ_train_model->add_biz_jol($add_data); return $reback; } + public function ticket_status($coli_sn="",$jh_id=""){ if(empty($coli_sn)){ $coli_sn = $this->input->get("sn"); @@ -246,6 +272,7 @@ class Auto extends CI_Controller{ $list->cols_id = $cols_id[0]->COLI_ID; $this->load->view("ticket_status",$list); } + //发邮件给外联 public function send_mail_to_wl($subject,$body){ $this->load->model("Sendmail_model"); @@ -253,7 +280,7 @@ class Auto extends CI_Controller{ $fromEmail = "csk@hainatravel.com"; $toName = "ethel"; $toEmail = "ethel@chinahighlights.com"; - $this->Sendmail_model->SendGuest($fromName,$fromEmail,$toName,$toEmail,$subject,$body); + $this->Sendmail_model->SendMailToTable($fromName,$fromEmail,$toName,$toEmail,$subject,$body); } //发邮件给客人 public function send_mail_to_guest($coli_id,$jh_order){ @@ -265,7 +292,7 @@ class Auto extends CI_Controller{ $toEmail = $guest[0]->GUT_Email; $subject = "auto pay test $jh_order"; $body = "csk test train ticket $jh_order"; - $this->Sendmail_model->SendGuest($fromName,$fromEmail,$toName,$toEmail,$subject,$body); + $this->Sendmail_model->SendMailToTable($fromName,$fromEmail,$toName,$toEmail,$subject,$body); } // public function sub_callback(){ @@ -382,4 +409,4 @@ class Auto extends CI_Controller{ return $output; } -} \ No newline at end of file +} diff --git a/application/third_party/train/controllers/index.php b/application/third_party/train/controllers/index.php index 4b0098de..04074e90 100644 --- a/application/third_party/train/controllers/index.php +++ b/application/third_party/train/controllers/index.php @@ -32,6 +32,7 @@ class Index extends CI_Controller{ $this->pay_api=JUHE_TRAIN_PAY_API; $this->refund_api=JUHE_TRAIN_REFUND_API; $this->status_api=JUHE_TRAIN_STATUS_API; + $this->balance_api = "http://op.juhe.cn/trainTickets/balance.php";//余额 $this->code_zw=$this->config->item('train_zw'); $this->piaotype=$this->config->item('train_piaotype'); $this->passportty=$this->config->item('train_passportty'); @@ -906,6 +907,16 @@ class Index extends CI_Controller{ } $list->cols_id=$cols_id; } + $post_data=array( + "key"=>$this->key + ); + $back_data=$this->post_data($this->balance_api,$post_data); + $back_data = json_decode($back_data); + if(!empty($back_data->result)){ + $list->balance = $back_data->result; + }else{ + $list->balance = "NULL"; + } $this->load->view('bootstrap3/header'); $this->load->view('ht_train_order_info',$list); $this->load->view('bootstrap3/footer'); diff --git a/application/third_party/train/models/BIZ_train_model.php b/application/third_party/train/models/BIZ_train_model.php index 4127eeee..d63a33f2 100644 --- a/application/third_party/train/models/BIZ_train_model.php +++ b/application/third_party/train/models/BIZ_train_model.php @@ -6,7 +6,35 @@ class BIZ_train_model extends CI_Model { parent::__construct(); $this->HT = $this->load->database('HT', TRUE); } - + + //自动获取符合自动出票要求的订单的coli_sn + function auto_check_ticket($topnum=5){ + $sql = "SELECT + top $topnum COLI_SN + FROM + BIZ_ConfirmLineInfo + WHERE + COLI_ServiceType = '2' + AND COLI_State ='62' + AND COLI_WebCode='CHT' + ORDER BY + COLI_SN DESC"; + $query = $this->HT->query($sql); + return $query->result(); + } + + //自动出票成功后更新订单的状态 + function update_ticket_state($coli_id){ + $sql = "UPDATE + BIZ_ConfirmLineInfo + SET + COLI_State = '61' + WHERE + COLI_ID = '$coli_id'"; + $query = $this->HT->query($sql); + return $query; + } + function biz_order_detail($cold_sn) { $sql = " SELECT TOP 1 bfoi.FOI_SN @@ -234,8 +262,7 @@ class BIZ_train_model extends CI_Model { } // 传入coli_sn获取订单号 public function coli_sn_get_coli_id($coli_sn){ - $sql="SELECT COLI_ID FROM BIZ_ConfirmLineInfo WHERE COLI_SN = ? - "; + $sql="SELECT COLI_ID FROM BIZ_ConfirmLineInfo WHERE COLI_SN = ? "; $query = $this->HT->query($sql,array($coli_sn)); return $query->result(); } @@ -250,4 +277,22 @@ class BIZ_train_model extends CI_Model { return $query->result(); } //-----------------------------自动出票 end----------- + + function SendMail($fromName, $fromEmail, $toName, $toEmail, $subject, $body) { + $toName = str_replace("'","''",$toName); + $body = str_replace("'","''",$body); + $sql = "INSERT INTO Email_AutomaticSend + ( + M_ReplyToName, M_ReplyToEmail, M_ToName, M_ToEmail, M_Title, M_Body, M_Web, + M_FromName, M_State + ) + VALUES + ( + ?, ?, N'{$toName}', ?, N'{$subject}', N'{$body}', ?, ?, 0 + ) "; + $query = $this->HT->query($sql, array($fromName, $fromEmail, $toEmail, 'cht', 'information')); + echo $query; + + //return $query; + } } diff --git a/application/third_party/train/models/sendmail_model.php b/application/third_party/train/models/sendmail_model.php new file mode 100644 index 00000000..824f98ee --- /dev/null +++ b/application/third_party/train/models/sendmail_model.php @@ -0,0 +1,80 @@ +HT = $this->load->database('HT', TRUE); + } + + function SendMailToTable($fromName,$fromEmail,$toName,$toEmail,$subject,$body) + { + if($this->validEmail($toEmail)) + { + $data = array( + "M_ReplyToName" => $fromName, //回复人 + "M_ReplyToEmail" => $fromEmail, //回复地址 + "M_ToName" => $toName, //收件人名 + "M_ToEmail" => $toEmail, //收件邮件地址 + "M_Title" => $subject, //主题 + "M_Body" => $body, //邮件正文 + "M_Web" => "CHT", //所属站点 + "M_FromName" => "Chinahighlights.com", //站点名称 + "M_State" => 0, + ); + $this->HT->insert('Email_AutomaticSend',$data); + return TRUE; + }else{ + return FALSE; + } + } + + + public function validEmail($email){ + $isValid = true; + $atIndex = strrpos($email, "@"); + if (is_bool($atIndex) && !$atIndex){ + $isValid = false; + }else{ + $domain = substr($email, $atIndex+1); + $local = substr($email, 0, $atIndex); + $localLen = strlen($local); + $domainLen = strlen($domain); + if ($localLen < 1 || $localLen > 64){ + // local part length exceeded + $isValid = false; + }else if ($domainLen < 1 || $domainLen > 255){ + // domain part length exceeded + $isValid = false; + }else if ($local[0] == '.' || $local[$localLen-1] == '.'){ + // local part starts or ends with '.' + $isValid = false; + }else if (preg_match('/\\.\\./', $local)){ + // local part has two consecutive dots + $isValid = false; + }else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)){ + // character not valid in domain part + $isValid = false; + }else if (preg_match('/\\.\\./', $domain)){ + // domain part has two consecutive dots + $isValid = false; + }else if(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',str_replace("\\\\","",$local))){ + // character not valid in local part unless + // local part is quoted + if (!preg_match('/^"(\\\\"|[^"])+"$/',str_replace("\\\\","",$local))){ + $isValid = false; + } + } + /* + 不检查是否有DNS解析 + if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))){ + // domain not found in DNS + $isValid = false; + } + */ + } + return $isValid; + } + +} \ No newline at end of file diff --git a/application/third_party/train/views/email.php b/application/third_party/train/views/email.php new file mode 100644 index 00000000..66184036 --- /dev/null +++ b/application/third_party/train/views/email.php @@ -0,0 +1,70 @@ + + + + +Dear GUT_LastName?>,
+Thanks for payment US$145 . The train tickets have already been issued.
+You can collect the paper ticket(s) from now at any train station in mainland China.
+Please present all passenger(s) original passport(s) and Ticket Pick Up No.E601014106 at any ticket collecting counters (in Chinese 取票窗口)of any railway stations in mainland China. They will then issue your paper train ticket(s).
+Passenger(s) | +2 adult(s) + + 1. ALEXANDER JAMES JOHNSON , passport number 503406354 |
+
---|
Train 1:
+Ticket Pick Up No. | +E601014106 | +
---|---|
Train No. | +Z19 | +
Departure | +20:40 Jun.06 Beijing Xi (West) Station(in Chinese 北京西火车站) | +
Arrival | +08:31AM Jun.07 Xi'an Station(in Chinese 西安火车站) | +
Class | +Soft Sleeper | +
Kindly note below:
+1. The same passport that was used for booking should also be used for ticket collection. A renewed passport won't be acceptable even if the holder is the same person. The system does not allow us to change passport number or passenger name after issue ticket. Have to issue new ticket if wrong passport number or name.
+2. There is no further fee if collect train ticket(s) at the DEPARTURE station shown on your ticket(s). RMB 5 per ticket will be charged at a ticket counter at other stations. E.g. if you have booked Beijing-Shanghai and Shanghai-Beijing ticket(s), and you collect them all at Beijing, you will be charged RMB 5 per ticket for the Shanghai-Beijing ticket(s), but if you pick up the return leg ticket(s) separately in Shanghai you will avoid the charge.
+ 3. On departure day, please time your arrival wisely. If you are going to collect your tickets on departure day, we suggest you be at the station at least 1.5 hours ahead of the stated departure time to allow for waiting in queue at the ticket-counter, for security checks and for ticket checks.
+If you’ve already collected before the departure day, it is also wise to be at the station at least 40 minutes ahead.
4. Download railway station instructions, maps and tips at http://www.chinahighlights.com/china-trains/station-map.htm
+
+5.Terms & Conditions. http://www.chinahighlights.com/china-trains/booking-policy.htm
Best Regards!
+ Iris Wang, Travel Advisor
+ Tel: +86-773-2801368 Mobile:+86-18775900313
+ Fax: 86-773-2827424, 86-773-2885308
+ E-mail: iris@chinahighlights.me
+ www.chinahighlights.com
+ Address: Building 6, Chuangyi Business Park, 70 Qilidian Road, Guilin, Guangxi, 541004, China
+If you wish to share anything with my supervisor (Ms. Alex Yang), please feel free to send your email to alex@chinahighlights.net.