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,'302 Found')) { - $rank['rank'] = -2; - } - elseif (false !== stripos($response,$site_url)) - { - preg_match_all("/class=\"find\"(.*)<\/a>/smUi",$response, $store); - foreach ($store[1] as $k=>$v) { - $start_s=stripos($v,$site_url); - if (false!==$start_s) { - $rank['rank'] = $startrank+$k+1; - $end_s=strpos($v,'" ',$start_s); - $source = substr($v, $start_s, $end_s); - $sources = explode('" ',$source); - $rank['source']=$sources[0]; - break; - } - } + $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); } } - else - { - $rank['rank'] = -1; - } - return $rank; + var_dump($worldsList[0]->kw_keyworlds, $rank); } //计算关键词在google搜索引擎的排名 - public function get_search_content_by_google($keyworlds,$site_url,$page,$site_code) - { + public function get_search_content_by_google($keyworlds, $site_url, $page, $site_code) { $rank['rank'] = 0; $rank['source'] = $site_url; $rank['engines'] = 'google'; - if ($page>3) { + if ($page > 3) { $rank['rank'] = 151; return $rank; } //拼接关键词 - /*$key_array = explode(' ',$keyworlds); - $search_worlds=''; - foreach ($key_array as $v) { - $search_worlds.='+'.$v; - } - $search_worlds = substr($search_worlds,1);*/ + /* $key_array = explode(' ',$keyworlds); + $search_worlds=''; + foreach ($key_array as $v) { + $search_worlds.='+'.$v; + } + $search_worlds = substr($search_worlds,1); */ $search_worlds = urlencode($keyworlds); - + //拼接搜索url链接 - $start = ($page -1) * 50; + $start = ($page - 1) * 50; $google_url = 'google.com'; $google_domain = array( - 'gm'=>'google.de', - 'vc'=>'google.fr', - 'vac'=>'google.es', - 'ru'=>'google.ru', - 'it'=>'google.it', - 'jp'=>'google.co.jp' - ); - if(!empty($google_domain[$site_code])) $google_url= $google_domain[$site_code]; + 'gm' => 'google.de', + 'vc' => 'google.fr', + 'vac' => 'google.es', + 'ru' => 'google.ru', + 'it' => 'google.it', + 'jp' => 'google.co.jp' + ); + if (!empty($google_domain[$site_code])) + $google_url = $google_domain[$site_code]; //搜索使用的语种,默认是英语 $language = 'en'; - $language_array = array('gm'=>'de','vc'=>'fr','vac'=>'es','ru'=>'ru','it'=>'it','jp'=>'jp'); - if(!empty($language_array[$site_code])) $language = $language_array[$site_code]; + $language_array = array('gm' => 'de', 'vc' => 'fr', 'vac' => 'es', 'ru' => 'ru', 'it' => 'it', 'jp' => 'jp'); + if (!empty($language_array[$site_code])) + $language = $language_array[$site_code]; //抓取google搜索结果 $this->load->library('Snoopy'); $snoopy = $this->snoopy; - $snoopy->maxredirs=0; - $snoopy->agent = '(compatible; MSIE 11; MSN 8; AOL 4.0; Windows 98)';//模拟浏览器 - if($snoopy->fetch("http://www.$google_url/search?q=$search_worlds&start=$start&num=50&hl=$language")) - { + $snoopy->maxredirs = 0; + $snoopy->agent = '(compatible; MSIE 11; MSN 8; AOL 4.0; Windows 98)'; //模拟浏览器 + if ($snoopy->fetch("http://www.$google_url/search?q=$search_worlds&start=$start&num=50&hl=$language")) { $response = $snoopy->results; //分析google搜索结果,计算排名 - if (false !== stripos($response,'

302 Moved

')) { + if (false !== stripos($response, '

302 Moved

')) { $rank['rank'] = -2; - }elseif (false !== stripos($response,$site_url)) { - preg_match_all('/

(.*)<\/h3>/smUi',$response, $store); - foreach ($store[1] as $k=>$v) { - $ismatch = stripos($v,$site_url); + } elseif (false !== stripos($response, $site_url)) { + preg_match_all('/

(.*)<\/h3>/smUi', $response, $store); + foreach ($store[1] as $k => $v) { + $ismatch = stripos($v, $site_url); if (false !== $ismatch) { //计算排名 - $rank['rank'] = $start+$k+1; + $rank['rank'] = $start + $k + 1; //抓取关键词来源 - $end=stripos($v,'&',$ismatch); - $source = substr($v,$ismatch,$end); - $source = explode('&',$source); + $end = stripos($v, '&', $ismatch); + $source = substr($v, $ismatch, $end); + $source = explode('&', $source); $rank['source'] = $source[0]; break; } } } - } - else - { + } else { $rank['rank'] = -1; } return $rank; } - public function test(){ - $ranks=$this->get_search_content_by_yandex('Путеводитель по городу гуйлинь','www.chinahighlights.ru'); + public function test() { + $ranks = $this->get_search_content_by_yandex('Путеводитель по городу гуйлинь', 'www.chinahighlights.ru'); var_dump($ranks); } //计算关键词在yandex搜索引擎的排名 - public function get_search_content_by_yandex($keyworlds,$site_url,$page=0,$sitecode=false) - { + public function get_search_content_by_yandex($keyworlds, $site_url, $page = 0, $sitecode = false) { $rank['rank'] = 0; $rank['source'] = $site_url; $rank['engines'] = 'yandex'; - $startrank = $page*10; + $startrank = $page * 10; $search_worlds = urlencode($keyworlds); //抓取搜索结果数据 @@ -514,188 +424,123 @@ class Keyworlds extends CI_Controller $snoopy->host = 'yandex.ru'; $snoopy->referer = "http://www.yandex.ru/"; //$snoopy->maxredirs=0; - $snoopy->agent ='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0'; + $snoopy->agent = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0'; //$snoopy->agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36';//模拟浏览器 - if($snoopy->fetch("http://www.yandex.ru/yandsearch?p=$page&text=$search_worlds&lr=21436")) - { + if ($snoopy->fetch("http://www.yandex.ru/yandsearch?p=$page&text=$search_worlds&lr=21436")) { $response = $snoopy->results; //分析YANDEX搜索结果,计算排名 - if (false !== stripos($response,'

302 Found

')) { + if (false !== stripos($response, '

302 Found

')) { $rank['rank'] = -2; - }elseif (false !== stripos($response,$site_url)) { - preg_match_all("/(.*)<\/a>/smUi",$response, $store); - foreach ($store[1] as $k=>$v) { - $start_s=stripos($v,$site_url); - if (false!==$start_s) { - $rank['rank'] = $startrank+$k+1; - $end_s=stripos($v,'" ',$start_s); + } elseif (false !== stripos($response, $site_url)) { + preg_match_all("/(.*)<\/a>/smUi", $response, $store); + foreach ($store[1] as $k => $v) { + $start_s = stripos($v, $site_url); + if (false !== $start_s) { + $rank['rank'] = $startrank + $k + 1; + $end_s = stripos($v, '" ', $start_s); $source = substr($v, $start_s, $end_s); - $sources = explode('" ',$source); - $rank['source']=$sources[0]; + $sources = explode('" ', $source); + $rank['source'] = $sources[0]; break; } } } - } - else - { + } else { $rank['rank'] = -1; } return $rank; } //计算关键词在google搜索引擎的排名 - public function get_search_content_by_yahoo($keyworlds,$site_url,$page=1,$sitecode=false) - { + public function get_search_content_by_yahoo($keyworlds, $site_url, $page = 1, $sitecode = false) { $rank['rank'] = 0; $rank['source'] = $site_url; $site_url_array = explode('//', $site_url); $site_url = $site_url_array[1]; $rank['engines'] = 'yahoo'; - if ($page>3) { + if ($page > 3) { $rank['rank'] = 151; return $rank; } //拼接关键词 - /*$key_array = explode(' ',$keyworlds); - $search_worlds=''; - foreach ($key_array as $v) { - $search_worlds.='+'.$v; - } - $search_worlds = substr($search_worlds,1);*/ + /* $key_array = explode(' ',$keyworlds); + $search_worlds=''; + foreach ($key_array as $v) { + $search_worlds.='+'.$v; + } + $search_worlds = substr($search_worlds,1); */ $search_worlds = urlencode($keyworlds); - $yahoourl='http://search.yahoo.com'; - if($sitecode=='jp') $yahoourl='http://search.yahoo.co.jp'; + $yahoourl = 'http://search.yahoo.com'; + if ($sitecode == 'jp') + $yahoourl = 'http://search.yahoo.co.jp'; - $start = ($page -1) * 50+1; - $pstart = $page+4; + $start = ($page - 1) * 50 + 1; + $pstart = $page + 4; //抓取yahoo搜索结果 $this->load->library('Snoopy'); $snoopy = $this->snoopy; - $snoopy->maxredirs=0; - $snoopy->agent = '(compatible; MSIE 9; MSN 8; AOL 4.0; Windows 98)';//模拟浏览器 - if($snoopy->fetch("$yahoourl/search;_ylt=A0SO8yDYHxBT6xQAWAFXNyoA?p=$search_worlds&n=100&ei=UTF-8&va_vt=any&vo_vt=any&ve_vt=any&vp_vt=any&vst=0&vf=all&vm=i&fl=0&fr=sfp&b=$start&pstart=$pstart")) - { + $snoopy->maxredirs = 0; + $snoopy->agent = '(compatible; MSIE 9; MSN 8; AOL 4.0; Windows 98)'; //模拟浏览器 + if ($snoopy->fetch("$yahoourl/search;_ylt=A0SO8yDYHxBT6xQAWAFXNyoA?p=$search_worlds&n=100&ei=UTF-8&va_vt=any&vo_vt=any&ve_vt=any&vp_vt=any&vst=0&vf=all&vm=i&fl=0&fr=sfp&b=$start&pstart=$pstart")) { $response = $snoopy->results; //分析yahoo搜索结果,计算排名 //出现被屏蔽情况 - if(false !== stripos($response,'document has moved')){ + if (false !== stripos($response, 'document has moved')) { $rank['rank'] = -2; - }else{ - preg_match_all('/
(.*)<\/ol>/smUi',$response, $search_c); - if (false !== stripos($search_c[0][0],$site_url)) { - preg_match_all('/
  • /smUi',$search_c[0][0], $store); - foreach ($store[1] as $k=>$v) { - $ismatch = stripos($v,$site_url); + } else { + preg_match_all('/
    (.*)<\/ol>/smUi', $response, $search_c); + if (false !== stripos($search_c[0][0], $site_url)) { + preg_match_all('/
  • /smUi', $search_c[0][0], $store); + foreach ($store[1] as $k => $v) { + $ismatch = stripos($v, $site_url); if (false !== $ismatch) { //计算排名 - $rank['rank'] = $start+$k+1; + $rank['rank'] = $start + $k + 1; //抓取关键词来源 - $end=stripos($v,'">',$ismatch); - $source = substr($v,$ismatch,$end); - $source = explode('">',$source); - $rank['source'] = 'http://'.$source[0]; + $end = stripos($v, '">', $ismatch); + $source = substr($v, $ismatch, $end); + $source = explode('">', $source); + $rank['source'] = 'http://' . $source[0]; break; } } } } - } - else - { + } else { $rank['rank'] = -1; } return($rank); } - //计算关键词在百度搜索引擎的排名 - public function get_search_content_by_baidu($keyworlds,$site_url='www.guilincits.com',$page=1,$sitecode=false) - { - $rank['rank'] = 0; - $rank['source'] = $site_url; - $rank['engines'] = 'baidu'; - if ($page>3) { - $rank['rank'] = 151; - return $rank; - } - - //拼接关键词 - $key_array = explode(' ',$keyworlds); - $search_worlds=''; - foreach ($key_array as $v) { - $search_worlds.='+'.$v; - } - $search_worlds = substr($search_worlds,1); - $start = ($page -1) * 50; - - //抓取百度搜索结果 - $this->load->library('Snoopy'); - $snoopy = $this->snoopy; - $snoopy->maxredirs=0; - $snoopy->agent = '(compatible; MSIE 9; MSN 8; AOL 4.0; Windows 98)';//模拟浏览器 - if($snoopy->fetch("http://www.baidu.com/s?wd=$search_worlds&pn=$start&rn=50&ie=utf-8")) - { - $response = $snoopy->results; - if (false !== stripos($response,$site_url)) { - preg_match_all('/result c-container(.*)
    $v) { - if (false !== stripos($v,$site_url)) { - //计算排名 - $rank['rank'] = $start+$k+1; - //抓取关键词来源 - preg_match_all('/url=(.*)\"/smUi',$v, $source_array); - $rank_source = 'http://www.baidu.com/link?url='.$source_array[1][0]; - $rank['source']=$rank_source; - $ch = curl_init(); - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); - curl_setopt($ch, CURLOPT_NOBODY, 1); // 输出中包含body部分 - curl_setopt($ch, CURLOPT_TIMEOUT, 30); // 设置超时防止死循环 - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);// 使用自动跳转 - curl_setopt($ch, CURLOPT_URL,$rank_source); // 想要获取内容的url - curl_exec ($ch); - $rank_source=curl_getinfo($ch); - $rank['source']=$rank_source['redirect_url']; - curl_close ($ch); - break; - } - } - } - } - else - { - $rank['rank'] = -1; - } - return $rank; - } - //返回指定页面路径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'); + $startdate = $this->input->post('startdate'); + $enddate = $this->input->post('enddate'); + $pagepath = $this->input->post('pagepath'); //如果开始时间为空则把开始时间设为往前七天 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->analytics_model->get_analytics_list($pagepath,50,$startdate,$enddate); - $total_visit['pv'] = $total_visit['uv']=$total_visit['agv_time']=$total_visit['entrances']=0; - $analytics_count=0; + $data['analytics_list'] = $this->analytics_model->get_analytics_list($pagepath, 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; @@ -704,35 +549,35 @@ class Keyworlds 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; + $data['loadtotal'] = $loadtotal; - $this->load->view('keyworlds/analytics',$data); + $this->load->view('keyworlds/analytics', $data); } //从google分析接口获取数据并入库,$start_index:从接口提取数据时的起始条数 - public function get_google_analytics_data($sitecode='cht',$start_index=1){ + public function get_google_analytics_data($sitecode = 'cht', $start_index = 1) { session_start(); //判断该站点是否已经更新. $update_count = $this->analytics_model->get_update_count($sitecode); $update_count; $flag = false; - switch ($sitecode) - { - case 'cht': - case 'jp': - case 'ct': - //对于以上三个站点如果数据库中存在的数量大于当前起始数,则表示该站点已经更新 - if ($update_count>$start_index) $flag = true; - break; - default: - //对于其他站点如果数据库中存在的数量大于0,则表示该站点已经更新 - if ($update_count>0) { - $flag = true; - } + switch ($sitecode) { + case 'cht': + case 'jp': + case 'ct': + //对于以上三个站点如果数据库中存在的数量大于当前起始数,则表示该站点已经更新 + if ($update_count > $start_index) + $flag = true; + break; + default: + //对于其他站点如果数据库中存在的数量大于0,则表示该站点已经更新 + if ($update_count > 0) { + $flag = true; + } } //如果站点已经更新,则放弃从google分析抓取数据 if ($flag) { @@ -740,17 +585,16 @@ class Keyworlds extends CI_Controller exit(); } //初始化Google_Client - require_once APPPATH.'libraries/Google_Client/Google_Client.php'; - require_once APPPATH.'libraries/Google_Client/contrib/Google_AnalyticsService.php'; + require_once APPPATH . 'libraries/Google_Client/Google_Client.php'; + require_once APPPATH . 'libraries/Google_Client/contrib/Google_AnalyticsService.php'; $baseurl = site_url("Keyworlds/get_google_analytics_data/"); $revokeUrl = $baseurl . '?action=revoke'; //google分析接口过滤条件 - $site_config=array('cht'=>5120,'gm'=>6028186,'vc'=>68571571,'vac'=>68484932,'ru'=>68577400,'it'=>68564185,'jp'=>574459,'tbt'=>715050,'sht'=>4705635,'yz'=>68484504,'gl'=>68460695,'mbj'=>68479244,'ct'=>8567691); + $site_config = array('cht' => 5120, 'gm' => 6028186, 'vc' => 68571571, 'vac' => 68484932, 'ru' => 68577400, 'it' => 68564185, 'jp' => 574459, 'tbt' => 715050, 'sht' => 4705635, 'yz' => 68484504, 'gl' => 68460695, 'mbj' => 68479244, 'ct' => 8567691); $profileId = $site_config[$sitecode]; //网站标志ID - $analytics_start_time = date('Y-m-d',time()-7*24*60*60); //获取数据的开始时间 - $analytics_end_time = date('Y-m-d',time()); //获取数据的结束时间 - + $analytics_start_time = date('Y-m-d', time() - 7 * 24 * 60 * 60); //获取数据的开始时间 + $analytics_end_time = date('Y-m-d', time()); //获取数据的结束时间 //授权设置 $client = new Google_Client(); $client->setClientId('50804699713-l5sfpffqpo4kbrbhk9tf53049labr214.apps.googleusercontent.com'); @@ -775,7 +619,7 @@ class Keyworlds extends CI_Controller if (isset($_SESSION['access_token'])) { $accessToken = $_SESSION['access_token']; $client->setAccessToken($accessToken); - }else{ + } else { //授权过期重新生成access_token $client->refreshToken('1/ZX7Qo-m_rxIL1_LqE8vM2sYKATkAJxm0Fc5g7BRXeo0'); $_SESSION['access_token'] = $client->getAccessToken(); @@ -784,222 +628,206 @@ class Keyworlds extends CI_Controller } //获取数据 - if ($client->getAccessToken()) - { + if ($client->getAccessToken()) { $analytics = new Google_AnalyticsService($client); //获取详细信息 $results = $analytics->data_ga->get( - 'ga:' . $profileId, - $analytics_start_time, - $analytics_end_time, - 'ga:visits', - array( - 'dimensions' => 'ga:pagePath,ga:source,ga:keyword', - 'metrics' => 'ga:pageviews,ga:uniquePageviews,ga:avgTimeOnPage,ga:entrances,ga:exitRate,ga:pageValue', - 'sort' => '-ga:pageviews', - 'max-results' => '10000', - 'start-index'=>$start_index - ) - ); + 'ga:' . $profileId, $analytics_start_time, $analytics_end_time, 'ga:visits', array( + 'dimensions' => 'ga:pagePath,ga:source,ga:keyword', + 'metrics' => 'ga:pageviews,ga:uniquePageviews,ga:avgTimeOnPage,ga:entrances,ga:exitRate,ga:pageValue', + 'sort' => '-ga:pageviews', + 'max-results' => '10000', + 'start-index' => $start_index + ) + ); } $_SESSION['access_token'] = $client->getAccessToken(); - $columnheader=array('pagepath','source','keyword','pv','uv','avgtimeonpage','entrances','exitrate','pageValue'); - $output=array(); - $txt=''; - foreach ($results->getRows() as $row) - { - foreach ($row as $i=>$cell) { - $table[$columnheader[$i]] = htmlspecialchars($cell, ENT_NOQUOTES); + $columnheader = array('pagepath', 'source', 'keyword', 'pv', 'uv', 'avgtimeonpage', 'entrances', 'exitrate', 'pageValue'); + $output = array(); + $txt = ''; + foreach ($results->getRows() as $row) { + foreach ($row as $i => $cell) { + $table[$columnheader[$i]] = htmlspecialchars($cell, ENT_NOQUOTES); } - $txt.=$table['source'].'|@|'.$table['pv'].'|@|'.$table['uv'].'|@|'.$table['avgtimeonpage'].'|@|'.$table['entrances'].'|@|'.$table['exitrate'].'|@|'.$table['pageValue'].'|@|'.time().'|@|'.$sitecode.'|@|'.$table['pagepath'].'|@|'.substr($table['keyword'],0,255)."\r\n"; - $output[]=$table; + $txt.=$table['source'] . '|@|' . $table['pv'] . '|@|' . $table['uv'] . '|@|' . $table['avgtimeonpage'] . '|@|' . $table['entrances'] . '|@|' . $table['exitrate'] . '|@|' . $table['pageValue'] . '|@|' . time() . '|@|' . $sitecode . '|@|' . $table['pagepath'] . '|@|' . substr($table['keyword'], 0, 255) . "\r\n"; + $output[] = $table; unset($table); } - $fp=fopen(APPPATH.'helpers/analytics_data.txt','wb'); - fwrite ($fp,$txt); + $fp = fopen(APPPATH . 'helpers/analytics_data.txt', 'wb'); + fwrite($fp, $txt); fclose($fp); $this->analytics_model->add_analytics_by_txt(); echo $sitecode; } //从cvs文件导入关键词 - public function hand_add($parentid,$bookname) - { - $row = 1;//第一行开始 - $filename = APPPATH.$bookname.'.csv'; - if(($handle = fopen($filename, "r")) !== false) - { - while(($dataSrc = fgetcsv($handle)) !== false) - { + public function hand_add($parentid, $bookname) { + $row = 1; //第一行开始 + $filename = APPPATH . $bookname . '.csv'; + if (($handle = fopen($filename, "r")) !== false) { + while (($dataSrc = fgetcsv($handle)) !== false) { $num = count($dataSrc); - for ($c=0; $c < $num; $c++)//列 column - { - if($row === 1)//第一行作为字段 - { - $dataName[] = $dataSrc[$c];//字段名称 - } - else - { - foreach ($dataName as $k=>$v) - { - if($k == $c)//对应的字段 - { - $dataRtn[$v] = @iconv('GBK','UTF-8',$dataSrc[$c]); + for ($c = 0; $c < $num; $c++) {//列 column + if ($row === 1) {//第一行作为字段 + $dataName[] = $dataSrc[$c]; //字段名称 + } else { + foreach ($dataName as $k => $v) { + if ($k == $c) {//对应的字段 + $dataRtn[$v] = @iconv('GBK', 'UTF-8', $dataSrc[$c]); } } } } if (!empty($dataRtn)) { $insert_id = $this->InfoStructures_model->Add($parentid); - if ($insert_id && $kw_id=$this->Keywords_model->add_keyworlds($dataRtn['keyword'],$dataRtn['site'],time()-24*60*60,$insert_id,1)){ + if ($insert_id && $kw_id = $this->Keywords_model->add_keyworlds($dataRtn['keyword'], $dataRtn['site'], time() - 24 * 60 * 60, $insert_id, 1)) { $datas[] = array('name' => 'ok', 'value' => $this->Keywords_model->get_keyworld($kw_id)); - }else{ + } else { $datas[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error')); } echo $insert_id; - $data[]=$dataRtn; + $data[] = $dataRtn; } $row++; } fclose($handle); - var_dump($data); + var_dump($data); echo 'ok'; - } + } } //收录查询结果 - public function check_embody(){ + public function check_embody() { $this->load->model('InfoMetas_model'); $this->load->model('InfoSMS_model'); //获取未收录的数据 - $today_date=date('Y-m-d',time()-3*24*60*60); - $embody=$this->InfoMetas_model->get_unembody_content($today_date); + $today_date = date('Y-m-d', time() - 3 * 24 * 60 * 60); + $embody = $this->InfoMetas_model->get_unembody_content($today_date); if (empty($embody)) { return false; } //页面url - $embody=$embody[0]; - if($embody->ic_url=='') return false; - $site=$this->config->item('site'); - $site_url=$site[$embody->ic_sitecode]['site_url']; - $site_url=$site_url.$embody->ic_url; + $embody = $embody[0]; + if ($embody->ic_url == '') + return false; + $site = $this->config->item('site'); + $site_url = $site[$embody->ic_sitecode]['site_url']; + $site_url = $site_url . $embody->ic_url; //收录查询搜索url - $search_worlds ='site:'.$site_url; + $search_worlds = 'site:' . $site_url; $search_worlds; $google_url = 'google.com'; $language = 'en'; - $language_array = array('gm'=>'de','vc'=>'fr','vac'=>'es','ru'=>'ru','it'=>'it','jp'=>'jp'); - if(!empty($language_array[$embody->ic_sitecode])) $language = $language_array[$embody->ic_sitecode]; + $language_array = array('gm' => 'de', 'vc' => 'fr', 'vac' => 'es', 'ru' => 'ru', 'it' => 'it', 'jp' => 'jp'); + if (!empty($language_array[$embody->ic_sitecode])) + $language = $language_array[$embody->ic_sitecode]; //抓取google搜索结果 $this->load->library('Snoopy'); $snoopy = $this->snoopy; - $snoopy->maxredirs=0; - $snoopy->agent = '(compatible; MSIE 9; MSN 8; AOL 4.0; Windows 98)';//模拟浏览器 - if($snoopy->fetch("http://www.$google_url/search?q=$search_worlds&start=0&num=10&hl=$language")) - { + $snoopy->maxredirs = 0; + $snoopy->agent = '(compatible; MSIE 9; MSN 8; AOL 4.0; Windows 98)'; //模拟浏览器 + if ($snoopy->fetch("http://www.$google_url/search?q=$search_worlds&start=0&num=10&hl=$language")) { $response = $snoopy->results; - if (false !== stripos($response,'

    302 Moved

    ')) { + if (false !== stripos($response, '

    302 Moved

    ')) { echo 302; return false; } - preg_match_all('/

    (.*)<\/h3>/smUi',$response, $store); - if (isset($store[1][0]) && false !== stripos($store[1][0],$site_url)) { - $ismatch = stripos($store[1][0],$site_url); - $end=stripos($store[1][0],'&',$ismatch); - $source = substr($store[1][0],$ismatch,$end); - $source = explode('&',$source); + preg_match_all('/

    (.*)<\/h3>/smUi', $response, $store); + if (isset($store[1][0]) && false !== stripos($store[1][0], $site_url)) { + $ismatch = stripos($store[1][0], $site_url); + $end = stripos($store[1][0], '&', $ismatch); + $source = substr($store[1][0], $ismatch, $end); + $source = explode('&', $source); $source = $source[0]; - if ($source==$site_url) { - $this->InfoMetas_model->update($embody->im_ic_id,'meta_embody','1'); - $this->InfoSMS_model->add('info',$embody->im_ic_id,$embody->ic_author,'lyy','已收录'); + if ($source == $site_url) { + $this->InfoMetas_model->update($embody->im_ic_id, 'meta_embody', '1'); + $this->InfoSMS_model->add('info', $embody->im_ic_id, $embody->ic_author, 'lyy', '已收录'); echo 'ok'; - }else{ - $this->InfoMetas_model->update($embody->im_ic_id,'meta_embody',date('Y-m-d H:i:s')); - $this->InfoSMS_model->add('info',$embody->im_ic_id,$embody->ic_author,'lyy','未被收录'); + } else { + $this->InfoMetas_model->update($embody->im_ic_id, 'meta_embody', date('Y-m-d H:i:s')); + $this->InfoSMS_model->add('info', $embody->im_ic_id, $embody->ic_author, 'lyy', '未被收录'); echo 'no'; } - }else{ - $this->InfoMetas_model->update($embody->im_ic_id,'meta_embody',date('Y-m-d H:i:s')); - $this->InfoSMS_model->add('info',$embody->im_ic_id,$embody->ic_author,'lyy','未被收录'); + } else { + $this->InfoMetas_model->update($embody->im_ic_id, 'meta_embody', date('Y-m-d H:i:s')); + $this->InfoSMS_model->add('info', $embody->im_ic_id, $embody->ic_author, 'lyy', '未被收录'); echo 'no'; } } echo '
    end'; } - + //定时批量更新CDN - public function update_cdn() - { + public function update_cdn() { $this->load->model('Logs_model'); - $last_update=$this->Logs_model->get_last_cdn_update_info(); + $last_update = $this->Logs_model->get_last_cdn_update_info(); if (empty($last_update)) { - $last_log=$this->Logs_model->get_last_log(); - $this->Logs_model->write('update_cdn',$last_log->log_id); - $last_update->log_res_id=$last_log->log_id; + $last_log = $this->Logs_model->get_last_log(); + $this->Logs_model->write('update_cdn', $last_log->log_id); + $last_update->log_res_id = $last_log->log_id; } - $last_update_id=$last_update->log_res_id; - $list=$this->Logs_model->get_uncdn_list($last_update_id); + $last_update_id = $last_update->log_res_id; + $list = $this->Logs_model->get_uncdn_list($last_update_id); if (empty($list)) { echo 'updated'; die(); } //设置需要更新的url路径 - $site_path=array(); - $path_array=array(); - $site_array=array('vac','ru','it');//需要更新的站点 + $site_path = array(); + $path_array = array(); + $site_array = array('vac', 'ru', 'it'); //需要更新的站点 foreach ($list as $v) { if (in_array($v->is_sitecode, $site_array)) { - if(!isset($site_path[$v->is_sitecode])){ - $site_path[$v->is_sitecode]=''; - $path_array[$v->is_sitecode]=array(); + if (!isset($site_path[$v->is_sitecode])) { + $site_path[$v->is_sitecode] = ''; + $path_array[$v->is_sitecode] = array(); } if (!in_array($v->ic_url, $path_array[$v->is_sitecode])) { - $site_path[$v->is_sitecode].="&path=".$v->ic_url; - $path_array[$v->is_sitecode][]=$v->ic_url; + $site_path[$v->is_sitecode].="&path=" . $v->ic_url; + $path_array[$v->is_sitecode][] = $v->ic_url; } } } //已经给是最新的了 - if(empty($site_path)) { + if (empty($site_path)) { echo 'updated.'; die(); } //更新CDN缓存 - $notice=array(); - $flag=false; - $siteconfig=$this->config->item('site'); + $notice = array(); + $flag = false; + $siteconfig = $this->config->item('site'); foreach ($site_path as $k => $cdn) { - $pad = str_replace('http://','',$siteconfig[$k]['site_url']); - $result = file_get_contents('https://openapi.us.cdnetworks.com/purge/rest/doPurge?user=ycc@chinahighlights.com&pass=cXi2UbsTrw9Urv&pad='.$pad.'&type=item'.$cdn.'&output=json') ; - $result = json_decode($result,true); - if($result['resultCode'] != 200) { - $notice[] = $k.':'.$result['notice'].$result['details']; - }else { - $notice[]=$k.':'.$result['resultCode'].'
    '.$cdn; - $flag=TRUE; + $pad = str_replace('http://', '', $siteconfig[$k]['site_url']); + $result = file_get_contents('https://openapi.us.cdnetworks.com/purge/rest/doPurge?user=ycc@chinahighlights.com&pass=cXi2UbsTrw9Urv&pad=' . $pad . '&type=item' . $cdn . '&output=json'); + $result = json_decode($result, true); + if ($result['resultCode'] != 200) { + $notice[] = $k . ':' . $result['notice'] . $result['details']; + } else { + $notice[] = $k . ':' . $result['resultCode'] . '
    ' . $cdn; + $flag = TRUE; } } //修改最近更新的信息的log_id,方便下次更新读取数据 if ($flag) { - $lastinfo=end($list); - $this->Logs_model->update('update_cdn',$lastinfo->log_id); + $lastinfo = end($list); + $this->Logs_model->update('update_cdn', $lastinfo->log_id); } var_dump($notice); } - public function mobile_friendly_test() - { + public function mobile_friendly_test() { set_time_limit(60); - $url=$this->input->post('pageurl'); - $googleapis='https://www.googleapis.com/pagespeedonline/v3beta1/mobileReady?url='.$url; - + $url = $this->input->post('pageurl'); + $googleapis = 'https://www.googleapis.com/pagespeedonline/v3beta1/mobileReady?url=' . $url; + $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22'); @@ -1011,28 +839,28 @@ class Keyworlds extends CI_Controller curl_setopt($ch, CURLOPT_URL, $googleapis); $response2 = curl_exec($ch); $response = json_decode($response2); - - $data['pageurl']=$url; - $data['score']=60; - $data['pass']=false; - isset($response->ruleGroups->USABILITY->score) && $data['score']=$response->ruleGroups->USABILITY->score; - isset($response->ruleGroups->USABILITY->pass) && $data['pass']=$response->ruleGroups->USABILITY->pass; + + $data['pageurl'] = $url; + $data['score'] = 60; + $data['pass'] = false; + isset($response->ruleGroups->USABILITY->score) && $data['score'] = $response->ruleGroups->USABILITY->score; + isset($response->ruleGroups->USABILITY->pass) && $data['pass'] = $response->ruleGroups->USABILITY->pass; if (empty($response2)) { - $pass_text='请求超时'; - $title='请求超时,请稍后再试!'; - $link_color='text-error'; - $data['score']='-'; - } - elseif ($data['pass']) { - $pass_text='OK'; - $link_color='text-info'; - $title='Awesome! This page is mobile-friendly (友好度'.$data['score'].', 总分100分)'; - }else{ - $pass_text='No'; - $title='Not mobile-friendly (友好度'.$data['score'].', 总分100分)'; - $link_color='text-error'; - } - $html=''.$pass_text.',友好度:'.$data['score'].''; + $pass_text = '请求超时'; + $title = '请求超时,请稍后再试!'; + $link_color = 'text-error'; + $data['score'] = '-'; + } elseif ($data['pass']) { + $pass_text = 'OK'; + $link_color = 'text-info'; + $title = 'Awesome! This page is mobile-friendly (友好度' . $data['score'] . ', 总分100分)'; + } else { + $pass_text = 'No'; + $title = 'Not mobile-friendly (友好度' . $data['score'] . ', 总分100分)'; + $link_color = 'text-error'; + } + $html = '' . $pass_text . ',友好度:' . $data['score'] . ''; echo $html; } + } diff --git a/application/controllers/login.php b/application/controllers/login.php index cfae2ef4..9f6c418f 100644 --- a/application/controllers/login.php +++ b/application/controllers/login.php @@ -49,6 +49,9 @@ class Login extends CI_Controller { //站点切换 public function change_site($site_code) { + //来源页面,成功切换站点之后转到原始页面去 ,如果在各编辑界面切换则会导致站点错误,比如ch的文章id=100,切换到gm下就没有id=100,只能切换的某个板块 + // $referer = empty($_SERVER['HTTP_REFERER']) ? false : $_SERVER['HTTP_REFERER']; + $this->permission->is_admin(); $this->load->library('Accesscheck'); @@ -70,7 +73,6 @@ class Login extends CI_Controller { } else { redirect(site_url()); } - return TRUE; } @@ -126,7 +128,7 @@ class Login extends CI_Controller { $this->session->set_userdata('session_site', $site_item); $this->session->set_userdata('session_color', ''); $data[] = array('name' => 'go', 'value' => site_url()); - + echo json_encode($data); return TRUE; } @@ -146,7 +148,7 @@ class Login extends CI_Controller { //用户名和密码不正确,或者没有管理权限 if ($this->session->userdata('session_admin') === false) { - + $data[] = array('name' => 'login_warning', 'value' => $this->lang->line('login_warning')); echo json_encode($data); } diff --git a/application/models/infokeywords_model.php b/application/models/infokeywords_model.php index 79206aaf..c6c216fc 100644 --- a/application/models/infokeywords_model.php +++ b/application/models/infokeywords_model.php @@ -64,7 +64,7 @@ class infoKeywords_model extends CI_Model } //获取关键词列表用于抓取排名 - public function get_keyworld_list($top=1,$engines='') + public function get_keyworld_list($top=1,$engines='',$site_code=false) { $today = strtotime(date('Y-m-d')); $mapsql=""; @@ -79,6 +79,10 @@ class infoKeywords_model extends CI_Model }elseif ($engines=='eu') { $map.=" AND kw_sitecode in ('gm','vc','vac','ru','it','jp') "; } + //只查某个站点,原因是个事业部服务器分开,只需要查询本事业部站点即可 + if(!empty($site_code)){ + $map.=" AND kw_sitecode in ('$site_code') "; + } $sql = "SELECT TOP $top kw_id, kw_keyworlds, kw_is_id, @@ -90,6 +94,7 @@ class infoKeywords_model extends CI_Model ORDER BY newid()"; $query = $this->HT->query($sql); + //print_r($this->HT->queries); $result = $query->result(); return $result; } diff --git a/application/models/infotasks_model.php b/application/models/infotasks_model.php index d60555c9..398c285f 100644 --- a/application/models/infotasks_model.php +++ b/application/models/infotasks_model.php @@ -1,320 +1,286 @@ HT = $this->load->database('HT', TRUE); } - - function init() - { - $this->top_num=false; - $this->t_id=false; - $this->order_by=" ORDER BY t.t_id DESC "; - $this->t_status=false; - $this->t_a_id=false; - $this->t_td_type=false; - $this->t_title = false; + + function init() { + $this->top_num = false; + $this->t_id = false; + $this->order_by = " ORDER BY t.t_id DESC "; + $this->t_status = false; + $this->t_a_id = false; + $this->t_td_type = false; + $this->t_title = false; + } + + //正在编辑的任务 + function in_edit($t_ht_op_code = false) { + $this->init(); + if (!empty($t_ht_op_code)) { + if (is_numeric($t_ht_op_code)) { + $this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code); + } else { + $this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code); + } + } + $this->t_status = " AND t.t_status= 'edit' "; + return $this->get_list(); + } + + //待审核任务 + function in_review($t_ht_op_code = false) { + $this->init(); + if (!empty($t_ht_op_code)) { + if (is_numeric($t_ht_op_code)) { + $this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code); + } else { + $this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code); + } + } + $this->t_status = " AND t.t_status= 'review' "; + return $this->get_list(); + } + + //待结算任务 + function in_reviewed($t_ht_op_code = false, $t_a_id = false, $t_td_type = false, $start_date = false, $end_date = false) { + $this->init(); + if (!empty($t_ht_op_code)) { + if (is_numeric($t_ht_op_code)) { + $this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code); + } else { + $this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code); + } + } + if ($t_a_id) + $this->t_a_id = " AND t.t_a_id = $t_a_id "; + if ($t_td_type) + $this->t_td_type = " AND t.t_td_type = '$t_td_type' "; + $this->t_status = " AND t.t_status = 'reviewed' "; + if ($start_date) + $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' "; + return $this->get_list(); + } + + //已完成任务 + function in_complete($t_ht_op_code = false) { + $this->init(); + if (!empty($t_ht_op_code)) { + if (is_numeric($t_ht_op_code)) { + $this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code); + } else { + $this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code); + } + } + $this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published')"; + return $this->get_list(); + } + + //待审核投稿 + function in_wait($t_ht_op_code = false) { + $this->init(); + if (!empty($t_ht_op_code)) { + if (is_numeric($t_ht_op_code)) { + $this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code); + } else { + $this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code); + } + } + $this->t_status = " AND t.t_status= 'wait' "; + return $this->get_list(); + } + + //大厅任务 + function in_hall() { + $this->init(); + $this->t_a_id = " AND t.t_a_id= 0 "; + return $this->get_list(); + } + + //获取单个任务详细信息 + function detail($t_id) { + $this->init(); + $this->top_num = 1; + $this->t_id = " AND t.t_id=" . $this->HT->escape($t_id); + return $this->get_list(); } - - //正在编辑的任务 - function in_edit($t_ht_op_code=false) - { - $this->init(); - if(!empty($t_ht_op_code)) - { - if(is_numeric($t_ht_op_code)) - { - $this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); - } - else - { - $this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); - } - } - $this->t_status=" AND t.t_status= 'edit' "; - return $this->get_list(); - } - - //待审核任务 - function in_review($t_ht_op_code=false) - { - $this->init(); - if(!empty($t_ht_op_code)) - { - if(is_numeric($t_ht_op_code)) - { - $this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); - } - else - { - $this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); - } - } - $this->t_status=" AND t.t_status= 'review' "; - return $this->get_list(); - } - - //待结算任务 - function in_reviewed($t_ht_op_code=false,$t_a_id=false,$t_td_type=false,$start_date=false,$end_date=false) - { - $this->init(); - if(!empty($t_ht_op_code)) - { - if(is_numeric($t_ht_op_code)) - { - $this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); - } - else - { - $this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); - } - } - if($t_a_id)$this->t_a_id=" AND t.t_a_id = $t_a_id "; - if($t_td_type)$this->t_td_type=" AND t.t_td_type = '$t_td_type' "; - $this->t_status=" AND t.t_status = 'reviewed' "; - if($start_date) $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' "; - return $this->get_list(); - } - - //已完成任务 - function in_complete($t_ht_op_code=false) - { - $this->init(); - if(!empty($t_ht_op_code)) - { - if(is_numeric($t_ht_op_code)) - { - $this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); - } - else - { - $this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); - } - } - $this->t_status=" AND (t.t_status= 'complete' OR t.t_status= 'published')"; - return $this->get_list(); - } - //待审核投稿 - function in_wait($t_ht_op_code=false) - { - $this->init(); - if(!empty($t_ht_op_code)) - { - if(is_numeric($t_ht_op_code)) - { - $this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); - } - else - { - $this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); - } - } - $this->t_status=" AND t.t_status= 'wait' "; - return $this->get_list(); - } - - //大厅任务 - function in_hall() - { - $this->init(); - $this->t_a_id=" AND t.t_a_id= 0 "; - return $this->get_list(); - } - - //获取单个任务详细信息 - function detail($t_id) - { - $this->init(); - $this->top_num=1; - $this->t_id=" AND t.t_id=".$this->HT->escape($t_id); - return $this->get_list(); - } - - function get_list($page_flag=false) - { - $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT "; - $sql .= " t.t_id, \n" - . " t.t_title, \n" - . " t.t_content, \n" - . " t.t_status, \n" - . " t.t_a_id, \n" - . " t.t_ht_op_code, \n" - . " t.t_td_type, \n" - . " t.t_expires, \n" - . " t.t_datetime, \n" - . " t.t_rating_total, \n" - . " t.t_active_author, \n" - . " t.t_attach, \n" - . " t.t_rating, \n" - . " t.t_delete \n" - . "FROM infotasks t \n" - . "WHERE t.t_delete = 0 \n"; - if($page_flag)$sql="SELECT t.t_id FROM infotasks t WHERE t.t_delete = 0"; - $this->t_id ? $sql.=$this->t_id : false; - $this->t_status ? $sql.=$this->t_status : false; - $this->t_ht_op_code ? $sql.=$this->t_ht_op_code : false; - $this->t_td_type ? $sql.=$this->t_td_type : false; - $this->t_a_id ? $sql.=$this->t_a_id : false; - $this->t_title ? $sql.=$this->t_title : false; - $this->t_datetime? $sql.=$this->t_datetime : false; - $this->order_by ? $sql.=$this->order_by : false; - $query=$this->HT->query($sql); - if($this->top_num==1) - { - if ($query->num_rows() > 0) - { - $row = $query->row(); - return $row; - } - else - { - return FALSE; - } - } - else - { - return $query->result(); - } - } + function get_list($page_flag = false) { + $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT "; + $sql .= " t.t_id, \n" + . " t.t_title, \n" + . " t.t_content, \n" + . " t.t_status, \n" + . " t.t_a_id, \n" + . " t.t_ht_op_code, \n" + . " t.t_td_type, \n" + . " t.t_expires, \n" + . " t.t_datetime, \n" + . " t.t_rating_total, \n" + . " t.t_active_author, \n" + . " t.t_attach, \n" + . " t.t_rating, \n" + . " t.t_delete \n" + . "FROM infotasks t \n" + . "WHERE t.t_delete = 0 \n"; + if ($page_flag) + $sql = "SELECT t.t_id FROM infotasks t WHERE t.t_delete = 0"; + $this->t_id ? $sql.=$this->t_id : false; + $this->t_status ? $sql.=$this->t_status : false; + $this->t_ht_op_code ? $sql.=$this->t_ht_op_code : false; + $this->t_td_type ? $sql.=$this->t_td_type : false; + $this->t_a_id ? $sql.=$this->t_a_id : false; + $this->t_title ? $sql.=$this->t_title : false; + $this->t_datetime ? $sql.=$this->t_datetime : false; + $site_code = $this->config->item('site_code'); + if ($site_code == 'cht') { //早期的任务没有设置站点,默认是cht + $sql.=" AND ( t.t_sitecode= '$site_code' OR t.t_sitecode is null )"; + } else { + $sql.=" AND t.t_sitecode= '$site_code' "; + } + $this->order_by ? $sql.=$this->order_by : false; + $query = $this->HT->query($sql); + if ($this->top_num == 1) { + if ($query->num_rows() > 0) { + $row = $query->row(); + return $row; + } else { + return FALSE; + } + } else { + return $query->result(); + } + } //写入 - function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires,$t_sitecode='cht') - { - $sql = "INSERT INTO infotasks \n" - . " ( \n" - . " t_title, \n" - . " t_content, \n" - . " t_a_id, \n" - . " t_ht_op_code, \n" - . " t_td_type, \n" - . " t_expires, \n" - . " t_sitecode, \n" - . " t_status, \n" - . " t_delete, \n" - . " t_datetime \n" - . " ) \n" - . "VALUES \n" - . " ( \n" - . " N?,N?,?,?,?,?,?,'edit',0,GETDATE() \n" - . " )"; - $query=$this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires,$t_sitecode)); + function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires, $t_sitecode = 'cht') { + $sql = "INSERT INTO infotasks \n" + . " ( \n" + . " t_title, \n" + . " t_content, \n" + . " t_a_id, \n" + . " t_ht_op_code, \n" + . " t_td_type, \n" + . " t_expires, \n" + . " t_sitecode, \n" + . " t_status, \n" + . " t_delete, \n" + . " t_datetime \n" + . " ) \n" + . "VALUES \n" + . " ( \n" + . " N?,N?,?,?,?,?,?,'edit',0,GETDATE() \n" + . " )"; + $query = $this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires, $t_sitecode)); $this->insert_id = $this->HT->last_id('infotasks'); - return $query; - //print_r($this->HT->queries); + return $query; + //print_r($this->HT->queries); } - + //更新 - function update($t_id,$t_title, $t_content, $t_a_id, $t_td_type, $t_expires) - { - $sql = "UPDATE infotasks \n" - . "SET t_title = N?, \n" - . " t_content = N?, \n" - . " t_a_id = ?, \n" - . " t_td_type = ?, \n" - . " t_expires = ?, \n" - . " t_datetime = GETDATE() \n" - . "WHERE t_id = ?"; - $query=$this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires,$t_id)); - return $query; - //print_r($this->HT->queries); + function update($t_id, $t_title, $t_content, $t_a_id, $t_td_type, $t_expires) { + $sql = "UPDATE infotasks \n" + . "SET t_title = N?, \n" + . " t_content = N?, \n" + . " t_a_id = ?, \n" + . " t_td_type = ?, \n" + . " t_expires = ?, \n" + . " t_datetime = GETDATE() \n" + . "WHERE t_id = ?"; + $query = $this->HT->query($sql, array($t_title, $t_content, $t_a_id, $t_td_type, $t_expires, $t_id)); + return $query; + //print_r($this->HT->queries); + } + + //删除 + function delete($t_id) { + $sql = "UPDATE infotasks \n" + . "SET t_delete = 1 \n" + . "WHERE t_id = ?"; + $query = $this->HT->query($sql, array($t_id)); + return $query; + } + + //审核 + function reviwed($t_id, $t_status, $t_rating = '', $t_rating_total = '') { + $sql = "UPDATE infotasks \n" + . "SET t_status = ?, t_rating=?, t_rating_total=? \n" + . "WHERE t_id = ?"; + $query = $this->HT->query($sql, array($t_status, $t_rating, $t_rating_total, $t_id)); + return $query; + } + + //承接任务 + function undertake($t_id, $a_id) { + $sql = "UPDATE infotasks \n" + . "SET t_a_id = ? \n" + . "WHERE t_id = ?"; + $query = $this->HT->query($sql, array($a_id, $t_id)); + return $query; } - - //删除 - function delete($t_id) - { - $sql = "UPDATE infotasks \n" - . "SET t_delete = 1 \n" - . "WHERE t_id = ?"; - $query=$this->HT->query($sql, array($t_id)); - return $query; - } - - //审核 - function reviwed($t_id,$t_status,$t_rating='',$t_rating_total='') - { - $sql = "UPDATE infotasks \n" - . "SET t_status = ?, t_rating=?, t_rating_total=? \n" - . "WHERE t_id = ?"; - $query=$this->HT->query($sql, array($t_status,$t_rating,$t_rating_total,$t_id)); - return $query; - } - - //承接任务 - function undertake($t_id,$a_id) - { - $sql = "UPDATE infotasks \n" - . "SET t_a_id = ? \n" - . "WHERE t_id = ?"; - $query=$this->HT->query($sql, array($a_id,$t_id)); - return $query; - } - - //取消任务 - function canceltake($t_id) - { - $sql = "UPDATE infotasks \n" - . "SET t_a_id = 0 \n" - . "WHERE t_id = ?"; - $query=$this->HT->query($sql, array($t_id)); - return $query; - } - //根据不同状态获取任务列表 - public function get_tasks_list($t_status=false,$t_ht_op_code=false,$t_a_id=false,$t_td_type=false,$start_date=false,$end_date=false,$tasktitle=false,$page_flag=false) - { - $this->init(); - if(!empty($t_ht_op_code)){ - if(is_numeric($t_ht_op_code)){ - $this->t_a_id=" AND t.t_a_id= ".$this->HT->escape($t_ht_op_code); - }else{ - $this->t_ht_op_code=" AND t.t_ht_op_code=".$this->HT->escape($t_ht_op_code); - } - } - //已发布的和已完成的任务计算在已完成的任务里 - if($t_status=='complete') - { - $this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published') "; - }elseif ($t_status=='edit') { - $this->t_status = " AND (t.t_status= 'edit' OR t.t_status= 'unreviewed') "; - } - else if($t_status) - { - $this->t_status = " AND t.t_status = '$t_status' "; - } - if($t_a_id=='-1'){ - $this->t_a_id = " AND t.t_a_id = '' "; - }elseif ($t_a_id) { - $this->t_a_id = " AND t.t_a_id = $t_a_id "; - } - if($t_td_type) $this->t_td_type = " AND t.t_td_type = '$t_td_type' "; - if($tasktitle) $this->t_title = " AND t.t_title like '%$tasktitle%' "; - if($start_date) $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' "; - return $this->get_list($page_flag); - } + //取消任务 + function canceltake($t_id) { + $sql = "UPDATE infotasks \n" + . "SET t_a_id = 0 \n" + . "WHERE t_id = ?"; + $query = $this->HT->query($sql, array($t_id)); + return $query; + } - //根据给定id字符串获取任务列表 - function get_list_by_taskids($taskids,$order=false) - { - $ordermap=" ORDER BY t.t_datetime DESC "; - if ($order) { - $ordermap=" ORDER BY t.t_rating_total DESC,t.t_datetime DESC "; - } - $sql = "SELECT t.t_id, + //根据不同状态获取任务列表 + public function get_tasks_list($t_status = false, $t_ht_op_code = false, $t_a_id = false, $t_td_type = false, $start_date = false, $end_date = false, $tasktitle = false, $page_flag = false) { + $this->init(); + if (!empty($t_ht_op_code)) { + if (is_numeric($t_ht_op_code)) { + $this->t_a_id = " AND t.t_a_id= " . $this->HT->escape($t_ht_op_code); + } else { + $this->t_ht_op_code = " AND t.t_ht_op_code=" . $this->HT->escape($t_ht_op_code); + } + } + //已发布的和已完成的任务计算在已完成的任务里 + if ($t_status == 'complete') { + $this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published') "; + } elseif ($t_status == 'edit') { + $this->t_status = " AND (t.t_status= 'edit' OR t.t_status= 'unreviewed') "; + } else if ($t_status) { + $this->t_status = " AND t.t_status = '$t_status' "; + } + if ($t_a_id == '-1') { + $this->t_a_id = " AND t.t_a_id = '' "; + } elseif ($t_a_id) { + $this->t_a_id = " AND t.t_a_id = $t_a_id "; + } + if ($t_td_type) + $this->t_td_type = " AND t.t_td_type = '$t_td_type' "; + if ($tasktitle) + $this->t_title = " AND t.t_title like '%$tasktitle%' "; + if ($start_date) + $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' "; + return $this->get_list($page_flag); + } + + //根据给定id字符串获取任务列表 + function get_list_by_taskids($taskids, $order = false) { + $ordermap = " ORDER BY t.t_datetime DESC "; + if ($order) { + $ordermap = " ORDER BY t.t_rating_total DESC,t.t_datetime DESC "; + } + $sql = "SELECT t.t_id, t.t_title, t.t_content, t.t_status, @@ -330,129 +296,143 @@ class Infotasks_model extends CI_Model FROM infotasks t WHERE t.t_id IN ($taskids) $ordermap"; - $query=$this->HT->query($sql); - return $query->result(); - } + $query = $this->HT->query($sql); + return $query->result(); + } - //评选最活跃作者 - function set_active_author($t_id,$t_active_author,$ta_id) - { - //设置活跃作者标识 - $sql = "UPDATE infotasks \n" - . "SET t_active_author = ? \n" - . "WHERE t_id = ?"; - $query=$this->HT->query($sql, array($t_active_author, $t_id)); + //评选最活跃作者 + function set_active_author($t_id, $t_active_author, $ta_id) { + //设置活跃作者标识 + $sql = "UPDATE infotasks \n" + . "SET t_active_author = ? \n" + . "WHERE t_id = ?"; + $query = $this->HT->query($sql, array($t_active_author, $t_id)); //给活跃作者添加奖励 if ($query) { - $sql = "UPDATE infotaskarticles \n" - . "SET ta_charge = ta_charge+150 \n" - . "WHERE ta_id = ?"; - $query2= $this->HT->query($sql,array($ta_id)); - return $query2; - }else{ - return false; + $sql = "UPDATE infotaskarticles \n" + . "SET ta_charge = ta_charge+150 \n" + . "WHERE ta_id = ?"; + $query2 = $this->HT->query($sql, array($ta_id)); + return $query2; + } else { + return false; } } //获取作者总字数排行榜 - public function get_author_count(){ - $sql="SELECT t_id,t_a_id,(SELECT top 1 ta_count FROM infotaskarticles WHERE ta_t_id=t_id order by ta_datetime desc) as ta_count,(SELECT top 1 ta_id FROM infotaskarticles WHERE ta_t_id=t_id order by ta_datetime desc) as ta_id FROM infotasks WHERE t_status = 'reviewed'"; - $query= $this->HT->query($sql); - $result=$query->result(); - $rank=array(); - $rank_author=array(); - $active_author=array(); - foreach ($result as $item) { - if(!isset($rank_author[$item->t_a_id]))$rank_author[$item->t_a_id]=$item; - if(!isset($rank[$item->t_a_id]))$rank[$item->t_a_id]=0; - $rank[$item->t_a_id]+=$item->ta_count; - } - //获取第一名的数据 - arsort($rank); + public function get_author_count() { + $sql = "SELECT t_id,t_a_id,(SELECT top 1 ta_count FROM infotaskarticles WHERE ta_t_id=t_id order by ta_datetime desc) as ta_count,(SELECT top 1 ta_id FROM infotaskarticles WHERE ta_t_id=t_id order by ta_datetime desc) as ta_id FROM infotasks WHERE t_status = 'reviewed'"; + $query = $this->HT->query($sql); + $result = $query->result(); + $rank = array(); + $rank_author = array(); + $active_author = array(); + foreach ($result as $item) { + if (!isset($rank_author[$item->t_a_id])) + $rank_author[$item->t_a_id] = $item; + if (!isset($rank[$item->t_a_id])) + $rank[$item->t_a_id] = 0; + $rank[$item->t_a_id]+=$item->ta_count; + } + //获取第一名的数据 + arsort($rank); foreach ($rank as $key => $v) { - $active_author['author_num']=count($rank); - $active_author['count']=$v; - $active_author['task_id']=$rank_author[$key]->t_id; - $active_author['ta_id']=$rank_author[$key]->ta_id; - $active_author['t_a_id']=$key; + $active_author['author_num'] = count($rank); + $active_author['count'] = $v; + $active_author['task_id'] = $rank_author[$key]->t_id; + $active_author['ta_id'] = $rank_author[$key]->ta_id; + $active_author['t_a_id'] = $key; break; } - return $active_author; + return $active_author; } //查询是否已设置当月活跃作者 - public function is_active_author(){ - $datetime=date('Y-m-01'); - $sql="SELECT TOP 1 t_active_author FROM infotasks WHERE t_active_author>'$datetime'"; - $query=$this->HT->query($sql); - $result=$query->result(); - if (!empty($result)) { - return 1; - } - return 0; + public function is_active_author() { + $datetime = date('Y-m-01'); + $sql = "SELECT TOP 1 t_active_author FROM infotasks WHERE t_active_author>'$datetime'"; + $query = $this->HT->query($sql); + $result = $query->result(); + if (!empty($result)) { + return 1; + } + return 0; } - public function get_tasks_rank($top=5){ - $sql=" SELECT TOP $top * FROM infotasks + public function get_tasks_rank($top = 5) { + $sql = " SELECT TOP $top * FROM infotasks WHERE t_status='reviewed' ORDER BY t_rating_total DESC"; - $query=$this->HT->query($sql); - $result=$query->result(); - return $result; + $query = $this->HT->query($sql); + $result = $query->result(); + return $result; } //获取不同任务状态的任务数量 - public function get_task_count_by_status(){ - $admin_info = $this->session->userdata('session_admin'); - $t_ht_op_code=$admin_info['OPI_Code']; - if(is_numeric($t_ht_op_code)){ - $map=" t_a_id= ".$this->HT->escape($t_ht_op_code); - }else{ - $map=" t_ht_op_code=".$this->HT->escape($t_ht_op_code); - } - $sql="SELECT t_status, count(0) as task_count FROM infotasks WHERE $map AND t_delete=0 group by t_status"; - $query=$this->HT->query($sql); - $result=$query->result(); - $counts=array(); - if (!empty($result)) { - foreach ($result as $v) { - $counts[$v->t_status]=$v->task_count; - } - //已完成数量=完成数量+已发布的数量 - $complete_count=$published_count=0; - if(isset($counts['complete']))$complete_count=$counts['complete']; - if(isset($counts['published']))$published_count=$counts['published']; - $counts['complete']=$complete_count+$published_count; + public function get_task_count_by_status() { + $admin_info = $this->session->userdata('session_admin'); + $t_ht_op_code = $admin_info['OPI_Code']; + if (is_numeric($t_ht_op_code)) { + $where = " t_a_id= " . $this->HT->escape($t_ht_op_code); + } else { + $where = " t_ht_op_code=" . $this->HT->escape($t_ht_op_code); + } + + $site_code = $this->config->item('site_code'); + if ($site_code == 'cht') { //早期的任务没有设置站点,默认是cht + $where.=" AND ( t_sitecode= '$site_code' OR t_sitecode is null )"; + } else { + $where.=" AND t_sitecode= '$site_code' "; + } + + $sql = "SELECT t_status, count(0) as task_count FROM infotasks WHERE $where AND t_delete=0 group by t_status"; + $query = $this->HT->query($sql); + $result = $query->result(); + $counts = array(); + if (!empty($result)) { + foreach ($result as $v) { + $counts[$v->t_status] = $v->task_count; + } + //已完成数量=完成数量+已发布的数量 + $complete_count = $published_count = 0; + if (isset($counts['complete'])) + $complete_count = $counts['complete']; + if (isset($counts['published'])) + $published_count = $counts['published']; + $counts['complete'] = $complete_count + $published_count; - //正在进行中的任务=edit+unreviewed的数量 - $edit_count=$unreviewed_count=0; - if(isset($counts['edit']))$edit_count=$counts['edit']; - if(isset($counts['unreviewed']))$unreviewed_count=$counts['unreviewed']; - $counts['edit']=$edit_count+$unreviewed_count; - return $counts; - } - return false; + //正在进行中的任务=edit+unreviewed的数量 + $edit_count = $unreviewed_count = 0; + if (isset($counts['edit'])) + $edit_count = $counts['edit']; + if (isset($counts['unreviewed'])) + $unreviewed_count = $counts['unreviewed']; + $counts['edit'] = $edit_count + $unreviewed_count; + return $counts; + } + return false; } //判断任务是否已上线 - public function is_in_used($ta_id){ - $sql="SELECT TOP 1 t_status,ic_status + public function is_in_used($ta_id) { + $sql = "SELECT TOP 1 t_status,ic_status FROM infoTaskArticles INNER JOIN infoContents ON ic_id=ta_ic_id LEFT JOIN infotasks ON t_id=ta_t_id WHERE ta_id=?"; - $query=$this->HT->query($sql, array($ta_id)); - $result=$query->result(); - if (empty($result)) { - return 0; - }else{ - $result=$result[0]; - //信息平台和作者平台同时是发布状态时 - if ($result->t_status=='complete' AND $result->ic_status==1) { - return 1; - }else{ - return 0; - } - } - } -} \ No newline at end of file + $query = $this->HT->query($sql, array($ta_id)); + $result = $query->result(); + if (empty($result)) { + return 0; + } else { + $result = $result[0]; + //信息平台和作者平台同时是发布状态时 + if ($result->t_status == 'complete' AND $result->ic_status == 1) { + return 1; + } else { + return 0; + } + } + } + +} diff --git a/application/third_party/order/controllers/_confirm.php b/application/third_party/order/controllers/_confirm.php deleted file mode 100644 index f109a090..00000000 --- a/application/third_party/order/controllers/_confirm.php +++ /dev/null @@ -1,131 +0,0 @@ -load->model('Order_model'); - } - - public function index($COLI_SN,$visitor_link,$token) - { - $data=array(); - if (empty($COLI_SN) || strtoupper(md5($visitor_link))!=strtoupper($token)) { - $this->load->view('link_tips', $data); - return false; - } - - $data['visitor_link']=$visitor_link; - $data['userinfo']=$this->Order_model->get_customer_info($COLI_SN); - $data['username']=''; - if (!empty($data['userinfo'])) { - foreach ($data['userinfo'] as $v) { - if ($v->CUL_IsLinkMan==1) { - $data['username']=$v->MEI_FirstName; - } - } - }else{ - $this->load->view('link_tips', $data); - return false; - } - - $visitor_link_arr=$this->Order_model->get_visitor_link($COLI_SN); - foreach ($visitor_link_arr as $l) { - if ($visitor_link==$l->visitor_link) { - $this->load->view('link_tips', $data); - return false; - } - } - - $this->load->view('confirm_order', $data); - } - - public function save_confirm_info() - { - //客人信息 - $gender=$this->input->post('gender'); - $given_name=$this->input->post('given_name'); - $birthday=$this->input->post('birthday'); - $passport=$this->input->post('passport'); - $expiration_date=$this->input->post('passport_expiration_date'); - $nationality=$this->input->post('nationality'); - $contact_phone='座机:'.$this->input->post('landline').'/手机:'.$this->input->post('mobile'); - $COLI_SN=$this->input->post('COLI_SN'); - $visitor_link=$this->input->post('visitor_link'); - $COLI_ID=$this->input->post('COLI_ID'); - - //已经确认过 - $had_save=$this->Order_model->get_visitor_link($COLI_SN,$visitor_link); - if(!empty($had_save)){ - echo 3; - return; - } - - foreach ($this->input->post('sur_name') as $key => $name) - { - if (!empty($name)) { - if ($this->input->post('home_address')!='') { - $MEI_Street=$this->input->post('home_address'); - }elseif($this->input->post('address_street')){ - $MEI_Street=$this->input->post('address_street').','.$this->input->post('address_city').','.$this->input->post('address_state').','.$this->input->post('address_country'); - }else{ - $MEI_Street=''; - } - $MEI_FirstName=$given_name[$key]; - $MEI_LastName=$name; - - if ($this->input->post('arrive_flight')) { - $CUL_Memo = 'Arrival China Flight No : ' - .$this->input->post('arrive_flight') - .' & Arrival time : ' - .$this->input->post('arrive_time') - .' & Departure China Flight no : ' - .$this->input->post('departure_flight') - .' & Departure time : ' - .$this->input->post('depart_time'); - }else{ - $CUL_Memo=''; - } - - $MEI_Memo=$this->input->post('special_request').' '.$CUL_Memo; - - $birthday[$key]=date('Y-m-d H:i:s',strtotime($birthday[$key])); - $expiration_date[$key]=date('Y-m-d H:i:s',strtotime($expiration_date[$key])); - - $MEI_SN=$this->Order_model->add_customer_info($gender[$key],$nationality[$key],$MEI_FirstName,$MEI_LastName,$passport[$key],$expiration_date[$key],$birthday[$key],$MEI_Memo,$MEI_Street,'',$contact_phone,0,$COLI_SN,$visitor_link); - } - } - - if ($MEI_SN && $this->input->post('emergency_person_name')!='') { - $add_emergency_res=$this->Order_model->add_customer_info( - '', - '', - $this->input->post('emergency_person_name'), - '', - '', - '', - '', - $this->input->post('emergency_relationship'), - '', - $this->input->post('emergency_email'), - $this->input->post('emergency_telephone'), - 1, - $COLI_SN, - $visitor_link - ); - } - - if ($MEI_SN) { - $this->Order_model->send_mail('chinahighlights', 'service@chinahighlights.com', $this->input->post('toname'), $this->input->post('tomail'), $COLI_ID.' 团个人信息导入HT', $COLI_ID.' 团个人信息导入HT','China Highlights',$M_Web='CHT'); - echo 1; - }else{ - echo 0; - } - } - -} \ No newline at end of file diff --git a/application/third_party/order/controllers/confirm.php b/application/third_party/order/controllers/confirm.php index 68336f1a..18b30c39 100644 --- a/application/third_party/order/controllers/confirm.php +++ b/application/third_party/order/controllers/confirm.php @@ -133,4 +133,11 @@ class Confirm extends CI_Controller { } } + function review() { + $data = array(); + $data['postdata'] = $this->input->post(); + $mail_text = $this->load->view('mailtext', $data, true); + echo json_encode($mail_text); + } + } diff --git a/application/third_party/order/views/_confirm_order.php b/application/third_party/order/views/_confirm_order.php deleted file mode 100644 index b1e5743f..00000000 --- a/application/third_party/order/views/_confirm_order.php +++ /dev/null @@ -1,709 +0,0 @@ - - - - - - - www.chinahighlights.com - - - - - - - - - -
    - -
    - -
    -
    -
    - -
    -

    Thanks booking with China Highlights!

    -

    Please complete and submit the information below for booking.

    -
    -
    -
    -
    -
    - -
    -

    Passenger Information

    -
    - -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    - -
    -
    /
    -
    - -
    -
    -
    -
    -
    -
    - -
    - - -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - - - - -
    -
    - -
    - -
    - - Add a passenger - -
    -
    - -
    -
    - - Contact phone no.: - -
    -
    - -
    -
    - -
    -
    -
    -
    - COLI_CustomerType!=44003){ ?> -
    -
    - - Home Address: - - - -
    -
    - - -
    -
    -
    - -
    -
    -
    - -
    -

    Flight Information

    -
    - -
    -
    - - -
    - -
    - -
    - -
    -
    - -
    - - -
    - -
    - -
    - -
    -
    - -
    - -
    -
    -
    - -
    -
    -
    - -
    -

    - Special Request -

    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - COLI_CustomerType!=44003){ ?> -
    -
    -
    - -
    -

    - Emergency Contact Information - (in case an unlikely event happens when you are traveling) -

    -
    - -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    -
    -
    -
    - - -
    - - - - - -
    - -
    -
    Thanks,yours OPI_FirstName; ?>
    -
    - -
    - -
    -
    - - - - - - - \ No newline at end of file diff --git a/application/third_party/order/views/confirm_order.php b/application/third_party/order/views/confirm_order.php deleted file mode 100644 index 820af6e9..00000000 --- a/application/third_party/order/views/confirm_order.php +++ /dev/null @@ -1,817 +0,0 @@ - - - - - - - - www.chinahighlights.com - - - - - - - - - -
    - -
    - -
    -
    -
    - -
    -

    Thanks for booking with China Highlights!

    -

    Please complete and submit the information below.

    - -
    -
    -
    -
    -
    - -
    -

    Passenger Information (we need passport info for all the group members)

    -
    - - - -
    - -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    -
    /
    -
    - -
    -
    -
    -
    -
    -
    - -
    - - -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - - - - -
    -
    - -
    - -
    - - Add a passenger - -
    -
    - -
    -
    - - Contact phone no.: - -
    -
    - -
    -
    - -
    -
    -
    -
    - COLI_CustomerType != 44003) { ?> -
    -
    - - Home Address: - - - -
    -
    - - -
    -
    -
    - -
    -
    -
    - -
    -

    Flight Information (please skip this if your don’t need airport pick up and drop off service)

    -
    - -
    -
    - - -
    - -
    - -
    - -
    -
    - -
    - - -
    - -
    - -
    - -
    -
    - -
    - -
    -
    -
    - -
    -
    -
    - -
    -

    - Special Request -

    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - COLI_CustomerType != 44003) { ?> -
    -
    -
    - -
    -

    - Emergency Contact Information - (in case an unlikely event happens when you are traveling) -

    -
    - -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    -
    -
    -
    - - -
    -
    -
    - -
    -

    - Insurance Information -

    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - - -
    - - - - - - - -
    - -
    -
    Thanks,yours OPI_FirstName; ?>
    -
    - -
    - -
    -
    - - - - - - - - - - - \ No newline at end of file diff --git a/application/third_party/order/views/link_tips.php b/application/third_party/order/views/link_tips.php deleted file mode 100644 index 0a475fe0..00000000 --- a/application/third_party/order/views/link_tips.php +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - www.chinahighlights.com - - - - - - - - - - - - -
    - -
    - -
    - -
    - - - \ No newline at end of file diff --git a/application/third_party/order/views/link_tips2.php b/application/third_party/order/views/link_tips2.php deleted file mode 100644 index 6b814a5f..00000000 --- a/application/third_party/order/views/link_tips2.php +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - www.chinahighlights.com - - - - - - - - - - - - -
    - -
    - -
    - -
    - - - \ No newline at end of file diff --git a/application/third_party/order/views/mailtext.php b/application/third_party/order/views/mailtext.php deleted file mode 100644 index e91b9e41..00000000 --- a/application/third_party/order/views/mailtext.php +++ /dev/null @@ -1,69 +0,0 @@ -

    - Thanks for booking with China Highlights!
    -For any change, please contact your travel advisor.
    -

    -

    - Passenger Information -

    - - $sur) { ?> - -

    Passenger

    -

    Sur name/First and Middle name:

    -

    Passport No.:

    -

    Passport Expiration Date:

    -

    Birthday:

    - - -

    Contact Information

    -

    Land line:

    -

    Mobile:

    -

    Home Address:

    - -

    - Flight Information -

    -

    Arrival China Flight No.:

    -

    - Arrival time: -

    -

    - Departure China Flight no.: -

    -

    - Departure time: -

    -

    - Special Request -

    -

    - -
    -

    -

    - Insurance Information -

    -

    - -
    -

    -

    - Emergency Contact Information -

    -

    - 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 @@ + + + + +无标题文档 + + + +

    China Highlights Booking Confirmation

    +

    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
    +2. SIAN MARIE JOHNSON , passport number 528876517

    +

    Train 1:

    + + + + + + + + + + + + + + + + + + + + + +
    Ticket Pick Up No.E601014106 
    Train No.Z19
    Departure20:40 Jun.06 Beijing Xi (West) Station(in Chinese 北京西火车站)
    Arrival08:31AM Jun.07 Xi'an Station(in Chinese 西安火车站)
    ClassSoft 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.

    + + diff --git a/application/third_party/train/views/ht_train_order_info.php b/application/third_party/train/views/ht_train_order_info.php index a373bc47..6189118b 100644 --- a/application/third_party/train/views/ht_train_order_info.php +++ b/application/third_party/train/views/ht_train_order_info.php @@ -1,7 +1,7 @@
    -

    翰特订单号 订单列表>>导出交易记录>> 版本:V2.0

    +

    翰特订单号 订单列表>>导出交易记录>> 版本:V2.0聚合余额(RMB):

    diff --git a/application/views/bootstrap/author/author_list.php b/application/views/bootstrap/author/author_list.php index 3afc4584..905a58e9 100644 --- a/application/views/bootstrap/author/author_list.php +++ b/application/views/bootstrap/author/author_list.php @@ -10,12 +10,13 @@ - + + @@ -28,6 +29,7 @@ + @@ -39,12 +41,13 @@
    用户ID用户ID 名字 中文名 性别 邮箱 注册时间站点 操作
    a_gender; ?> a_email; ?> a_datetime)); ?>a_sitecode; ?> 查看
    - + + @@ -57,6 +60,7 @@ + diff --git a/application/views/bootstrap/author/task_create.php b/application/views/bootstrap/author/task_create.php index 74c72b24..032e498c 100644 --- a/application/views/bootstrap/author/task_create.php +++ b/application/views/bootstrap/author/task_create.php @@ -12,79 +12,79 @@ $("#start-rating1").webwidget_rating_simple({ rating_star_length: '5', rating_initial_value: '5', - rating_function_name: 'set_rate',//this is function name for click + rating_function_name: 'set_rate', //this is function name for click directory: '/js/start_rate' }); $("#start-rating2").webwidget_rating_simple({ rating_star_length: '5', rating_initial_value: '5', - rating_function_name: 'set_rate',//this is function name for click + rating_function_name: 'set_rate', //this is function name for click directory: '/js/start_rate' }); $("#start-rating3").webwidget_rating_simple({ rating_star_length: '5', rating_initial_value: '5', - rating_function_name: 'set_rate',//this is function name for click + rating_function_name: 'set_rate', //this is function name for click directory: '/js/start_rate' }); $("#start-rating4").webwidget_rating_simple({ rating_star_length: '5', rating_initial_value: '5', - rating_function_name: 'set_rate',//this is function name for click + rating_function_name: 'set_rate', //this is function name for click directory: '/js/start_rate' }); $("#start-rating5").webwidget_rating_simple({ rating_star_length: '5', rating_initial_value: '5', - rating_function_name: 'set_rate',//this is function name for click + rating_function_name: 'set_rate', //this is function name for click directory: '/js/start_rate' }); $("#start-rating6").webwidget_rating_simple({ rating_star_length: '5', rating_initial_value: '5', - rating_function_name: 'set_rate',//this is function name for click + rating_function_name: 'set_rate', //this is function name for click directory: '/js/start_rate' }); $("#start-rating7").webwidget_rating_simple({ rating_star_length: '5', rating_initial_value: '5', - rating_function_name: 'set_rate',//this is function name for click + rating_function_name: 'set_rate', //this is function name for click directory: '/js/start_rate' }); //鼠标经过评分星星的时候弹出提示 - $(".webwidget_rating_simple>li").hover(function(){ - var i=$(this).children('span').text(); + $(".webwidget_rating_simple>li").hover(function() { + var i = $(this).children('span').text(); i--; - var tips=new Array( - "Start again with this aspect", - "Needs a lot of work", - "Definitely needs some work", - "Acceptable, but could/should be improved a bit.", - "Good work. Nothing more needed."); - $(this).attr('data-original-title',tips[i]); + var tips = new Array( + "Start again with this aspect", + "Needs a lot of work", + "Definitely needs some work", + "Acceptable, but could/should be improved a bit.", + "Good work. Nothing more needed."); + $(this).attr('data-original-title', tips[i]); $(this).tooltip('show'); }); - $(".wait-task").click(function(event){ + $(".wait-task").click(function(event) { event.preventDefault(); - var url= $(this).attr('href'); - $.post(url,'',function(responseText){ - var responseText=eval("("+responseText+")");//转换为json对象 + var url = $(this).attr('href'); + $.post(url, '', function(responseText) { + var responseText = eval("(" + responseText + ")");//转换为json对象 for (var key in responseText) { if (responseText[key].name == 'ok') { - alert('已通过该投稿申请!'); - }else if(responseText[key].name == 'no'){ + alert('已通过该投稿申请!'); + } else if (responseText[key].name == 'no') { alert('已拒绝该投稿申请!'); } } }); }); //根据审核次数计算结算价格 - $("#base_charge").keyup(function(){ + $("#base_charge").keyup(function() { set_price(); }); //根据单字价格计算总金额 - $("#word_price,#ta_count").keyup(function(){ + $("#word_price,#ta_count").keyup(function() { set_price_by_wordprice(); }); @@ -101,7 +101,7 @@ //allowFileManager:true, allowImageUpload: false, items: [ - 'ace', '|', 'fullscreen','|','clearstyle', '|', 'source' + 'ace', '|', 'fullscreen', '|', 'clearstyle', '|', 'source' ], afterChange: function() { K('#display_count').html(getWordCount(editor.text())); @@ -113,600 +113,598 @@ }); }); -function get_analytics_ajax(formid,contentid,loadtotal){ - var url= $("#"+formid).attr('action')+'/'+loadtotal; - var data = $("#"+formid).serialize(); - $("#"+contentid).html(''); - $.post(url,data,function(result){ - $("#"+contentid).html(result); - }); -} - -function set_rate(){ - var rating_str=''; - var totalrating=0; - for (var i = 1; i < 8; i++) { - var rating = $("#start-rating"+i).val(); - rating_str=rating_str+rating+','; - totalrating=Number(totalrating)+Number(rating); - }; - $("#t_rating").val(rating_str); - $("#t_rating_total").val(totalrating); -} - -function set_price(){ - var base_charge=$("#base_charge").val(); - var discount=$("#t_discount").attr('data-discount'); - var total=Number(base_charge)*Number(discount); - total=parseInt(total); - $("#total_charge").text(total); - $("#ta_charge").val(total); -} - -function set_price_by_wordprice(){ - var word_count = $("#ta_count").val(); - var word_price = $("#word_price").val(); - var base_charge=word_count*word_price; - $("#base_charge").val(base_charge); - set_price(); -} -function show_msg(a,type){ - if (type=='data-short') { - var contenttype='data-long'; - var flag=' >> '; - }else{ - var contenttype='data-short'; - var flag=' << '; + + function set_rate() { + var rating_str = ''; + var totalrating = 0; + for (var i = 1; i < 8; i++) { + var rating = $("#start-rating" + i).val(); + rating_str = rating_str + rating + ','; + totalrating = Number(totalrating) + Number(rating); + } + ; + $("#t_rating").val(rating_str); + $("#t_rating_total").val(totalrating); } - var content=$(a).parent('p').attr(type); - $(a).parent('p').text(content).append(' '+flag+' '); -} - -function submitsms(formID){ - $(".btn_send_sms").text('loading'); - var $form=$("#"+formID); - var data=$form.serialize(); - var url=$form.attr('action'); - $.ajax({ - type: "post", - url: url, - dataType: "json", - data: data, - success: function(json_data) { - for (var key in json_data) { - if (json_data[key].name == 'ok') { - var smstext=$("#m_content").val(); - var data_short=smstext.substr(0,100); - var myDate = new Date(); - var other_html=''; - if (data_short!=smstext) { - other_html=' >> '; - }; - var sms='

    '+data_short+other_html+'

    '+myDate.toLocaleString();+'
    '; - $("#short_sms_container").prepend(sms); - $("#m_content").val(''); - }else if (json_data[key].name == 'no') { - $.modaldialog.error('发送失败...'); - } - } - $(".btn_send_sms").text('发送'); - }, - error: function(XMLHttpRequest, textStatus, errorThrown) { - $.modaldialog.error('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC...'); - $(".btn_send_sms").text('发送'); + + function set_price() { + var base_charge = $("#base_charge").val(); + var discount = $("#t_discount").attr('data-discount'); + var total = Number(base_charge) * Number(discount); + total = parseInt(total); + $("#total_charge").text(total); + $("#ta_charge").val(total); + } + + function set_price_by_wordprice() { + var word_count = $("#ta_count").val(); + var word_price = $("#word_price").val(); + var base_charge = word_count * word_price; + $("#base_charge").val(base_charge); + set_price(); + } + function show_msg(a, type) { + if (type == 'data-short') { + var contenttype = 'data-long'; + var flag = ' >> '; + } else { + var contenttype = 'data-short'; + var flag = ' << '; } - }); + var content = $(a).parent('p').attr(type); + $(a).parent('p').text(content).append(' ' + flag + ' '); + } + + function submitsms(formID) { + $(".btn_send_sms").text('loading'); + var $form = $("#" + formID); + var data = $form.serialize(); + var url = $form.attr('action'); + $.ajax({ + type: "post", + url: url, + dataType: "json", + data: data, + success: function(json_data) { + for (var key in json_data) { + if (json_data[key].name == 'ok') { + var smstext = $("#m_content").val(); + var data_short = smstext.substr(0, 100); + var myDate = new Date(); + var other_html = ''; + if (data_short != smstext) { + other_html = ' >> '; + } + ; + var sms = '

    ' + data_short + other_html + '

    ' + myDate.toLocaleString(); + +'
    '; + $("#short_sms_container").prepend(sms); + $("#m_content").val(''); + } else if (json_data[key].name == 'no') { + $.modaldialog.error('发送失败...'); + } + } + $(".btn_send_sms").text('发送'); + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + $.modaldialog.error('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYCC...'); + $(".btn_send_sms").text('发送'); + } + }); } - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    - - 关联信息 - - -
    -

    - - -
    - -
    - $task_detail) { - $task_key == 0 ? $active = "active" : $active = ""; - $task_key == 0 ? $active_flag = '' : $active_flag = $task_key; - ?> -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    - - - - -
    - - -
    - -
    - -
    +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    + + 关联信息 + +
    + + ic_title; ?> +
    +
    +

    + + +
    + +
    + $task_detail) { + $task_key == 0 ? $active = "active" : $active = ""; + $task_key == 0 ? $active_flag = '' : $active_flag = $task_key; + ?> +
    +
    +
    +
    + + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + + - + +
    + + + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    +
    + + +
    + + +
    -
    - -
    - +
    +
    -
    -
    - -
    - -
    -
    -
    -
    - - -
    - + +
    - -
    - + +
    +
    +
    +
    + + +
    +
    + + +
    + + - - - - -
    - - -
    -
    -
    -
    - - -
    -
    - - -
    - - - -
    -
    - - -
    -
    - - -
    - -
    - - ta_count; ?> -
    -
    - - ta_charge; ?> -
    - -
    - - - - -
    - - 关联信息 - - -
    - - t_attach)){ ?> -
    附件:t_attach; ?>
    - -
    -
    -
    - -
    - t_rating)){ ?> - 任务评分 -
    -
      - 'Start again with this aspect', - 2=>'Needs a lot of work', - 3=>'Definitely needs some work', - 4=>'Acceptable, but could/should be improved a bit.', - 5=>'Good work. Nothing more needed.' - ); - $rating=explode(',',$task->t_rating); - ?> - $v) { ?> -
    • - - - - -
    • - -
    -
    - - t_a_id)) { ?> - - 短消息 -
    - - -

    - 发送 - -

     

    -
    -
    - $sms) { - if ($k>2) break; - $content=get_text_short(htmlspecialchars($sms->m_content),50); - if ($sms->m_sender == $task->t_a_id) { - ?> -
    -

    - - - >> - -

    - m_sender); ?> m_datetime)); ?> -
    - -
    -

    - - - >> - -

    - m_sender); ?> m_datetime)); ?> -
    - - - - 更多消息.. - - - -
    -
    - -
    -
    -
    -
    - -f - - - - +
    + t_rating)) { ?> + 任务评分 +
    +
      + 'Start again with this aspect', + 2 => 'Needs a lot of work', + 3 => 'Definitely needs some work', + 4 => 'Acceptable, but could/should be improved a bit.', + 5 => 'Good work. Nothing more needed.' + ); + $rating = explode(',', $task->t_rating); + ?> + $v) { ?> +
    • + + + + +
    • + +
    +
    + + t_a_id)) { ?> + + 短消息 +
    + + +

    + 发送 + +

     

    +
    +
    + $sms) { + if ($k > 2) + break; + $content = get_text_short(htmlspecialchars($sms->m_content), 50); + if ($sms->m_sender == $task->t_a_id) { + ?> +
    +

    + + + >> + +

    + m_sender); ?> m_datetime)); ?> +
    + +
    +

    + + + >> + +

    + m_sender); ?> m_datetime)); ?> +
    + + + + 更多消息.. + + + +
    +
    + +
    +
    +
    +
    + + + + - - - - - - + + + - \ No newline at end of file + \ No newline at end of file diff --git a/application/views/bootstrap/header.php b/application/views/bootstrap/header.php index c462b0a5..6b471097 100644 --- a/application/views/bootstrap/header.php +++ b/application/views/bootstrap/header.php @@ -73,6 +73,7 @@ 更多
    - +
    diff --git a/author/views/read_task.php b/author/views/read_task.php index fc20ecd6..ac2f064f 100644 --- a/author/views/read_task.php +++ b/author/views/read_task.php @@ -4,19 +4,19 @@ var editor; KindEditor.ready(function(K) { editor = K.create('#ta_content', { - width : '100%', - height:'480px', + width: '100%', + height: '480px', //fileManagerJson:'/js/kcfinder/browse.php', //allowFileManager:true, - allowImageUpload:false, - filterMode : false, - langType : 'en', - items : [ + allowImageUpload: false, + filterMode: false, + langType: 'en', + items: [ 'ace', '|', 'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|', - 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|', - 'clearhtml', 'quickformat','removeformat', 'selectall', '/','fullscreen', '|', + 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|', + 'clearhtml', 'quickformat', 'removeformat', 'selectall', '/', 'fullscreen', '|', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', - 'italic', 'underline', 'strikethrough', 'lineheight', '|', 'table', 'hr', 'emoticons','image', 'map', 'pagebreak', + 'italic', 'underline', 'strikethrough', 'lineheight', '|', 'table', 'hr', 'emoticons', 'image', 'map', 'pagebreak', 'link', 'unlink', '|', 'about', '|', 'source' ], afterChange: function() { @@ -26,26 +26,26 @@ }); //加载预览样式 - function load_preview_css(){ - $("iframe.ke-edit-iframe").contents().find("head").append('config->item("css_source_".$this->config->item("site_code")); ?>'); - $("iframe.ke-edit-iframe").contents().find(".ke-content").css({"max-width":"1024px","margin-left":"auto","margin-right":"auto"}); - + function load_preview_css() { + $("iframe.ke-edit-iframe").contents().find("head").append('config->item("css_source_" . $this->config->item("site_code")); ?>'); + $("iframe.ke-edit-iframe").contents().find(".ke-content").css({"max-width": "1024px", "margin-left": "auto", "margin-right": "auto"}); + } $(document).ready(function() { //每隔三分钟自动保存一次任务内容 - setInterval(function(){ - editor.sync(); - var data=$('#form_article').serialize(); - var url= ''; - $.post(url,data,function(responseText){ - var responseText=eval("("+responseText+")");//转换为json对象 - for (var key in responseText) { - if (responseText[key].name != 'ok') { - $("#auto-save").html('(自动保存失败...)'); + setInterval(function() { + editor.sync(); + var data = $('#form_article').serialize(); + var url = ''; + $.post(url, data, function(responseText) { + var responseText = eval("(" + responseText + ")");//转换为json对象 + for (var key in responseText) { + if (responseText[key].name != 'ok') { + $("#auto-save").html('(自动保存失败...)'); + } } - } - }); + }); }, 180000); //ajax获取获取google分析数据的日期设置 @@ -54,163 +54,149 @@ }); $("#total-analytics>a").trigger("click"); - $("#rating-container>ul>li").hover(function(){ + $("#rating-container>ul>li").hover(function() { $(this).tooltip('show'); }); }); - - //快速图片上传 - function openKCFinder_ta_photo() { - window.CallBack=openKCFinder_ta_photo_callback; - window.open('/media/popselectpicture.php?site_lgc=1', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600' ); - } - - function openKCFinder_ta_photo_callback(result) { - if (result != null && result.Pinfo[0]) { - $('#ta_photo').val(result.Pinfo[0].PUrl); - $("#ta_photo_img").attr("src","config->item('media_image_url'); ?>"+result.Pinfo[0].PUrl); - } - } - + + //快速图片上传 + function openKCFinder_ta_photo() { + window.CallBack = openKCFinder_ta_photo_callback; + window.open('/media/popselectpicture.php?site_lgc=1', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600'); + } + + function openKCFinder_ta_photo_callback(result) { + if (result != null && result.Pinfo[0]) { + $('#ta_photo').val(result.Pinfo[0].PUrl); + $("#ta_photo_img").attr("src", "config->item('media_image_url'); ?>" + result.Pinfo[0].PUrl); + } + } + //选择内容图片 function openKCFinder_Content() { - window.CallBack=openKCFinder_Content_callback; - window.open('/media/popselectpicture.php?site_lgc=1', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600' ); + window.CallBack = openKCFinder_Content_callback; + window.open('/media/popselectpicture.php?site_lgc=1', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600'); } function openKCFinder_Content_callback(result) { - var site_image_url='config->item('media_image_url') ?>'; - if (result != null){ - for(var key in result.Pinfo){ - editor.insertHtml(''+result.Pinfo[key].PName+''); - } + var site_image_url = 'config->item('media_image_url') ?>'; + if (result != null) { + for (var key in result.Pinfo) { + editor.insertHtml('' + result.Pinfo[key].PName + ''); + } } } - function get_analytics_ajax(formid,contentid,loadtotal){ - var url= $("#"+formid).attr('action')+'/'+loadtotal; - var data = $("#"+formid).serialize(); - $("#"+contentid).html(''); - $.post(url,data,function(result){ - $("#"+contentid).html(result); - }); - } - +
    -
    - Task requirement -
    -
    -
    - Task name:: - t_title; ?> -
    -
    -
    -
    - Task type: - t_td_type; ?> +
    + Task requirement +
    +
    +
    + Task name:: + t_title; ?> +
    +
    +
    +
    + Task type: + t_td_type; ?> +
    +
    + Send by: + t_ht_op_code); ?> +
    +
    + Task Deadline: + t_expires)); ?> +
    +
    +
    +

    Task requirement:t_content; ?>

    +
    -
    - Send by: - t_ht_op_code); ?> -
    -
    - Task Deadline: - t_expires)); ?> -
    -
    -
    -

    Task requirement:t_content; ?>

    -
    -
    - - Task details - - 获取google分析汇总数据 - - -
    - - - - - - - - -

    - - - - - - - - - -
    -
    - -
    -
    -
    - -

    Click the “Choose” button
    to choose a photo from our Photo Galleries.

    + + Task details + + + + + + + + - + +

    + + + + + + + + + +
    +
    + +
    +
    +
    + +

    Click the “Choose” button
    to choose a photo from our Photo Galleries.

    +
    + + + + + +
    + +
    + t_a_id<=0) ? $disabled = '' : $disabled = ' style="display:none;" '; ?> + +

    - - - - - -
    - -
    - t_a_id)?$disabled='':$disabled=' style="display:none;" ';?> - - t_a_id) && $task->t_status=='edit' )?$disabled='':$disabled=' style="display:none;" ';?> - - - -

    -
    -
    +
    \ No newline at end of file diff --git a/author/views/signup.php b/author/views/signup.php index c578ee66..1047d9eb 100644 --- a/author/views/signup.php +++ b/author/views/signup.php @@ -1,215 +1,215 @@
    -
    +
    + - -
    +
    + + Sign Up For China Highlights Online Writers Platform +
    + + +
    -Sign Up For China Highlights Online Writers Platform -
    - - -
    - -
    +
    -
    用户ID用户ID 名字 中文名 性别 邮箱 注册时间站点 操作
    a_gender; ?> a_email; ?> a_datetime)); ?>a_sitecode; ?> 查看