From ec97cd34c65091f8da6ea2bae820a4efc379921e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Fri, 17 Mar 2017 15:40:01 +0800 Subject: [PATCH 01/28] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D=E5=A2=9E=E5=8A=A0=E5=8F=AA=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=9F=90=E4=B8=AA=E7=AB=99=E7=82=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/keyworlds.php | 936 +++++++++------------- application/models/infokeywords_model.php | 7 +- 2 files changed, 388 insertions(+), 555 deletions(-) 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/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; } From 95c138caf583a82abec31b869224414cea2bcd2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Wed, 22 Mar 2017 15:02:51 +0800 Subject: [PATCH 02/28] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=BE=B9=E6=A1=86?= =?UTF-8?q?=E7=9A=84=E8=BE=93=E5=85=A5=E6=A1=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/information-system3.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/css/information-system3.css b/css/information-system3.css index b4d4741f..640a86d2 100644 --- a/css/information-system3.css +++ b/css/information-system3.css @@ -124,3 +124,5 @@ #recommended_list ol{border-bottom:1px dashed #333;} .none_text_input{ border: none;border-bottom: 1px solid #aaa;} + /* 目的地系统使用 */ + .dest_none_input{width: 100%;height: 26px; padding: 0; border: none;border-bottom: 1px solid #aaa;} From 8d92c11b0b54ab9d47d8034fdba4fcb850a41385 Mon Sep 17 00:00:00 2001 From: csk Date: Fri, 24 Mar 2017 13:36:01 +0800 Subject: [PATCH 03/28] =?UTF-8?q?=E8=81=9A=E5=90=88=E5=87=BA=E7=A5=A8?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=9F=A5=E7=9C=8B=E8=81=9A=E5=90=88?= =?UTF-8?q?=E4=BD=99=E9=A2=9D=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/third_party/train/controllers/index.php | 11 +++++++++++ .../third_party/train/views/ht_train_order_info.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) 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/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):

    From bef22b1a12bf2411b8026dcd7dc38ada81c46102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Fri, 7 Apr 2017 15:47:29 +0800 Subject: [PATCH 04/28] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 27 +++++++++++ .../views/bootstrap3/information_edit.php | 46 ++++++++++++++----- 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index 1a5f0529..e6b61bc8 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -68,6 +68,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); diff --git a/application/views/bootstrap3/information_edit.php b/application/views/bootstrap3/information_edit.php index a53a148d..21155868 100644 --- a/application/views/bootstrap3/information_edit.php +++ b/application/views/bootstrap3/information_edit.php @@ -1,4 +1,4 @@ - + "; } } - //修改职称 - 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/information.php b/application/controllers/information.php index e6b61bc8..6cdcce0c 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) { 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/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/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/author/config/config.php b/author/config/config.php index b8f9cf11..320926c8 100644 --- a/author/config/config.php +++ b/author/config/config.php @@ -381,6 +381,7 @@ $config['site'] = array( 'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'http://www.guilinchina.net'), 'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'http://www.mybeijingchina.com'), 'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'http://www.chinatravel.com'), + 'ah' => array('site_code' => 'ah', 'site_id' => 141, 'site_lgc' => '1', 'site_url' => 'https://www.asiahighlights.com/'), 'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'http://www.diychinatours.com') ); @@ -389,4 +390,7 @@ $config['auhtor_task_type'] = array( '修改' => 'modify', '审核' => 'review', '投稿' => 'contribute' -); \ No newline at end of file +); + +//当前站点代号,默认是cht,用户登录之后修改 +$config['site_code']='cht'; \ No newline at end of file diff --git a/author/controllers/index.html b/author/controllers/index.html deleted file mode 100644 index c942a79c..00000000 --- a/author/controllers/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

    Directory access is forbidden.

    - - - \ No newline at end of file diff --git a/author/controllers/login.php b/author/controllers/login.php index 345132fe..0be9ffd9 100644 --- a/author/controllers/login.php +++ b/author/controllers/login.php @@ -1,34 +1,30 @@ -load->model('Infoauthors_model'); } - - public function index() - { - if($this->permission->is_admin(false)===false) - { - $data=array(); - $this->load->view('header', $data); - $this->load->view('login'); - $this->load->view('footer'); - } - else - { - redirect(site_url()); - } - } + + public function index() { + if ($this->permission->is_admin(false) === false) { + $data = array(); + $this->load->view('header', $data); + $this->load->view('login'); + $this->load->view('footer'); + } else { + redirect(site_url()); + } + } //登录检测 - public function login_submit() - { + public function login_submit() { //如果已经登陆则跳到管理首页 - if ($this->session->userdata('session_admin')) - { + if ($this->session->userdata('session_admin')) { $data[] = array('name' => 'go', 'value' => site_url()); echo json_encode($data); return TRUE; @@ -36,241 +32,200 @@ class Login extends CI_Controller { $this->form_validation->set_rules('email', 'lang:login_email', 'required'); $this->form_validation->set_rules('password', 'lang:login_password', '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 - { - if ($this->Infoauthors_model->check_login($this->input->post('email'), $this->input->post('password'))) - { - $this->session->set_userdata('session_admin', $this->Infoauthors_model->detail($this->input->post('email'))); + } else { + if ($this->Infoauthors_model->check_login($this->input->post('email'), $this->input->post('password'))) { + $this->session->set_userdata('session_admin', $this->Infoauthors_model->detail($this->input->post('email'))); //记住账号密码 - $this->input->set_cookie("user_email",$this->input->post('email'),7776000); - $this->input->set_cookie("user_pwd",$this->input->post('password'),7776000); - + $this->input->set_cookie("user_email", $this->input->post('email'), 7776000); + $this->input->set_cookie("user_pwd", $this->input->post('password'), 7776000); $data[] = array('name' => 'go', 'value' => site_url()); - echo json_encode($data); - return TRUE; + echo json_encode($data); + return TRUE; } //用户名和密码不正确,或者没有管理权限 - if ($this->session->userdata('session_admin') === false) - { + if ($this->session->userdata('session_admin') === false) { $data[] = array('name' => 'login_warning', 'value' => $this->lang->line('login_warning')); echo json_encode($data); } } } - - - public function signup() - { - $data=array(); + + public function signup() { + $data = array(); $data['signup_step'] = 1; - $data['author_field'] = $this->load->view('author_field',$data,true); + $data['author_field'] = $this->load->view('author_field', $data, true); $this->load->view('header', $data); $this->load->view('signup'); $this->load->view('footer'); - } + } - public function signup_vpn() - { - $data=array(); + public function signup_vpn() { + $data = array(); $data['signup_step'] = 1; - $data['terms']='vpn'; + $data['terms'] = 'vpn'; $data['navbar_active'] = false; - $data['author_field'] = $this->load->view('author_field',$data,true); + $data['author_field'] = $this->load->view('author_field', $data, true); $this->load->view('header', $data); $this->load->view('signup'); $this->load->view('footer'); } - - public function signup_submit() - { + + public function signup_submit() { $this->form_validation->set_rules('a_email', 'lang:signup_a_email', 'required'); $this->form_validation->set_rules('a_password', 'lang:signup_a_password', 'required'); $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'); $this->form_validation->set_rules('terms', 'You must choose this option!', '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 - { - if ($this->Infoauthors_model->check_signup($this->input->post('a_email'))) - { + } else { + if ($this->Infoauthors_model->check_signup($this->input->post('a_email'))) { $data[] = array('name' => 'a_email', 'value' => 'Someone already has that email. Try another?'); echo json_encode($data); return FALSE; } //头像处理 - $a_photo=''; - if ($this->input->post('profile_url')!='') { - $profile_file_path=APPPATH.'document/profile_photo'; - $profile_url=$this->input->post('profile_url'); - $profile_array=explode('.', $profile_url); - $profile_ext='jpg';//end($profile_array); - rename($profile_file_path.'/'.$profile_url,$profile_file_path.'/profile_'.$this->input->post('a_email').'.'.$profile_ext); - 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 = ''; + if ($this->input->post('profile_url') != '') { + $profile_file_path = APPPATH . 'document/profile_photo'; + $profile_url = $this->input->post('profile_url'); + $profile_array = explode('.', $profile_url); + $profile_ext = 'jpg'; //end($profile_array); + rename($profile_file_path . '/' . $profile_url, $profile_file_path . '/profile_' . $this->input->post('a_email') . '.' . $profile_ext); + 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=APPPATH.'document/ID_CARD'; - $a_id_file=$this->input->post('ID_file_name'); - $file_array=explode('.', $a_id_file); - $ext='jpg';//end($file_array); - rename($ID_file_path.'/'.$a_id_file,$ID_file_path.'/id_card_'.$this->input->post('a_email').'.'.$ext); + if ($this->input->post('ID_file_name') != '') { + $ID_file_path = APPPATH . 'document/ID_CARD'; + $a_id_file = $this->input->post('ID_file_name'); + $file_array = explode('.', $a_id_file); + $ext = 'jpg'; //end($file_array); + rename($ID_file_path . '/' . $a_id_file, $ID_file_path . '/id_card_' . $this->input->post('a_email') . '.' . $ext); } - $a_name=trim($this->input->post('a_name')); - $a_name_cn=trim($this->input->post('a_name_cn')); + $a_name = trim($this->input->post('a_name')); + $a_name_cn = trim($this->input->post('a_name_cn')); $this->Infoauthors_model->add( - $this->input->post('a_email'), - $this->input->post('a_password'), - $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->input->post('a_email'), $this->input->post('a_password'), $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') ); - $data[] = array('name' => 'go', 'value' => site_url('login/signup_success')); - echo json_encode($data); - return TRUE; - } - } - - - public function signup_success() - { - $data['title']=$this->lang->line('signup_success_title'); - $data['content']=$this->lang->line('signup_success'); + $data[] = array('name' => 'go', 'value' => site_url('login/signup_success')); + echo json_encode($data); + return TRUE; + } + } + + public function signup_success() { + $data['title'] = $this->lang->line('signup_success_title'); + $data['content'] = $this->lang->line('signup_success'); $this->load->view('header', $data); $this->load->view('message'); $this->load->view('footer'); - } + } - 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'; } - $config['upload_path'] = APPPATH.'document/'.$save_path; + $config['upload_path'] = APPPATH . '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) { - $baseurls=str_replace('controllers', '', dirname(__FILE__)); + $baseurls = str_replace('controllers', '', dirname(__FILE__)); $config['image_library'] = 'gd2'; - $config['source_image'] = $baseurls.'document/profile_photo/'.$file_name; + $config['source_image'] = $baseurls . '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 findpwd() - { - $data=array(); + public function findpwd() { + $data = array(); $this->load->view('header', $data); $this->load->view('findpwd'); $this->load->view('footer'); } //找回密码发送邮件 - public function do_findpwd() - { + public function do_findpwd() { $this->form_validation->set_rules('email', 'lang:login_email', 'required'); - if ($this->form_validation->run() == FALSE) - { + if ($this->form_validation->run() == FALSE) { $data = array(); $data[] = array('name' => 'email', 'value' => 'Please fill in your email address!'); echo json_encode($data); return FALSE; } - - $userdata=$this->Infoauthors_model->detail($this->input->post('email')); - if ($userdata) - { - $fromName='author site'; - $fromEmail='noreply02@chinahighlights.net'; - $toName=$userdata->a_name; - $toEmail=$userdata->a_email; - $subject='Your password for "http://a.chtcdn.com"'; - $body='Your password for "http://a.chtcdn.com" : '.$userdata->a_password.'



    For security please change your password once logged in.'; - $is_sendmail=$this->Infoauthors_model->SendMail($fromName, $fromEmail, $toName, $toEmail, $subject, $body); + + $userdata = $this->Infoauthors_model->detail($this->input->post('email')); + if ($userdata) { + $fromName = 'author site'; + $fromEmail = 'noreply02@chinahighlights.net'; + $toName = $userdata->a_name; + $toEmail = $userdata->a_email; + $subject = 'Your password for "http://a.chtcdn.com"'; + $body = 'Your password for "http://a.chtcdn.com" : ' . $userdata->a_password . '



    For security please change your password once logged in.'; + $is_sendmail = $this->Infoauthors_model->SendMail($fromName, $fromEmail, $toName, $toEmail, $subject, $body); if ($is_sendmail) { $data[] = array('name' => 'ok', 'value' => 'Action successful. Your password has been emailed to you.'); echo json_encode($data); - }else{ + } else { $data[] = array('name' => 'no', 'value' => 'Action unsuccessful. Try again later.!'); echo json_encode($data); return FALSE; } - } - else - { + } else { $data[] = array('name' => 'no', 'value' => 'Error: Your email is incorrect!'); echo json_encode($data); return FALSE; } } - + //退出登录,清空session - public function out() - { + public function out() { $this->session->unset_userdata('session_admin'); $this->load->helper('cookie'); //delete_cookie("user_email"); delete_cookie("user_pwd"); redirect(site_url('login')); } - + } /* End of file welcome.php */ diff --git a/author/controllers/taskhall.php b/author/controllers/taskhall.php index 879dad4c..08d2b972 100644 --- a/author/controllers/taskhall.php +++ b/author/controllers/taskhall.php @@ -1,164 +1,155 @@ -permission->is_admin(); //$this->output->enable_profiler(TRUE); - $this->load->model('Infotasks_model'); - $this->load->model('Infotaskarticles_model'); - $this->load->model('InfoSMS_model'); + $this->load->model('Infotasks_model'); + $this->load->model('Infotaskarticles_model'); + $this->load->model('InfoSMS_model'); } - public function index($page=1) - { - $data=array(); - $data['author_rank_list']=$this->Infotasks_model->get_author_rank_list(); - $data['article_rank_list']=$this->Infotasks_model->get_article_rank_list(); - - $t_td_type=$start_date=$tasktitle=false; - $end_date=date('Y-m-d'); - if($this->input->get('tasktype') && $this->input->get('tasktype')!='-') $t_td_type=$this->input->get('tasktype'); - if($this->input->get('startdate') && $this->input->get('startdate')!='') $start_date=$this->input->get('startdate'); - if($this->input->get('enddate') && $this->input->get('enddate')!='') $end_date=$this->input->get('enddate'); - if($this->input->get('tasktitle') && $this->input->get('tasktitle')!='') $tasktitle=$this->input->get('tasktitle'); - + public function index($page = 1) { + $data = array(); + $data['author_rank_list'] = $this->Infotasks_model->get_author_rank_list(); + $data['article_rank_list'] = $this->Infotasks_model->get_article_rank_list(); + + $t_td_type = $start_date = $tasktitle = false; + $end_date = date('Y-m-d'); + if ($this->input->get('tasktype') && $this->input->get('tasktype') != '-') + $t_td_type = $this->input->get('tasktype'); + if ($this->input->get('startdate') && $this->input->get('startdate') != '') + $start_date = $this->input->get('startdate'); + if ($this->input->get('enddate') && $this->input->get('enddate') != '') + $end_date = $this->input->get('enddate'); + if ($this->input->get('tasktitle') && $this->input->get('tasktitle') != '') + $tasktitle = $this->input->get('tasktitle'); + //分页 - $page_task=$this->Infotasks_model->get_tasks_list(false,0,$t_td_type,$start_date,$end_date,$tasktitle,$page); - $pages['total']=count($page_task); - $pages['pageSize']= 20; - $pages['url'] = site_url('taskhall/index'); - $pages['current']=$page; + $page_task = $this->Infotasks_model->get_tasks_list(false, 0, $t_td_type, $start_date, $end_date, $tasktitle, $page); + $pages['total'] = count($page_task); + $pages['pageSize'] = 20; + $pages['url'] = site_url('taskhall/index'); + $pages['current'] = $page; //$this->load->library('mypage',$pages); //$data['page']=$this->mypage->pages_html(); - $data['page']=show_page($pages); + $data['page'] = show_page($pages); //获取任务列表 - $task_id_str=0; - $page_task=array_slice($page_task,$pages['pageSize']*($page-1),$pages['pageSize']); + $task_id_str = 0; + $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; } $data['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str); - $data['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'hall')+$data,true); - $data['rank_view']=$this->load->view('rank',$data,true); - $this->load->view('header', array('navbar_active'=>'taskhall')+$data); + $data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'hall') + $data, true); + $data['rank_view'] = $this->load->view('rank', $data, true); + $this->load->view('header', array('navbar_active' => 'taskhall') + $data); $this->load->view('task_hall'); $this->load->view('footer'); - } - - public function view($t_id) - { - $data['task']=$this->Infotasks_model->detail($t_id); - if(empty($data['task'])) - { - show_404(); - return false; - } - $data['task_detail']=$this->Infotaskarticles_model->detail($data['task']->t_id); - - $data['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'hall')+$data,true); - $this->load->view('header', array('navbar_active'=>'taskhall')+$data); + } + + public function view($t_id) { + $data['task'] = $this->Infotasks_model->detail($t_id); + if (empty($data['task'])) { + show_404(); + return false; + } + $data['task_detail'] = $this->Infotaskarticles_model->detail($data['task']->t_id); + + $data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'hall') + $data, true); + $this->load->view('header', array('navbar_active' => 'taskhall') + $data); $this->load->view('read_task'); - $this->load->view('footer'); - } - - //?н????? - public function undertake() - { - $admin_info=$this->session->userdata('session_admin'); - $t_id=$this->input->post('t_id'); - $task=$this->Infotasks_model->detail($t_id); - if(empty($task)) - { - $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound')); - echo json_encode($data); - return false; - } - if(empty($task->t_a_id)) - { - //?н????? - $this->Infotasks_model->undertake($t_id,$admin_info->a_id); - $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_undertake_success')); - $data[] = array('name'=>'ok_go','value'=>site_url('welcome/view/'.$t_id)); - echo json_encode($data); - return true; - } - else - { - $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_has_undertake')); - echo json_encode($data); - return false; - } - } - - //ȡ?????? - public function canceltake() - { - $admin_info=$this->session->userdata('session_admin'); - $t_id=$this->input->post('t_id'); - $task=$this->Infotasks_model->detail($t_id); - if(empty($task)) - { - $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound')); - echo json_encode($data); - return false; - } - if($task->t_a_id==$admin_info->a_id) - { - //ȡ?????? - $this->Infotasks_model->canceltake($t_id); - $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_canceltake_success')); - $data[] = array('name'=>'ok_go','value'=>site_url('welcome/view/'.$t_id)); - echo json_encode($data); - return true; - } - else - { - $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_canceltake_error')); - echo json_encode($data); - return false; - } - } - - public function notice($announce_id='',$announce_type='notice') - { - $data=array(); - $data['type']=$announce_type; - if ($announce_id=='') { - $data['announce_list'] = $this->Infotaskarticles_model->get_announce($announce_id,$announce_type); - }else{ - $announce=$this->Infotaskarticles_model->get_announce($announce_id,$announce_type); - $data['announce_detail']=$announce[0]; - } - $data['author_rank_list']=$this->Infotasks_model->get_author_rank_list(); - $data['article_rank_list']=$this->Infotasks_model->get_article_rank_list(); - $data['avatar']=get_author_photo(); - $data['suer_weburl']=get_user_web_url(); - - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'notice')+$data,true); - $data['rank_view']=$this->load->view('rank',$data,true); - $this->load->view('header', array('navbar_active'=>'notice')+$data); + $this->load->view('footer'); + } + + //?н????? + public function undertake() { + $admin_info = $this->session->userdata('session_admin'); + $t_id = $this->input->post('t_id'); + $task = $this->Infotasks_model->detail($t_id); + if (empty($task)) { + $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound')); + echo json_encode($data); + return false; + } + if (empty($task->t_a_id)) { + //?н????? + $this->Infotasks_model->undertake($t_id, $admin_info->a_id); + $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_undertake_success')); + $data[] = array('name' => 'ok_go', 'value' => site_url('welcome/view/' . $t_id)); + echo json_encode($data); + return true; + } else { + $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_has_undertake')); + echo json_encode($data); + return false; + } + } + + //ȡ?????? + public function canceltake() { + $admin_info = $this->session->userdata('session_admin'); + $t_id = $this->input->post('t_id'); + $task = $this->Infotasks_model->detail($t_id); + if (empty($task)) { + $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound')); + echo json_encode($data); + return false; + } + if ($task->t_a_id == $admin_info->a_id) { + //ȡ?????? + $this->Infotasks_model->canceltake($t_id); + $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_canceltake_success')); + $data[] = array('name' => 'ok_go', 'value' => site_url('welcome/view/' . $t_id)); + echo json_encode($data); + return true; + } else { + $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_canceltake_error')); + echo json_encode($data); + return false; + } + } + + public function notice($announce_id = '', $announce_type = 'notice') { + $data = array(); + $data['type'] = $announce_type; + if ($announce_id == '') { + $data['announce_list'] = $this->Infotaskarticles_model->get_announce($announce_id, $announce_type); + } else { + $announce = $this->Infotaskarticles_model->get_announce($announce_id, $announce_type); + $data['announce_detail'] = $announce[0]; + } + $data['author_rank_list'] = $this->Infotasks_model->get_author_rank_list(); + $data['article_rank_list'] = $this->Infotasks_model->get_article_rank_list(); + $data['avatar'] = get_author_photo(); + $data['suer_weburl'] = get_user_web_url(); + + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'notice') + $data, true); + $data['rank_view'] = $this->load->view('rank', $data, true); + $this->load->view('header', array('navbar_active' => 'notice') + $data); $this->load->view('notice'); $this->load->view('footer'); - } + } - public function announce($announce_id=''){ - $this->notice($announce_id,'announce'); - } + public function announce($announce_id = '') { + $this->notice($announce_id, 'announce'); + } - public function help() - { - $data=array(); - $data['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'help')+$data,true); - $this->load->view('header', array('navbar_active'=>'notice')+$data); + public function help() { + $data = array(); + $data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'help') + $data, true); + $this->load->view('header', array('navbar_active' => 'notice') + $data); $this->load->view('help'); $this->load->view('footer'); - } - + } + } /* End of file welcome.php */ diff --git a/author/controllers/welcome.php b/author/controllers/welcome.php index 5c52ec6b..cfd2bbac 100644 --- a/author/controllers/welcome.php +++ b/author/controllers/welcome.php @@ -1,179 +1,183 @@ -permission->is_admin(); //$this->output->enable_profiler(TRUE); - $this->load->model('Infotasks_model'); - $this->load->model('Infotaskarticles_model'); - $this->load->model('InfoSMS_model'); - $this->load->model('Operator_model'); - $this->load->model('Infoauthors_model'); + $this->load->model('Infotasks_model'); + $this->load->model('Infotaskarticles_model'); + $this->load->model('InfoSMS_model'); + $this->load->model('Operator_model'); + $this->load->model('Infoauthors_model'); } //所有任务 - public function index($page=1) - { - $data=array(); - $data=$this->_get_home_base_data(); - //已完成任务使用另一模板 - if($this->input->get('taskstatus')=='complete'){ - $this->in_complete_tasks(); - return; - } - $task_list = $this->_get_task_list(false,$page,site_url("welcome/index")); + public function index($page = 1) { + $data = array(); + $data = $this->_get_home_base_data(); + //已完成任务使用另一模板 + if ($this->input->get('taskstatus') == 'complete') { + $this->in_complete_tasks(); + return; + } + $task_list = $this->_get_task_list(false, $page, site_url("welcome/index")); $data['task_list'] = $task_list['task_list']; - $data['page']=$task_list['page']; - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_all')+$data,true); - $this->load->view('header', array('navbar_active'=>'mytask')+$data); + $data['page'] = $task_list['page']; + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_all') + $data, true); + $this->load->view('header', array('navbar_active' => 'mytask') + $data); $this->load->view('tasklist'); $this->load->view('footer'); - } - //正在编辑的任务 - public function in_edit_tasks($page=1) - { - $data=array(); - $data=$this->_get_home_base_data(); - $task_list = $this->_get_task_list('edit',$page,site_url("welcome/in_edit_tasks")); + } + + //正在编辑的任务 + public function in_edit_tasks($page = 1) { + $data = array(); + $data = $this->_get_home_base_data(); + $task_list = $this->_get_task_list('edit', $page, site_url("welcome/in_edit_tasks")); $data['task_list_in_edit'] = $task_list['task_list']; - $data['page']=$task_list['page']; - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_edit')+$data,true); - $this->load->view('header', array('navbar_active'=>'mytask')+$data); + $data['page'] = $task_list['page']; + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_edit') + $data, true); + $this->load->view('header', array('navbar_active' => 'mytask') + $data); $this->load->view('welcome'); $this->load->view('footer'); - } - //已经完成的任务 - public function in_complete_tasks($page=1) - { - $data=array(); - $data=$this->_get_home_base_data(); - $task_list = $this->_get_task_list('complete',$page,site_url("welcome/in_complete_tasks")); + } + + //已经完成的任务 + public function in_complete_tasks($page = 1) { + $data = array(); + $data = $this->_get_home_base_data(); + $task_list = $this->_get_task_list('complete', $page, site_url("welcome/in_complete_tasks")); $data['task_list'] = $task_list['task_list']; - $data['page']=$task_list['page']; + $data['page'] = $task_list['page']; foreach ($data['task_list'] as $task) { $task->last_version = $this->Infotaskarticles_model->version_last($task->t_id); } - $data['site_config']=$this->config->item('site'); - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_complete')+$data,true); - $this->load->view('header', array('navbar_active'=>'mytask')+$data); + $data['site_config'] = $this->config->item('site'); + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_complete') + $data, true); + $this->load->view('header', array('navbar_active' => 'mytask') + $data); $this->load->view('in_complete'); $this->load->view('footer'); - } - //未通过审核的投稿申请 - public function in_refuse_tasks($page=1) - { - $data=array(); - $data=$this->_get_home_base_data(); - $task_list = $this->_get_task_list('refuse',$page,site_url("welcome/in_refuse_tasks")); + } + + //未通过审核的投稿申请 + public function in_refuse_tasks($page = 1) { + $data = array(); + $data = $this->_get_home_base_data(); + $task_list = $this->_get_task_list('refuse', $page, site_url("welcome/in_refuse_tasks")); $data['task_list'] = $task_list['task_list']; - $data['page']=$task_list['page']; + $data['page'] = $task_list['page']; - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_refuse')+$data,true); - $this->load->view('header', array('navbar_active'=>'mytask')+$data); + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_refuse') + $data, true); + $this->load->view('header', array('navbar_active' => 'mytask') + $data); $this->load->view('in_refuse'); $this->load->view('footer'); - } - - //根据任务状态获取任务列表 - public function task_lists($t_status=false,$page=1){ - $data=array(); - $data=$this->_get_home_base_data(); - $admin_info=$this->session->userdata('session_admin'); - $task_list = $this->_get_task_list($t_status,$page,site_url("welcome/task_lists/$t_status")); + } + + //根据任务状态获取任务列表 + public function task_lists($t_status = false, $page = 1) { + $data = array(); + $data = $this->_get_home_base_data(); + $admin_info = $this->session->userdata('session_admin'); + $task_list = $this->_get_task_list($t_status, $page, site_url("welcome/task_lists/$t_status")); $data['task_list'] = $task_list['task_list']; - $data['page']=$task_list['page']; - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_'.$t_status)+$data,true); - $this->load->view('header', array('navbar_active'=>'mytask')+$data); + $data['page'] = $task_list['page']; + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_' . $t_status) + $data, true); + $this->load->view('header', array('navbar_active' => 'mytask') + $data); $this->load->view('in_refuse'); $this->load->view('footer'); - } - - //获取任务列表 - function _get_task_list($t_status=false,$page=false,$pageurl=false){ - $t_td_type=$start_date=$tasktitle=false; - $end_date=date('Y-m-d'); - if($this->input->get('tasktype') && $this->input->get('tasktype')!='-') $t_td_type=$this->input->get('tasktype'); - if($this->input->get('startdate') && $this->input->get('startdate')!='') $start_date=$this->input->get('startdate'); - if($this->input->get('enddate') && $this->input->get('enddate')!='') $end_date=$this->input->get('enddate'); - if($this->input->get('tasktitle') && $this->input->get('tasktitle')!='') $tasktitle=$this->input->get('tasktitle'); - if(!$t_status && $this->input->get('taskstatus') && $this->input->get('taskstatus')!='-') $t_status=$this->input->get('taskstatus'); + } + + //获取任务列表 + function _get_task_list($t_status = false, $page = false, $pageurl = false) { + $t_td_type = $start_date = $tasktitle = false; + $end_date = date('Y-m-d'); + if ($this->input->get('tasktype') && $this->input->get('tasktype') != '-') + $t_td_type = $this->input->get('tasktype'); + if ($this->input->get('startdate') && $this->input->get('startdate') != '') + $start_date = $this->input->get('startdate'); + if ($this->input->get('enddate') && $this->input->get('enddate') != '') + $end_date = $this->input->get('enddate'); + if ($this->input->get('tasktitle') && $this->input->get('tasktitle') != '') + $tasktitle = $this->input->get('tasktitle'); + if (!$t_status && $this->input->get('taskstatus') && $this->input->get('taskstatus') != '-') + $t_status = $this->input->get('taskstatus'); $admin_info = $this->session->userdata('session_admin'); - + //分页 - $page_task=$this->Infotasks_model->get_tasks_list($t_status,$admin_info->a_id,$t_td_type,$start_date,$end_date,$tasktitle,$page); - $pages['total']=count($page_task); - $pages['pageSize']= 20; - $pages['url'] = $pageurl; - $pages['current']=$page; - $task_list['page']=show_page($pages); + $page_task = $this->Infotasks_model->get_tasks_list($t_status, $admin_info->a_id, $t_td_type, $start_date, $end_date, $tasktitle, $page); + $pages['total'] = count($page_task); + $pages['pageSize'] = 20; + $pages['url'] = $pageurl; + $pages['current'] = $page; + $task_list['page'] = show_page($pages); //获取任务列表 - $task_id_str=0; - $page_task=array_slice($page_task,$pages['pageSize']*($page-1),$pages['pageSize']); + $task_id_str = 0; + $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; } $task_list['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str); return $task_list; - } - - public function _get_home_base_data(){ - $user_data=$this->session->userdata('session_admin'); - $data['author_rank_list']=$this->Infotasks_model->get_author_rank_list(); - $data['article_rank_list']=$this->Infotasks_model->get_article_rank_list(); - //最新公告 - $announce=$this->Infotaskarticles_model->get_announce('','announce'); - $data['announce']=array(); - if(!empty($announce))$data['announce']=$announce; - $data['notice_list']=$this->Infotaskarticles_model->get_announce(); - $data['avatar']=get_author_photo(); - $data['rank_view']=$this->load->view('rank',$data,true); - //获取作者网前url名字组成部分 - $data['suer_weburl']=get_user_web_url(); - return $data; - } - - public function view($t_id) - { - $data=array(); - $data['task']=$this->Infotasks_model->detail($t_id); - $admin_info=$this->session->userdata('session_admin'); - if(empty($data['task'])) - { - show_404(); - return false; - } - $data['task_detail']=$this->Infotaskarticles_model->detail($data['task']->t_id); - $data['task_last_version']=$this->Infotaskarticles_model->version_last($data['task']->t_id); - if(!empty($data['task_detail'])) - { - $data['information']=$this->Infotaskarticles_model->get_information($data['task_detail']->ta_ic_id); - if (isset($data['information']->ic_sitecode)) { - $sitedata=$this->config->item('site'); - $data['sitedata']=$sitedata[$data['information']->ic_sitecode]; - } - //判断任务是否已上线 - $data['task_status']=$this->Infotasks_model->is_in_used($data['task_detail']->ta_id); - } - - if ($data['task']->t_a_id!=$admin_info->a_id and $data['task_detail']->ta_isbest==NULL) { - show_404(); - return false; - } - - switch ($data['task']->t_status) - { - case 'published': - case 'complete': - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_complete')+$data,true); - break; - case 'review': + } + + public function _get_home_base_data() { + $user_data = $this->session->userdata('session_admin'); + $data['author_rank_list'] = $this->Infotasks_model->get_author_rank_list(); + $data['article_rank_list'] = $this->Infotasks_model->get_article_rank_list(); + //最新公告 + $announce = $this->Infotaskarticles_model->get_announce('', 'announce'); + $data['announce'] = array(); + if (!empty($announce)) + $data['announce'] = $announce; + $data['notice_list'] = $this->Infotaskarticles_model->get_announce(); + $data['avatar'] = get_author_photo(); + $data['rank_view'] = $this->load->view('rank', $data, true); + //获取作者网前url名字组成部分 + $data['suer_weburl'] = get_user_web_url(); + return $data; + } + + public function view($t_id) { + $data = array(); + $data['task'] = $this->Infotasks_model->detail($t_id); + $admin_info = $this->session->userdata('session_admin'); + if (empty($data['task'])) { + show_404(); + return false; + } + $data['task_detail'] = $this->Infotaskarticles_model->detail($data['task']->t_id); + $data['task_last_version'] = $this->Infotaskarticles_model->version_last($data['task']->t_id); + if (!empty($data['task_detail'])) { + $data['information'] = $this->Infotaskarticles_model->get_information($data['task_detail']->ta_ic_id); + if (isset($data['information']->ic_sitecode)) { + $sitedata = $this->config->item('site'); + $data['sitedata'] = $sitedata[$data['information']->ic_sitecode]; + } + //判断任务是否已上线 + $data['task_status'] = $this->Infotasks_model->is_in_used($data['task_detail']->ta_id); + } + + if ($data['task']->t_a_id != $admin_info->a_id and $data['task_detail']->ta_isbest == NULL) { + show_404(); + return false; + } + + switch ($data['task']->t_status) { + case 'published': + case 'complete': + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_complete') + $data, true); + break; + case 'review': $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_review') + $data, true); break; case 'reviewed': @@ -182,299 +186,260 @@ class Welcome extends CI_Controller { case 'unreviewed': $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_unreviewed') + $data, true); break; - case 'refuse': - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_refuse')+$data,true); - break; - case 'wait': - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_refuse')+$data,true); - break; - default: - $data['nav_view']=$this->load->view('nav',array('nav_active'=>'in_edit')+$data,true); - break; - } - - //获取短消息列表 - $data['sms_list']=$this->InfoSMS_model->get_task_sms($data['task']->t_id); - $admin_info=$this->session->userdata('session_admin'); - foreach($data['sms_list'] as $sms) - { - if($sms->m_receiver==$admin_info->a_id) - { - $this->InfoSMS_model->readed($sms->m_id); - } - } - $data['admin_info_user']=$admin_info->a_id; - $this->load->view('header', array('navbar_active'=>'mytask')+$data); - if ($data['task']->t_status=='refuse') { - $this->load->view('edit_refuse_task');//未通过审核的投稿 - }else{ - $this->load->view('task_detail'); + case 'refuse': + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_refuse') + $data, true); + break; + case 'wait': + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_refuse') + $data, true); + break; + default: + $data['nav_view'] = $this->load->view('nav', array('nav_active' => 'in_edit') + $data, true); + break; } - $this->load->view('footer'); - } - - public function edit_submit($task_submit=false) - { - $t_id=$this->input->post('t_id'); - $task=$this->Infotasks_model->detail($t_id); - $admin_info=$this->session->userdata('session_admin'); - if ($admin_info->a_id!=$task->t_a_id) { - $data[] = array('name' => 'no', 'value' => 'error:it\'s not your task!'); - echo json_encode($data); - return false; - } - - $task_used=$this->Infotaskarticles_model->detail($t_id); - /*if(empty($task_used)) - { - $data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound')); - echo json_encode($data); - return false; - }*/ - - $task_original=$this->Infotaskarticles_model->detail_original($t_id); - if(empty($task_original)) - { - if (!empty($task_used)) { - //把原始任务状态改为original,防止原始任务信息被删除 - $this->Infotaskarticles_model->set_original($task_used->ta_id); - } - //新建一个任务,状态改为used - $this->Infotaskarticles_model->add($t_id,$this->input->post('ta_ic_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 (!$task_submit) { - $data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save')); - echo json_encode($data); - } - return true; - } - else - { - if(empty($task_used)) - { - $data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound')); - echo json_encode($data); - return false; - } - $this->Infotaskarticles_model->update($task_used->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 (!$task_submit) { - $data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save')); - echo json_encode($data); - } - return true; - } - } - - public function review_submit() - { - if($this->edit_submit(true)) - { - $this->Infotaskarticles_model->add($this->input->post('t_id'),$this->input->post('ta_ic_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'),'version'); - $this->Infotasks_model->reviwed($this->input->post('t_id'),'review'); - //发送消息 - $this->InfoSMS_model->add('task',$this->input->post('t_id'),$this->input->post('ht_user'),$this->input->post('t_a_id'),'Task submitted; please check!'); - $data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit')); - echo json_encode($data); - return true; - } - } - - //发送短消息给管理员 - public function send_to_admin() - { - $t_id=$this->input->post('t_id'); - $task=$this->Infotasks_model->detail($t_id); - if(empty($task)) - { - $data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound')); - echo json_encode($data); - return false; - } - $this->form_validation->set_rules('m_content', 'lang:task_m_content', 'required'); - if ($this->form_validation->run() == FALSE) - { + + //获取短消息列表 + $data['sms_list'] = $this->InfoSMS_model->get_task_sms($data['task']->t_id); + $admin_info = $this->session->userdata('session_admin'); + foreach ($data['sms_list'] as $sms) { + if ($sms->m_receiver == $admin_info->a_id) { + $this->InfoSMS_model->readed($sms->m_id); + } + } + $data['admin_info_user'] = $admin_info->a_id; + $this->load->view('header', array('navbar_active' => 'mytask') + $data); + if ($data['task']->t_status == 'refuse') { + $this->load->view('edit_refuse_task'); //未通过审核的投稿 + } else { + $this->load->view('task_detail'); + } + $this->load->view('footer'); + } + + public function edit_submit($task_submit = false) { + $t_id = $this->input->post('t_id'); + $task = $this->Infotasks_model->detail($t_id); + $admin_info = $this->session->userdata('session_admin'); + if ($admin_info->a_id != $task->t_a_id) { + $data[] = array('name' => 'no', 'value' => 'error:it\'s not your task!'); + echo json_encode($data); + return false; + } + + $task_used = $this->Infotaskarticles_model->detail($t_id); + /* if(empty($task_used)) + { + $data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound')); + echo json_encode($data); + return false; + } */ + + $task_original = $this->Infotaskarticles_model->detail_original($t_id); + if (empty($task_original)) { + if (!empty($task_used)) { + //把原始任务状态改为original,防止原始任务信息被删除 + $this->Infotaskarticles_model->set_original($task_used->ta_id); + } + //新建一个任务,状态改为used + $this->Infotaskarticles_model->add($t_id, $this->input->post('ta_ic_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 (!$task_submit) { + $data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save')); + echo json_encode($data); + } + return true; + } else { + if (empty($task_used)) { + $data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound')); + echo json_encode($data); + return false; + } + $this->Infotaskarticles_model->update($task_used->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 (!$task_submit) { + $data[] = array('name' => 'ok', 'value' => $this->lang->line('script_success_save')); + echo json_encode($data); + } + return true; + } + } + + public function review_submit() { + if ($this->edit_submit(true)) { + $this->Infotaskarticles_model->add($this->input->post('t_id'), $this->input->post('ta_ic_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'), 'version'); + $this->Infotasks_model->reviwed($this->input->post('t_id'), 'review'); + //发送消息 + $this->InfoSMS_model->add('task', $this->input->post('t_id'), $this->input->post('ht_user'), $this->input->post('t_a_id'), 'Task submitted; please check!'); + $data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit')); + echo json_encode($data); + return true; + } + } + + //发送短消息给管理员 + public function send_to_admin() { + $t_id = $this->input->post('t_id'); + $task = $this->Infotasks_model->detail($t_id); + if (empty($task)) { + $data[] = array('name' => 'no', 'value' => $this->lang->line('task_error_notfound')); + echo json_encode($data); + return false; + } + $this->form_validation->set_rules('m_content', 'lang:task_m_content', 'required'); + 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 - { - $this->InfoSMS_model->add('task',$task->t_id,$task->t_ht_op_code,$task->t_a_id,$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_admin=$this->Operator_model->get_user($task->t_ht_op_code); - $this->InfoSMS_model->send_mail($admin_info->a_name, $admin_info->a_email, 'gavin', 'gavin@chinahighlights.com', sprintf($this->lang->line('author_email_message_subject'),$task->t_title), $this->lang->line('author_email_message_body')); - return true; - } - } - - public function create_task() - { - $data=array(); - $data=$this->_get_home_base_data(); - $data['nav_view']=$this->load->view('nav_hall',array('nav_active'=>'create_task')+$data,true); - $this->load->view('header', array('navbar_active'=>'create_task')+$data); + return false; + } else { + $this->InfoSMS_model->add('task', $task->t_id, $task->t_ht_op_code, $task->t_a_id, $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_admin = $this->Operator_model->get_user($task->t_ht_op_code); + $this->InfoSMS_model->send_mail($admin_info->a_name, $admin_info->a_email, 'gavin', 'gavin@chinahighlights.com', sprintf($this->lang->line('author_email_message_subject'), $task->t_title), $this->lang->line('author_email_message_body')); + return true; + } + } + + public function create_task() { + $data = array(); + $data = $this->_get_home_base_data(); + $data['nav_view'] = $this->load->view('nav_hall', array('nav_active' => 'create_task') + $data, true); + $this->load->view('header', array('navbar_active' => 'create_task') + $data); $this->load->view('create_task'); $this->load->view('footer'); - } - - public function create_task_submit() - { - $this->form_validation->set_rules('t_title', 'lang:t_title', 'required'); - $this->form_validation->set_rules('t_content', 'lang:t_content', 'required'); - $this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required'); - if ($this->form_validation->run() == FALSE) - { + } + + public function create_task_submit() { + $this->form_validation->set_rules('t_title', 'lang:t_title', 'required'); + $this->form_validation->set_rules('t_content', 'lang:t_content', 'required'); + $this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required'); + 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 - { - //TODO:暂时把稿件全部发给RURU(zzy),今后会读取各站点的管理员名单 - $admin_info=$this->session->userdata('session_admin'); - $this->Infotasks_model->add( - $this->input->post('t_title'), - $this->input->post('t_content'), - $admin_info->a_id, - 'Gavin', - 'contribute', - $this->input->post('t_expires'), - 'wait', - $this->input->post('t_attach') - ); - $this->Infotaskarticles_model->add($this->Infotasks_model->insert_id,0, '','','','','','',''); - $this->InfoSMS_model->add('task',$this->Infotasks_model->insert_id,'Gavin',$admin_info->a_id,'I have submitted a proposal; please check!'); - - $data[] = array('name' => 'ok', 'value' => $this->lang->line('task_create_success')); - $data[] = array('name'=>'ok_go','value'=>site_url('welcome')); + return false; + } else { + //TODO:暂时把稿件全部发给RURU(zzy),今后会读取各站点的管理员名单 + $admin_info = $this->session->userdata('session_admin'); + $this->Infotasks_model->add( + $this->input->post('t_title'), $this->input->post('t_content'), $admin_info->a_id, 'Gavin', 'contribute', $this->input->post('t_expires'), 'wait', $this->config->item('site_code'), $this->input->post('t_attach') + ); + $this->Infotaskarticles_model->add($this->Infotasks_model->insert_id, 0, '', '', '', '', '', '', ''); + $this->InfoSMS_model->add('task', $this->Infotasks_model->insert_id, 'Gavin', $admin_info->a_id, 'I have submitted a proposal; please check!'); + + $data[] = array('name' => 'ok', 'value' => $this->lang->line('task_create_success')); + $data[] = array('name' => 'ok_go', 'value' => site_url('welcome')); echo json_encode($data); - - return true; - } - } - public function upload_task_attach(){ - $save_path='task_attach'; - $jsfunction='upload_task_attach'; - $upload_id='task_attach'; + return true; + } + } + + public function upload_task_attach() { + $save_path = 'task_attach'; + $jsfunction = 'upload_task_attach'; + $upload_id = 'task_attach'; - $config['upload_path'] = APPPATH.'document/'.$save_path; + $config['upload_path'] = APPPATH . 'document/' . $save_path; $config['allowed_types'] = 'gif|jpg|png|rar|zip|docx|doc|xls|xlsx|ppt'; $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']; echo ""; } - } - - //修改后重新提交投稿申请 - public function update_task(){ - $this->form_validation->set_rules('t_title', 'lang:t_title', 'required'); - $this->form_validation->set_rules('t_content', 'lang:t_content', 'required'); - $this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required'); - if ($this->form_validation->run() == FALSE) - { + } + + //修改后重新提交投稿申请 + public function update_task() { + $this->form_validation->set_rules('t_title', 'lang:t_title', 'required'); + $this->form_validation->set_rules('t_content', 'lang:t_content', 'required'); + $this->form_validation->set_rules('t_expires', 'lang:t_expires', 'required'); + 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{ - //更新任务状态 - $result=$this->Infotasks_model->update( - $this->input->post('t_id'), - $this->input->post('t_title'), - $this->input->post('t_content'), - $this->input->post('t_a_id'), - 'contribute', - $this->input->post('t_expires'), - 'wait', - $this->input->post('t_attach') - ); - if ($result) { - $this->InfoSMS_model->add('task',$this->input->post('t_id'),'Gavin',$this->input->post('t_a_id'),'I have submitted a proposal; please check!'); - $data[] = array('name' => 'ok', 'value' => 'success'); - }else{ - $data[] = array('name' => 'no', 'value' => 'error'); - } - echo json_encode($data); + return false; + } else { + //更新任务状态 + $result = $this->Infotasks_model->update( + $this->input->post('t_id'), $this->input->post('t_title'), $this->input->post('t_content'), $this->input->post('t_a_id'), 'contribute', $this->input->post('t_expires'), 'wait', $this->input->post('t_attach') + ); + if ($result) { + $this->InfoSMS_model->add('task', $this->input->post('t_id'), 'Gavin', $this->input->post('t_a_id'), 'I have submitted a proposal; please check!'); + $data[] = array('name' => 'ok', 'value' => 'success'); + } else { + $data[] = array('name' => 'no', 'value' => 'error'); + } + echo json_encode($data); } - return true; - } - - //删除任务 - public function delete_task($t_id){ - $this->Infotasks_model->delete($t_id); - if ($this->Infotasks_model->delete($t_id)) { - redirect(site_url('welcome/in_refuse_tasks')); - }else{ - header('Location: '.$_SERVER['HTTP_REFERER']); - } - return true; - } - - //返回指定页面路径pagepath在指定时间内的成效信息 - public function get_analytics_by_date($loadtotal=0){ - $data=array(); + return true; + } + + //删除任务 + public function delete_task($t_id) { + $this->Infotasks_model->delete($t_id); + if ($this->Infotasks_model->delete($t_id)) { + redirect(site_url('welcome/in_refuse_tasks')); + } else { + header('Location: ' . $_SERVER['HTTP_REFERER']); + } + return true; + } + + //返回指定页面路径pagepath在指定时间内的成效信息 + 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; + 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 "please check your date";die(); + if ($startdate > $enddate) { + echo "please check your date"; + 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; @@ -483,88 +448,76 @@ class Welcome 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('analytics',$data); + $this->load->view('analytics', $data); } - public function set_readed($m_id) - { - $this->InfoSMS_model->readed($m_id); - echo 'ok'; + public function set_readed($m_id) { + $this->InfoSMS_model->readed($m_id); + echo 'ok'; } - public function search_by_icid(){ - $ic_id_list=$this->input->post('ic_id_list'); - $ic_id_list=rtrim(trim($ic_id_list),',').','; + public function search_by_icid() { + $ic_id_list = $this->input->post('ic_id_list'); + $ic_id_list = rtrim(trim($ic_id_list), ',') . ','; $this->load->model('InfoContents_model'); $data['search_list'] = $this->InfoContents_model->get_ic_contents_by_list($ic_id_list); $data['search_type'] = 'recommended'; - $this->load->view('recommendlist',$data); + $this->load->view('recommendlist', $data); } public function search() { - $this->load->model('Information_model'); + $this->load->model('Information_model'); $data['keywords'] = $this->input->post('keywords'); $search_url = str_replace($this->config->item('site_url'), "", $data['keywords']); $data['search_list'] = $this->Information_model->search_url($search_url); if (count($data['search_list']) === 0) { $data['search_list'] = $this->Information_model->search($data['keywords']); } - $data['ic_id_list']=$this->input->post('ic_id_list')==''?'0':$this->input->post('ic_id_list'); - $this->load->view('recommendlist',$data); + $data['ic_id_list'] = $this->input->post('ic_id_list') == '' ? '0' : $this->input->post('ic_id_list'); + $this->load->view('recommendlist', $data); return TRUE; } //保存自定义配置 - function save_meta() - { - $this->load->model('InfoMetas_model'); - $im_ic_id=$this->input->post('im_ic_id'); - $im_key=$this->input->post('im_key'); - $im_value=$this->input->post('im_value'); - if($im_ic_id && $im_key && $im_value!==false) - { - $meta=$this->InfoMetas_model->get($im_ic_id, $im_key); - if($meta===false) - { + function save_meta() { + $this->load->model('InfoMetas_model'); + $im_ic_id = $this->input->post('im_ic_id'); + $im_key = $this->input->post('im_key'); + $im_value = $this->input->post('im_value'); + if ($im_ic_id && $im_key && $im_value !== false) { + $meta = $this->InfoMetas_model->get($im_ic_id, $im_key); + if ($meta === false) { $this->InfoMetas_model->add($im_ic_id, $im_key, $im_value); - } - else - { + } else { $this->InfoMetas_model->update($im_ic_id, $im_key, $im_value); } $data[] = array('name' => 'ok', 'value' => 'success'); - } - else - { + } else { $data[] = array('name' => 'no', 'value' => 'error'); } echo json_encode($data); return true; } - + //保存自定义配置 - function delete_meta() - { - $this->load->model('InfoMetas_model'); - $im_ic_id=$this->input->post('im_ic_id'); - $im_key=$this->input->post('im_key'); - if($im_ic_id && $im_key) - { + function delete_meta() { + $this->load->model('InfoMetas_model'); + $im_ic_id = $this->input->post('im_ic_id'); + $im_key = $this->input->post('im_key'); + if ($im_ic_id && $im_key) { $this->InfoMetas_model->delete($im_ic_id, $im_key); $data[] = array('name' => 'ok', 'value' => 'success'); - } - else - { + } else { $data[] = array('name' => 'no', 'value' => 'error'); } echo json_encode($data); return true; } - + } diff --git a/author/libraries/permission.php b/author/libraries/permission.php index 5603c5c8..774c2231 100644 --- a/author/libraries/permission.php +++ b/author/libraries/permission.php @@ -6,29 +6,27 @@ if (!defined('BASEPATH')) * 访问权限管理 */ -class Permission -{ +class Permission { var $CI; - public function __construct() - { + public function __construct() { $this->CI = & get_instance(); log_message('debug', "Access permission Class Initialized"); } - function is_admin($auto_redirect=true) - { - if ($this->CI->session->userdata('session_admin') === FALSE) - { - if ($auto_redirect){ - redirect(site_url('login')); - } - else - { - return false; - } + function is_admin($auto_redirect = true) { + $session_admin = $this->CI->session->userdata('session_admin'); + if (empty($session_admin)) { + if ($auto_redirect) { + redirect(site_url('login')); + } else { + return false; + } + } else { + //设置站点代号为用户所属站点 + $this->CI->config->set_item('site_code', isset($session_admin->a_sitecode) ? $session_admin->a_sitecode : 'cht'); } } -} \ No newline at end of file +} diff --git a/author/models/infoauthors_model.php b/author/models/infoauthors_model.php index 70b38408..ac7a0db5 100644 --- a/author/models/infoauthors_model.php +++ b/author/models/infoauthors_model.php @@ -1,222 +1,196 @@ HT = $this->load->database('HT', TRUE); } - - function init() - { - $this->top_num=false; - $this->a_active=false; - $this->a_id=false; - $this->a_email=false; - $this->order_by=" ORDER BY ia.a_name ASC "; - } + + function init() { + $this->top_num = false; + $this->a_active = false; + $this->a_id = false; + $this->a_email = false; + $this->order_by = " ORDER BY ia.a_name ASC "; + } //输入用户名和密码,检查是否可以正确 - function check_login($email, $password) - { - $sql = "SELECT TOP 1 1 \n" - . "FROM infoAuthors ia \n" - . "WHERE ia.a_email = ? \n" - . " AND ia.a_password = ?" - . " AND ia.a_active = 1 "; + function check_login($email, $password) { + $sql = "SELECT TOP 1 1 \n" + . "FROM infoAuthors ia \n" + . "WHERE ia.a_email = ? \n" + . " AND ia.a_password = ?" + . " AND ia.a_active = 1 "; $query = $this->HT->query($sql, array($email, $password)); //print_r($this->HT->queries); - if ($query->num_rows() > 0) - { + if ($query->num_rows() > 0) { return TRUE; - } - else - { + } else { return FALSE; } } //判断是否已注册 - public function check_signup($email){ - $sql = "SELECT TOP 1 1 \n" - . "FROM infoAuthors ia \n" - . "WHERE ia.a_email = ? \n" - . " AND ia.a_active != 2 "; + public function check_signup($email) { + $sql = "SELECT TOP 1 1 \n" + . "FROM infoAuthors ia \n" + . "WHERE ia.a_email = ? \n" + . " AND ia.a_active != 2 "; $query = $this->HT->query($sql, array($email)); - if ($query->num_rows() > 0) - { + if ($query->num_rows() > 0) { return TRUE; - } - else - { + } else { return FALSE; } } - - //已激活作者列表 - function active_list() - { - $this->init(); - $this->a_active=" AND ia.a_active = 1 "; - return $this->get_list(); - } - - //待激活作者列表 - function un_active_list() - { - $this->init(); - $this->a_active=" AND ia.a_active = 0 "; - return $this->get_list(); - } - + + //已激活作者列表 + function active_list() { + $this->init(); + $this->a_active = " AND ia.a_active = 1 "; + return $this->get_list(); + } + + //待激活作者列表 + function un_active_list() { + $this->init(); + $this->a_active = " AND ia.a_active = 0 "; + return $this->get_list(); + } + //获取登录用户详细信息 - function detail($email) - { - $this->init(); - $this->top_num=1; - $this->a_active=" AND ia.a_active <> 2 "; - $this->a_email=" AND ia.a_email=".$this->HT->escape($email); + function detail($email) { + $this->init(); + $this->top_num = 1; + $this->a_active = " AND ia.a_active <> 2 "; + $this->a_email = " AND ia.a_email=" . $this->HT->escape($email); return $this->get_list(); } //获取登录用户详细信息 - function detail_by_id($a_id) - { - $this->init(); - $this->top_num=1; - $this->a_active=" AND ia.a_active <> 2 "; - $this->a_id=" AND ia.a_id=".$this->HT->escape($a_id); + function detail_by_id($a_id) { + $this->init(); + $this->top_num = 1; + $this->a_active = " AND ia.a_active <> 2 "; + $this->a_id = " AND ia.a_id=" . $this->HT->escape($a_id); return $this->get_list(); } - - + //获取用户列表 - function get_list() - { - $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT "; - $sql .= " ia.a_id, \n" - . " ia.a_email, \n" - . " ia.a_password, \n" - . " ia.a_name, \n" - . " ia.a_name_cn, \n" - . " ia.a_mobile_phone, \n" - . " ia.a_phone, \n" - . " ia.a_photo, \n" - . " ia.a_id_card, \n" - . " ia.a_gender, \n" - . " ia.a_address, \n" - . " ia.a_school, \n" - . " ia.a_bank, \n" - . " ia.a_bank_card, \n" - . " ia.a_resume, \n" - . " ia.a_datetime, \n" - . " ia.a_sitecode, \n" - . " ia.a_active \n" - . "FROM infoAuthors ia \n" - . "WHERE 1 = 1 \n"; - $this->a_active ? $sql.=$this->a_active : false; - $this->a_id ? $sql.=$this->a_id : false; - $this->a_email ? $sql.=$this->a_email : 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() { + $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT "; + $sql .= " ia.a_id, \n" + . " ia.a_email, \n" + . " ia.a_password, \n" + . " ia.a_name, \n" + . " ia.a_name_cn, \n" + . " ia.a_mobile_phone, \n" + . " ia.a_phone, \n" + . " ia.a_photo, \n" + . " ia.a_id_card, \n" + . " ia.a_gender, \n" + . " ia.a_address, \n" + . " ia.a_school, \n" + . " ia.a_bank, \n" + . " ia.a_bank_card, \n" + . " ia.a_resume, \n" + . " ia.a_datetime, \n" + . " ISNULL(ia.a_sitecode,'cht') as a_sitecode, \n" + . " ia.a_active \n" + . "FROM infoAuthors ia \n" + . "WHERE 1 = 1 \n"; + $this->a_active ? $sql.=$this->a_active : false; + $this->a_id ? $sql.=$this->a_id : false; + $this->a_email ? $sql.=$this->a_email : 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 add($a_email, $a_password, $a_name, $a_name_cn, $a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume) { + $sql = "INSERT INTO infoAuthors \n" + . " ( \n" + . " a_email, \n" + . " a_password, \n" + . " a_name, \n" + . " a_name_cn, \n" + . " a_photo, \n" + . " a_mobile_phone, \n" + . " a_phone, \n" + . " a_id_card, \n" + . " a_gender, \n" + . " a_address, \n" + . " a_school, \n" + . " a_bank, \n" + . " a_bank_card, \n" + . " a_resume, \n" + . " a_active, \n" + . " a_datetime \n" + . " ) \n" + . "VALUES \n" + . " ( \n" + . " ?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,getdate() \n" + . " )"; + $query = $this->HT->query($sql, array($a_email, $a_password, $a_name, $a_name_cn, $a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume)); + return $query; + } + + //更新用户资料 + function update($a_id, $a_email, $a_name, $a_name_cn, $a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume) { + $sql = "UPDATE infoAuthors \n" + . "SET a_email = ?, \n" + . " a_name = ?, \n" + . " a_name_cn = ?, \n" + . " a_photo = ?, \n" + . " a_mobile_phone = ?, \n" + . " a_phone = ?, \n" + . " a_id_card = ?, \n" + . " a_gender = ?, \n" + . " a_address = ?, \n" + . " a_school = ?, \n" + . " a_bank = ?, \n" + . " a_bank_card = ?, \n" + . " a_resume = ? \n" + . "WHERE a_id = ?"; + $query = $this->HT->query($sql, array($a_email, $a_name, $a_name_cn, $a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume, $a_id)); + return $query; + } + + //设置密码 + function set_password($a_id, $a_password) { + $sql = "UPDATE infoAuthors \n" + . "SET a_password = ? \n" + . "WHERE a_id = ?"; + $query = $this->HT->query($sql, array($a_password, $a_id)); + return $query; } - - //用户注册 - function add($a_email, $a_password, $a_name, $a_name_cn,$a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume) - { - $sql = "INSERT INTO infoAuthors \n" - . " ( \n" - . " a_email, \n" - . " a_password, \n" - . " a_name, \n" - . " a_name_cn, \n" - . " a_photo, \n" - . " a_mobile_phone, \n" - . " a_phone, \n" - . " a_id_card, \n" - . " a_gender, \n" - . " a_address, \n" - . " a_school, \n" - . " a_bank, \n" - . " a_bank_card, \n" - . " a_resume, \n" - . " a_active, \n" - . " a_datetime \n" - . " ) \n" - . "VALUES \n" - . " ( \n" - . " ?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,getdate() \n" - . " )"; - $query = $this->HT->query($sql,array($a_email, $a_password, $a_name, $a_name_cn,$a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume)); - return $query; - } - - //更新用户资料 - function update($a_id,$a_email, $a_name, $a_name_cn,$a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume) - { - $sql = "UPDATE infoAuthors \n" - . "SET a_email = ?, \n" - . " a_name = ?, \n" - . " a_name_cn = ?, \n" - . " a_photo = ?, \n" - . " a_mobile_phone = ?, \n" - . " a_phone = ?, \n" - . " a_id_card = ?, \n" - . " a_gender = ?, \n" - . " a_address = ?, \n" - . " a_school = ?, \n" - . " a_bank = ?, \n" - . " a_bank_card = ?, \n" - . " a_resume = ? \n" - . "WHERE a_id = ?"; - $query = $this->HT->query($sql,array($a_email, $a_name, $a_name_cn,$a_photo, $a_mobile_phone, $a_phone, $a_id_card, $a_gender, $a_address, $a_school, $a_bank, $a_bank_card, $a_resume,$a_id)); - return $query; - } - - //设置密码 - function set_password($a_id,$a_password) - { - $sql = "UPDATE infoAuthors \n" - . "SET a_password = ? \n" - . "WHERE a_id = ?"; - $query=$this->HT->query($sql,array($a_password,$a_id)); - return $query; - } - - //修改用户审核状态 - function reviwed($a_id,$a_active) - { - $sql = "UPDATE infoAuthors \n" - . "SET a_active = ? \n" - . "WHERE a_id = ? "; - return $this->HT->query($sql,array($a_active,$a_id)); - } - - /* + + //修改用户审核状态 + function reviwed($a_id, $a_active) { + $sql = "UPDATE infoAuthors \n" + . "SET a_active = ? \n" + . "WHERE a_id = ? "; + return $this->HT->query($sql, array($a_active, $a_id)); + } + + /* * 发送邮件 */ @@ -235,11 +209,11 @@ class Infoauthors_model extends CI_Model } //判断是否有网前url - public function get_user_weburl($ic_author){ - $sql="select top 1 a_name from infoContents left join infoAuthors on ic_author=a_id where ic_status=1 and ic_author='$ic_author'"; - $query = $this->HT->query($sql); - $result=$query->result(); + public function get_user_weburl($ic_author) { + $sql = "select top 1 a_name from infoContents left join infoAuthors on ic_author=a_id where ic_status=1 and ic_author='$ic_author'"; + $query = $this->HT->query($sql); + $result = $query->result(); return $result; } - -} \ No newline at end of file + +} diff --git a/author/models/infotaskarticles_model.php b/author/models/infotaskarticles_model.php index f476e120..dc4bb64f 100644 --- a/author/models/infotaskarticles_model.php +++ b/author/models/infotaskarticles_model.php @@ -1,42 +1,38 @@ HT = $this->load->database('HT', TRUE); } - - function init() - { - $this->top_num=false; - $this->ta_id=false; - $this->ta_t_id=false; - $this->order_by = " ORDER BY i.ta_id DESC "; - $this->ta_status = false; + + function init() { + $this->top_num = false; + $this->ta_id = false; + $this->ta_t_id = false; + $this->order_by = " ORDER BY i.ta_id DESC "; + $this->ta_status = false; + } + + //获取版本列表 + function version_list($ta_t_id) { + $this->init(); + $this->ta_status = " AND i.ta_status= 'version' "; + $this->ta_t_id = " AND i.ta_t_id= " . $this->HT->escape($ta_t_id); + return $this->get_list(); } - - //获取版本列表 - function version_list($ta_t_id) - { - $this->init(); - $this->ta_status=" AND i.ta_status= 'version' "; - $this->ta_t_id=" AND i.ta_t_id= ".$this->HT->escape($ta_t_id); - return $this->get_list(); - } - - //获取最后的版本 - function version_last($ta_t_id) - { - $sql = "SELECT TOP 1 + + //获取最后的版本 + function version_last($ta_t_id) { + $sql = "SELECT TOP 1 i.ta_id, i.ta_t_id, i.ta_ic_id, @@ -55,199 +51,176 @@ class Infotaskarticles_model extends CI_Model ic.ic_sitecode FROM infotaskarticles i LEFT JOIN infoContents ic ON ic.ic_id=i.ta_ic_id - WHERE 1 = 1 AND i.ta_status= 'version' AND i.ta_t_id= ".$this->HT->escape($ta_t_id)."ORDER BY i.ta_id DESC"; - $query=$this->HT->query($sql); - if ($query->num_rows() > 0) - { - $row = $query->row(); - return $row; - } - else - { - return FALSE; - } - } - - //获取当前编辑版本 - function detail($ta_t_id) - { - $this->init(); - $this->top_num=1; - $this->ta_status=" AND i.ta_status= 'used' "; - $this->ta_t_id=" AND i.ta_t_id= ".$this->HT->escape($ta_t_id); - return $this->get_list(); - } - - //获取原始版本版本 - function detail_original($ta_t_id) - { - if(empty($ta_t_id)) - { - return false; - } - $this->init(); - $this->top_num=1; - $this->ta_status=" AND i.ta_status= 'original' "; - $this->ta_t_id=" AND i.ta_t_id= ".$this->HT->escape($ta_t_id); - return $this->get_list(); - } - - //设置审核字数和金额 - function update_review($ta_t_id,$ta_count,$ta_charge) - { - $sql = "UPDATE infotaskarticles \n" - . "SET ta_count = ? , \n" - . " ta_charge = ? \n" - . "WHERE ta_id = ( \n" - . " SELECT TOP 1 ta_id \n" - . " FROM infotaskarticles \n" - . " WHERE ta_status = 'version' \n" - . " AND ta_t_id = ? \n" - . " ORDER BY \n" - . " ta_id DESC \n" - . " )"; - return $this->HT->query($sql,array($ta_count,$ta_charge,$ta_t_id)); - } - - function get_list() - { - $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT "; - $sql .= " i.ta_id, \n" - . " i.ta_t_id, \n" - . " i.ta_ic_id, \n" - . " i.ta_title, \n" - . " i.ta_content, \n" - . " i.ta_summary, \n" - . " i.ta_seo_title, \n" - . " i.ta_seo_description, \n" - . " i.ta_seo_keywords, \n" - . " i.ta_status, \n" - . " i.ta_photo, \n" - . " i.ta_count, \n" - . " i.ta_charge, \n" - . " i.ta_isbest, \n" - . " i.ta_datetime \n" - . "FROM infotaskarticles i \n" - . "WHERE 1 = 1 "; - $this->ta_id ? $sql.=$this->ta_id : false; - $this->ta_t_id ? $sql.=$this->ta_t_id : false; - $this->ta_status ? $sql.=$this->ta_status : 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(); - } - } - + WHERE 1 = 1 AND i.ta_status= 'version' AND i.ta_t_id= " . $this->HT->escape($ta_t_id) . "ORDER BY i.ta_id DESC"; + $query = $this->HT->query($sql); + if ($query->num_rows() > 0) { + $row = $query->row(); + return $row; + } else { + return FALSE; + } + } + + //获取当前编辑版本 + function detail($ta_t_id) { + $this->init(); + $this->top_num = 1; + $this->ta_status = " AND i.ta_status= 'used' "; + $this->ta_t_id = " AND i.ta_t_id= " . $this->HT->escape($ta_t_id); + return $this->get_list(); + } + + //获取原始版本版本 + function detail_original($ta_t_id) { + if (empty($ta_t_id)) { + return false; + } + $this->init(); + $this->top_num = 1; + $this->ta_status = " AND i.ta_status= 'original' "; + $this->ta_t_id = " AND i.ta_t_id= " . $this->HT->escape($ta_t_id); + return $this->get_list(); + } + + //设置审核字数和金额 + function update_review($ta_t_id, $ta_count, $ta_charge) { + $sql = "UPDATE infotaskarticles \n" + . "SET ta_count = ? , \n" + . " ta_charge = ? \n" + . "WHERE ta_id = ( \n" + . " SELECT TOP 1 ta_id \n" + . " FROM infotaskarticles \n" + . " WHERE ta_status = 'version' \n" + . " AND ta_t_id = ? \n" + . " ORDER BY \n" + . " ta_id DESC \n" + . " )"; + return $this->HT->query($sql, array($ta_count, $ta_charge, $ta_t_id)); + } + + function get_list() { + $this->top_num ? $sql = "SELECT TOP " . $this->top_num : $sql = "SELECT "; + $sql .= " i.ta_id, \n" + . " i.ta_t_id, \n" + . " i.ta_ic_id, \n" + . " i.ta_title, \n" + . " i.ta_content, \n" + . " i.ta_summary, \n" + . " i.ta_seo_title, \n" + . " i.ta_seo_description, \n" + . " i.ta_seo_keywords, \n" + . " i.ta_status, \n" + . " i.ta_photo, \n" + . " i.ta_count, \n" + . " i.ta_charge, \n" + . " i.ta_isbest, \n" + . " i.ta_datetime \n" + . "FROM infotaskarticles i \n" + . "WHERE 1 = 1 "; + $this->ta_id ? $sql.=$this->ta_id : false; + $this->ta_t_id ? $sql.=$this->ta_t_id : false; + $this->ta_status ? $sql.=$this->ta_status : 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 add($ta_t_id,$ta_ic_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo,$ta_status='used') - { - $sql = " INSERT INTO infotaskarticles \n" - . " ( \n" - . " ta_t_id, \n" - . " ta_ic_id, \n" - . " ta_title, \n" - . " ta_content, \n" - . " ta_summary, \n" - . " ta_seo_title, \n" - . " ta_seo_description, \n" - . " ta_seo_keywords, \n" - . " ta_photo, \n" - . " ta_status, \n" - . " ta_count, \n" - . " ta_charge, \n" - . " ta_datetime \n" - . " ) \n" - . " VALUES \n" - . " ( \n" - . " ?,?,N?,N?,N?,N?,N?,N?,?,?,0,0,GETDATE() \n" - . " )"; - $query=$this->HT->query($sql, array($ta_t_id,$ta_ic_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo,$ta_status)); + function add($ta_t_id, $ta_ic_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo, $ta_status = 'used') { + $sql = " INSERT INTO infotaskarticles \n" + . " ( \n" + . " ta_t_id, \n" + . " ta_ic_id, \n" + . " ta_title, \n" + . " ta_content, \n" + . " ta_summary, \n" + . " ta_seo_title, \n" + . " ta_seo_description, \n" + . " ta_seo_keywords, \n" + . " ta_photo, \n" + . " ta_status, \n" + . " ta_count, \n" + . " ta_charge, \n" + . " ta_datetime \n" + . " ) \n" + . " VALUES \n" + . " ( \n" + . " ?,?,N?,N?,N?,N?,N?,N?,?,?,0,0,GETDATE() \n" + . " )"; + $query = $this->HT->query($sql, array($ta_t_id, $ta_ic_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo, $ta_status)); $this->insert_id = $this->HT->last_id('infotaskarticles'); - return $query; - //print_r($this->HT->queries); + return $query; + //print_r($this->HT->queries); + } + + function update($ta_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo) { + $sql = "UPDATE infotaskarticles \n" + . "SET ta_title = N?, \n" + . " ta_content = N?, \n" + . " ta_summary = N?, \n" + . " ta_seo_title = N?, \n" + . " ta_seo_description = N?, \n" + . " ta_seo_keywords = N?, \n" + . " ta_photo = ?, \n" + . " ta_datetime = GETDATE() \n" + . "WHERE ta_id = ?"; + return $this->HT->query($sql, array($ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo, $ta_id)); + } + + //设置任务为原始版本状态 + function set_original($ta_id) { + $sql = "UPDATE infotaskarticles \n" + . "SET ta_status = 'original' \n" + . "WHERE ta_id = ? "; + return $this->HT->query($sql, array($ta_id)); + } + + //关联任务到信息平台 + //把所有任务都关联到新的信息中 + function link($ta_id, $ta_ic_id) { + $sql = "UPDATE infotaskarticles \n" + . "SET ta_ic_id = ? \n" + . "WHERE ta_t_id IN (SELECT TOP 1 ita.ta_t_id \n" + . " FROM infotaskarticles ita \n" + . " WHERE ita.ta_id = ?)"; + $query = $this->HT->query($sql, array($ta_ic_id, $ta_id)); + return $query; } - - function update($ta_id, $ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo) - { - $sql = "UPDATE infotaskarticles \n" - . "SET ta_title = N?, \n" - . " ta_content = N?, \n" - . " ta_summary = N?, \n" - . " ta_seo_title = N?, \n" - . " ta_seo_description = N?, \n" - . " ta_seo_keywords = N?, \n" - . " ta_photo = ?, \n" - . " ta_datetime = GETDATE() \n" - . "WHERE ta_id = ?"; - return $this->HT->query($sql,array($ta_title, $ta_content, $ta_summary, $ta_seo_title, $ta_seo_description, $ta_seo_keywords, $ta_photo,$ta_id)); - } - - - //设置任务为原始版本状态 - function set_original($ta_id) - { - $sql = "UPDATE infotaskarticles \n" - . "SET ta_status = 'original' \n" - . "WHERE ta_id = ? "; - return $this->HT->query($sql,array($ta_id)); - } - - //关联任务到信息平台 - //把所有任务都关联到新的信息中 - function link($ta_id,$ta_ic_id) - { - $sql = "UPDATE infotaskarticles \n" - . "SET ta_ic_id = ? \n" - . "WHERE ta_t_id IN (SELECT TOP 1 ita.ta_t_id \n" - . " FROM infotaskarticles ita \n" - . " WHERE ita.ta_id = ?)"; - $query=$this->HT->query($sql, array($ta_ic_id,$ta_id)); - return $query; - } - - //获取网前url和标题等 - function get_information($ta_id) - { - $sql = "SELECT TOP 1 \n" - . " ic.ic_url, \n" - . " ic.ic_sitecode, \n" - . " ic.ic_title \n" - . "FROM infoContents ic \n" - . "WHERE ic_status = 1 \n" - . " AND ic.ic_id = ?"; - $query=$this->HT->query($sql,array($ta_id)); - if ($query->num_rows() > 0) - { - $row = $query->row(); - return $row; - } - else - { - return FALSE; - } - } - //获取公告列表 - public function get_announce($announce_id='',$announce_type='notice'){ - $map=''; - if ($announce_id!='') { - $map=" AND i.ta_id = $announce_id"; - } - $sql = "SELECT i.ta_id, + //获取网前url和标题等 + function get_information($ta_id) { + $sql = "SELECT TOP 1 \n" + . " ic.ic_url, \n" + . " ic.ic_sitecode, \n" + . " ic.ic_title \n" + . "FROM infoContents ic \n" + . "WHERE ic_status = 1 \n" + . " AND ic.ic_id = ?"; + $query = $this->HT->query($sql, array($ta_id)); + if ($query->num_rows() > 0) { + $row = $query->row(); + return $row; + } else { + return FALSE; + } + } + + //获取公告列表 + public function get_announce($announce_id = '', $announce_type = 'notice') { + $map = ''; + if ($announce_id != '') { + $map = " AND i.ta_id = $announce_id"; + } + $sql = "SELECT i.ta_id, i.ta_title, i.ta_content, i.ta_status, @@ -255,16 +228,17 @@ class Infotaskarticles_model extends CI_Model FROM infotaskarticles i WHERE i.ta_status='announce' AND i.ta_seo_title=? $map ORDER BY i.ta_datetime DESC"; - $query=$this->HT->query($sql,array($announce_type)); - return $query->result(); - } + $query = $this->HT->query($sql, array($announce_type)); + return $query->result(); + } - //根据页面路径获取指定信息页的成效信息 - public function get_analytics_list($kwa_pagepath,$kwa_sitecode,$top=50,$startdate='',$enddate=''){ - $topsql=''; - if($top!=0) $topsql="TOP $top"; + //根据页面路径获取指定信息页的成效信息 + public function get_analytics_list($kwa_pagepath, $kwa_sitecode, $top = 50, $startdate = '', $enddate = '') { + $topsql = ''; + if ($top != 0) + $topsql = "TOP $top"; if ($startdate == '') { - $startdate = time()-7*24*60*60; + $startdate = time() - 7 * 24 * 60 * 60; } if ($enddate == '') { $enddate = time(); @@ -284,19 +258,20 @@ class Infotaskarticles_model extends CI_Model FROM infoKeywordsanalytics WHERE kwa_sitecode = ? AND kwa_pagepath=? AND (kwa_datetime BETWEEN ? and ? ) ORDER BY kwa_pageviews DESC"; - $query = $this->HT->query($sql,array($kwa_sitecode,$kwa_pagepath,$startdate,$enddate)); + $query = $this->HT->query($sql, array($kwa_sitecode, $kwa_pagepath, $startdate, $enddate)); return $query->result(); } //获取任务审核次数 - public function get_review_count($t_id){ - $sql="select count(0) as review_count from infoTaskArticles where ta_t_id=? AND ta_status='version'"; - $query = $this->HT->query($sql,array($t_id)); - $result = $query->result(); - $num=0; - if (!empty($result)) { - $num=$result[0]->review_count; - } + public function get_review_count($t_id) { + $sql = "select count(0) as review_count from infoTaskArticles where ta_t_id=? AND ta_status='version'"; + $query = $this->HT->query($sql, array($t_id)); + $result = $query->result(); + $num = 0; + if (!empty($result)) { + $num = $result[0]->review_count; + } return $num; } -} \ No newline at end of file + +} diff --git a/author/models/infotasks_model.php b/author/models/infotasks_model.php index ef03dc2f..17577b21 100644 --- a/author/models/infotasks_model.php +++ b/author/models/infotasks_model.php @@ -1,220 +1,190 @@ 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_datetime = false; - $this->t_title = false; - $this->t_td_type=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_datetime = false; + $this->t_title = false; + $this->t_td_type = 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 get_task_by_status($t_ht_op_code = false, $t_status = 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) + $this->t_status = " AND t.t_status= '$t_status' "; + if ($t_status == 'review') + $this->t_status = " AND (t.t_status= 'review' OR t.t_status= 'wait')"; + 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' OR t.t_status= 'wait')"; + return $this->get_list(); + } + + //待结算任务 + function in_reviewed($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= 'reviewed' "; + return $this->get_list(); + } + + //已完成任务 + function in_complete($t_ht_op_code = false, $start_date = false, $end_date = false, $t_title = 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_title) + $this->t_title = " AND t.t_title like '%$t_title%' "; + if ($start_date) + $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' "; + $this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published')"; + 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 get_task_by_status($t_ht_op_code=false,$t_status=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) $this->t_status=" AND t.t_status= '$t_status' "; - if($t_status=='review') $this->t_status=" AND (t.t_status= 'review' OR t.t_status= 'wait')"; - 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' OR t.t_status= 'wait')"; - return $this->get_list(); - } - - //待结算任务 - function in_reviewed($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= 'reviewed' "; - return $this->get_list(); - } - - //已完成任务 - function in_complete($t_ht_op_code=false,$start_date=false,$end_date=false,$t_title=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_title) $this->t_title = " AND t.t_title like '%$t_title%' "; - if($start_date) $this->t_datetime = " AND t.t_datetime BETWEEN '$start_date' AND '$end_date' "; - $this->t_status=" AND (t.t_status= 'complete' OR t.t_status= 'published')"; - return $this->get_list(); - } - - //正在编辑的任务 - function in_refuse($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= 'refuse' "; - 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($get_count=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, \n" - . " t.t_attach, \n" - . " t.t_delete \n" - . "FROM infotasks t \n" - . "WHERE t.t_delete = 0 \n"; - if($get_count)$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_a_id ? $sql.=$this->t_a_id : false; - $this->t_td_type ? $sql.=$this->t_td_type : false; - $this->t_title ? $sql.=$this->t_title : false; - - $admin_info=$this->session->userdata('session_admin'); - if(!empty($admin_info->a_sitecode) && trim($this->t_a_id)=="AND t.t_a_id= 0") $sql.= " AND (t.t_sitecode= '$admin_info->a_sitecode' or t.t_sitecode is null) "; - - $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(); - } - } - - //根据给定id字符串获取任务列表 - function get_list_by_taskids($taskids) - { - $sql = "SELECT t.t_id, + + //正在编辑的任务 + function in_refuse($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= 'refuse' "; + 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($get_count = 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, \n" + . " t.t_attach, \n" + . " t.t_sitecode, \n" + . " t.t_delete \n" + . "FROM infotasks t \n" + . "WHERE t.t_delete = 0 \n"; + if ($get_count) + $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_a_id ? $sql.=$this->t_a_id : false; + $this->t_td_type ? $sql.=$this->t_td_type : false; + $this->t_title ? $sql.=$this->t_title : false; + + // $admin_info = $this->session->userdata('session_admin'); + // if (!empty($admin_info->a_sitecode) && trim($this->t_a_id) == "AND t.t_a_id= 0") + // $sql.= " AND (t.t_sitecode= '$admin_info->a_sitecode' or t.t_sitecode is null) "; + $sql.= " AND t.t_sitecode= " . $this->HT->escape($this->config->item('site_code')); + + $this->t_datetime ? $sql.=$this->t_datetime : false; + $this->order_by ? $sql.=$this->order_by : false; + $query = $this->HT->query($sql); + //print_r($this->HT->queries); + if ($this->top_num == 1) { + if ($query->num_rows() > 0) { + $row = $query->row(); + return $row; + } else { + return FALSE; + } + } else { + return $query->result(); + } + } + + //根据给定id字符串获取任务列表 + function get_list_by_taskids($taskids) { + $sql = "SELECT t.t_id, t.t_title, t.t_content, t.t_status, @@ -229,80 +199,75 @@ class Infotasks_model extends CI_Model FROM infotasks t WHERE t.t_id IN ($taskids) ORDER BY t.t_datetime DESC"; - $query=$this->HT->query($sql); - return $query->result(); - } - - //根据不同状态获取任务列表 - public function get_tasks_list($t_status=false,$t_ht_op_code=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); - } - }else{ - $this->t_a_id=" AND t.t_a_id= 0"; - } - //已发布的和已完成的任务计算在已完成的任务里 - if($t_status=='complete') - { - $this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published') "; - } - else if($t_status=='review') - { - $this->t_status=" AND (t.t_status= 'review' OR t.t_status= 'wait')"; - } - else if($t_status) - { - $this->t_status = " AND t.t_status = '$t_status' "; - } - 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); - } + $query = $this->HT->query($sql); + return $query->result(); + } + //根据不同状态获取任务列表 + public function get_tasks_list($t_status = false, $t_ht_op_code = 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); + } + } else { + $this->t_a_id = " AND t.t_a_id<= 0"; + } + //已发布的和已完成的任务计算在已完成的任务里 + if ($t_status == 'complete') { + $this->t_status = " AND (t.t_status= 'complete' OR t.t_status= 'published') "; + } else if ($t_status == 'review') { + $this->t_status = " AND (t.t_status= 'review' OR t.t_status= 'wait')"; + } else if ($t_status) { + $this->t_status = " AND t.t_status = '$t_status' "; + } + 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 add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires,$t_status='edit',$t_attach=NULL) - { - $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_status, \n" - . " t_delete, \n" - . " t_datetime, \n" - . " t_attach \n" - . " ) \n" - . "VALUES \n" - . " ( \n" - . " N?,N?,?,?,?,?,?,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_status,$t_attach)); + function add($t_title, $t_content, $t_a_id, $t_ht_op_code, $t_td_type, $t_expires, $t_status = 'edit', $t_sitecode, $t_attach = NULL) { + $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_status, \n" + . " t_sitecode, \n" + . " t_delete, \n" + . " t_datetime, \n" + . " t_attach \n" + . " ) \n" + . "VALUES \n" + . " ( \n" + . " N?,N?,?,?,?,?,?,?,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_status, $t_sitecode, $t_attach)); $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,$t_status='',$t_attach=false) - { - $t_status_sql=''; - if ($t_status!='') { - $t_status_sql="t_status='$t_status',"; - } - if ($t_attach) { - $t_status_sql.="t_attach = '$t_attach',"; - } - $sql = "UPDATE infotasks SET + function update($t_id, $t_title, $t_content, $t_a_id, $t_td_type, $t_expires, $t_status = '', $t_attach = false) { + $t_status_sql = ''; + if ($t_status != '') { + $t_status_sql = "t_status='$t_status',"; + } + if ($t_attach) { + $t_status_sql.="t_attach = '$t_attach',"; + } + $sql = "UPDATE infotasks SET t_title = N?, t_content = N?, t_a_id = ?, @@ -311,85 +276,81 @@ class Infotasks_model extends CI_Model $t_status_sql t_datetime = GETDATE() 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); + $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) { + $sql = "UPDATE infotasks \n" + . "SET t_status = ? \n" + . "WHERE t_id = ?"; + $query = $this->HT->query($sql, array($t_status, $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) - { - $sql = "UPDATE infotasks \n" - . "SET t_status = ? \n" - . "WHERE t_id = ?"; - $query=$this->HT->query($sql, array($t_status,$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 is_in_used($ta_id){ - $sql="SELECT TOP 1 t_status,ic_status + + //承接任务 + 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 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=='published' AND $result->ic_status==1) { - return 1; - }else{ - return 0; - } - } - } - - //获取任务大厅任务个数 - public function task_hall_count(){ - $result=$this->in_hall(); - $num=count($result); - return $num; - } - - //获取每月优秀文章排行榜 - public function get_article_rank_list(){ - $day_end = date('Y-m-01'); - $day_start = date('Y-m-d', strtotime("$day_end -1 month")); - $sql="SELECT + $query = $this->HT->query($sql, array($ta_id)); + $result = $query->result(); + if (empty($result)) { + return 0; + } else { + $result = $result[0]; + //信息平台和作者平台同时是发布状态时 + if ($result->t_status == 'published' AND $result->ic_status == 1) { + return 1; + } else { + return 0; + } + } + } + + //获取任务大厅任务个数 + public function task_hall_count() { + $result = $this->in_hall(); + $num = count($result); + return $num; + } + + //获取每月优秀文章排行榜 + public function get_article_rank_list() { + $day_end = date('Y-m-01'); + $day_start = date('Y-m-d', strtotime("$day_end -1 month")); + $sql = "SELECT t_id, t_title, t_a_id, @@ -401,58 +362,71 @@ class Infotasks_model extends CI_Model INNER JOIN infoTaskArticles ON t_id=ta_t_id WHERE ta_isbest between ? AND ? ORDER BY t_rating_total DESC"; - $query=$this->HT->query($sql,array($day_start,$day_end)); - $result=$query->result(); - return $result; - } - - //获取最新活跃作者 - public function get_author_rank_list($top=1){ - $sql="SELECT TOP $top t_a_id,t_active_author FROM infotasks WHERE t_active_author is not null"; - $query=$this->HT->query($sql); - $result=$query->result(); - if (!empty($result) && $top==1) { - return $result[0]; - } - return $result; - } - - //获取不同任务状态的任务数量 - public function get_task_count_by_status(){ - $admin_info = $this->session->userdata('session_admin'); - $t_ht_op_code=$admin_info->a_id; - 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; - - //正在进行中的任务=edit+unreviewed的数量 - $edit_count=$unreviewed_count=0; - if(isset($counts['edit']))$edit_count=$counts['edit']; - $counts['edit']=$edit_count; - - $review_count=$wait_count=0; - if(isset($counts['review']))$review_count=$counts['review']; - if(isset($counts['wait']))$wait_count=$counts['wait']; - $counts['review']=$review_count+$wait_count; - - return $counts; - } - return false; + $query = $this->HT->query($sql, array($day_start, $day_end)); + $result = $query->result(); + return $result; + } + + //获取最新活跃作者 + public function get_author_rank_list($top = 1) { + $sql = "SELECT TOP $top t_a_id,t_active_author FROM infotasks WHERE t_active_author is not null"; + $query = $this->HT->query($sql); + $result = $query->result(); + if (!empty($result) && $top == 1) { + return $result[0]; + } + return $result; + } + + //获取不同任务状态的任务数量 + public function get_task_count_by_status() { + $admin_info = $this->session->userdata('session_admin'); + $t_ht_op_code = $admin_info->a_id; + 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']; + $counts['edit'] = $edit_count; + + $review_count = $wait_count = 0; + if (isset($counts['review'])) + $review_count = $counts['review']; + if (isset($counts['wait'])) + $wait_count = $counts['wait']; + $counts['review'] = $review_count + $wait_count; + + return $counts; + } + return false; } -} \ No newline at end of file +} 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/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index ac3d8512..69c5c6de 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -729,6 +729,12 @@ class Index extends CI_Controller { $this->Note_model->update_send($item->pn_txn_id, 'sendfail'); continue; } + + //检测是否是APP订单,默认不处理 + if ((strpos($item->pn_memo, 'China Train Booking') !== false) || (strpos($item->pn_memo, 'ChinaTrainBooking') !== false)) { //APP自动出票的订单不需要处理 + $this->Note_model->update_send($item->pn_txn_id, 'send'); + continue; + } //根据note信息找到订单号 $orderid_info = $this->analysis_orderid($item->pn_invoice); @@ -741,6 +747,7 @@ class Index extends CI_Controller { if (empty($orderid_info)) { $orderid_info = $this->analysis_orderid($item->pn_item_number); } + //找不到订单号,设置为发送失败标示 if (empty($orderid_info)) { @@ -761,6 +768,7 @@ class Index extends CI_Controller { //更新正确的订单信息到记录中,以这个为主 $this->Note_model->set_invoice($item->pn_txn_id, $orderid_info->orderid . '_' . $orderid_info->ordertype); + //检测是否是APP订单,默认不处理 if ($orderid_info->ordertype == 'A') { //APP自动出票的订单不需要处理 $this->Note_model->update_send($item->pn_txn_id, 'send'); continue; From 9815becf8b799e0cc9b3b86afc7fba35d1eaae07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Thu, 4 May 2017 11:21:07 +0800 Subject: [PATCH 09/28] =?UTF-8?q?=E4=BD=9C=E8=80=85=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=A4=9A=E7=BD=91=E7=AB=99=E6=94=AF=E6=8C=81=E5=92=8C=E6=94=B6?= =?UTF-8?q?=E9=9B=86=E5=AE=A2=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/controllers/_confirm.php | 131 ---- .../third_party/order/controllers/confirm.php | 7 + .../order/views/_confirm_order.php | 709 ------------------ .../third_party/order/views/confirm_order.php | 221 +++--- .../third_party/order/views/mailtext.php | 74 +- author/controllers/taskhall.php | 2 +- 6 files changed, 178 insertions(+), 966 deletions(-) delete mode 100644 application/third_party/order/controllers/_confirm.php delete mode 100644 application/third_party/order/views/_confirm_order.php 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 ceb005b0..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 index db9a5354..21d43269 100644 --- a/application/third_party/order/views/confirm_order.php +++ b/application/third_party/order/views/confirm_order.php @@ -5,16 +5,16 @@ - www.chinahighlights.com + China Highlights! Please complete and submit the information. - + - - + + @@ -26,7 +26,7 @@
    @@ -63,7 +63,7 @@

    Please complete and submit the information below.

    -
    +
    @@ -502,9 +502,9 @@
    @@ -578,8 +578,8 @@ Special Assistance/Disability Needs for Customers
    @@ -600,7 +600,7 @@ and your confirmation code, also drug allergy just in case.
    - +
    Thanks,yours OPI_FirstName; ?>
    @@ -633,15 +633,36 @@ and your confirmation code, also drug allergy just in case.
    +
    +
    +
    + + + + + diff --git a/application/third_party/order/views/mailtext.php b/application/third_party/order/views/mailtext.php index e91b9e41..74d577cf 100644 --- a/application/third_party/order/views/mailtext.php +++ b/application/third_party/order/views/mailtext.php @@ -1,69 +1,71 @@ -

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

    +

    + China Highlights is not responsible for any costs or consequences which may arise from failure on your part to provide correct information (For example, wrongly spelt names may cause your flight tickets to be cancelled, incorrect incoming flight number may lead to failure in pick-up etc.).
    +

    - Passenger Information + Passenger Information

    - $sur) { ?> - -

    Passenger

    -

    Sur name/First and Middle name:

    -

    Passport No.:

    -

    Passport Expiration Date:

    -

    Birthday:

    + +

    Passenger

    +

    Sur name/First and Middle name:

    +

    Passport No.:

    +

    Passport Expiration Date:

    +

    Birthday:

    Contact Information

    -

    Land line:

    -

    Mobile:

    -

    Home Address:

    +

    Land line:

    +

    Mobile:

    +

    Home Address:

    - Flight Information + Flight Information

    -

    Arrival China Flight No.:

    +

    Arrival China Flight No.:

    - Arrival time: + Arrival time:

    - Departure China Flight no.: + Departure China Flight no.:

    - Departure time: + Departure time:

    - Special Request + Special Request

    - -
    + +

    - Insurance Information + Insurance Information

    - -
    + +

    - Emergency Contact Information + Emergency Contact Information

    - Contact person name: + Contact person name:

    - Relationship with him/her: + Relationship with him/her:

    - E-mail address: + E-mail address:

    - Telephone no.: + Telephone no.:

    \ No newline at end of file diff --git a/author/controllers/taskhall.php b/author/controllers/taskhall.php index 08d2b972..7a0a4c8c 100644 --- a/author/controllers/taskhall.php +++ b/author/controllers/taskhall.php @@ -79,7 +79,7 @@ class Taskhall extends CI_Controller { echo json_encode($data); return false; } - if (empty($task->t_a_id)) { + if ($task->t_a_id<=0) { //?н????? $this->Infotasks_model->undertake($t_id, $admin_info->a_id); $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_undertake_success')); From 622692b031f2144d16a52e84a7947bd39ea60918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Thu, 4 May 2017 11:35:30 +0800 Subject: [PATCH 10/28] =?UTF-8?q?=E6=94=B6=E9=9B=86=E5=AE=A2=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=94=B9=E4=B8=BAHTTPS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/order/views/link_tips.php | 10 +-- .../third_party/order/views/link_tips2.php | 74 ------------------- 2 files changed, 5 insertions(+), 79 deletions(-) delete mode 100644 application/third_party/order/views/link_tips2.php diff --git a/application/third_party/order/views/link_tips.php b/application/third_party/order/views/link_tips.php index 773b5273..f3b12a57 100644 --- a/application/third_party/order/views/link_tips.php +++ b/application/third_party/order/views/link_tips.php @@ -7,14 +7,14 @@ www.chinahighlights.com - + - + @@ -27,7 +27,7 @@
    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 abdac1e0..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 From 45a7b4c796173432b118dae234a88c61cd67122f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Thu, 4 May 2017 11:54:22 +0800 Subject: [PATCH 11/28] =?UTF-8?q?=E6=94=B6=E9=9B=86=E5=AE=A2=E4=BA=BA?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96=E6=A0=87?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/third_party/order/views/link_tips.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/third_party/order/views/link_tips.php b/application/third_party/order/views/link_tips.php index f3b12a57..01e775f9 100644 --- a/application/third_party/order/views/link_tips.php +++ b/application/third_party/order/views/link_tips.php @@ -4,7 +4,7 @@ - www.chinahighlights.com + Thanks for booking with China Highlights! @@ -15,7 +15,7 @@ - + From 68a40f4e981b58bcf13dc0493a2f3bbf6632d3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Tue, 9 May 2017 10:10:15 +0800 Subject: [PATCH 12/28] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BD=9C=E8=80=85?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=92=8C=E4=BF=A1=E6=81=AF=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?session=E5=92=8Ccookies=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- author/config/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/author/config/config.php b/author/config/config.php index 320926c8..2b8578b3 100644 --- a/author/config/config.php +++ b/author/config/config.php @@ -244,12 +244,12 @@ $config['encryption_key'] = 'pliy3rgYcV9lXeKWaO6P_author'; | 'sess_time_to_update' = how many seconds between CI refreshing Session Information | */ -$config['sess_cookie_name'] = 'ci_session'; +$config['sess_cookie_name'] = 'ci_session_author'; $config['sess_expiration'] = 0; $config['sess_expire_on_close'] = FALSE; $config['sess_encrypt_cookie'] = FALSE; $config['sess_use_database'] = FALSE; -$config['sess_table_name'] = 'ci_sessions'; +$config['sess_table_name'] = 'ci_sessions_author'; $config['sess_match_ip'] = FALSE; $config['sess_match_useragent'] = TRUE; $config['sess_time_to_update'] = 300; From cf546541d97555e3952098f8af3d0966dc6a5796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Tue, 9 May 2017 11:49:57 +0800 Subject: [PATCH 13/28] =?UTF-8?q?=E5=8A=A0=E5=AF=86cookies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- author/config/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/author/config/config.php b/author/config/config.php index 2b8578b3..8bf89541 100644 --- a/author/config/config.php +++ b/author/config/config.php @@ -245,9 +245,9 @@ $config['encryption_key'] = 'pliy3rgYcV9lXeKWaO6P_author'; | */ $config['sess_cookie_name'] = 'ci_session_author'; -$config['sess_expiration'] = 0; +$config['sess_expiration'] = 7200; $config['sess_expire_on_close'] = FALSE; -$config['sess_encrypt_cookie'] = FALSE; +$config['sess_encrypt_cookie'] = true; $config['sess_use_database'] = FALSE; $config['sess_table_name'] = 'ci_sessions_author'; $config['sess_match_ip'] = FALSE; From a6da9968b8226a1b03149a0ae3f418186700ad84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Tue, 9 May 2017 12:02:28 +0800 Subject: [PATCH 14/28] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BD=9C=E8=80=85?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/author.php | 6 +++--- author/language/english/form_validation_lang.php | 2 +- author/models/infoauthors_model.php | 2 +- author/views/signup.php | 2 +- info.php | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/application/controllers/author.php b/application/controllers/author.php index 400326a7..c19d27db 100644 --- a/application/controllers/author.php +++ b/application/controllers/author.php @@ -563,14 +563,14 @@ class Author extends CI_Controller { 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)) { //如果指定用户则发送邮件通知 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'); } @@ -746,7 +746,7 @@ class Author extends CI_Controller { $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); } diff --git a/author/language/english/form_validation_lang.php b/author/language/english/form_validation_lang.php index fb32ad36..e7d30e32 100644 --- a/author/language/english/form_validation_lang.php +++ b/author/language/english/form_validation_lang.php @@ -49,6 +49,6 @@ $lang['script_success_save']="Your script has been saved successfully."; $lang['author_email_message_subject']='Message,%s'; -$lang['author_email_message_body']='You have a new message on the China Highlights Content Management System. Please log in at http://i.chtcdn.com/info.php/author'; +$lang['author_email_message_body']='You have a new message on the China Highlights Content Management System. Please log in at http://author.mycht.cn'; diff --git a/author/models/infoauthors_model.php b/author/models/infoauthors_model.php index ac7a0db5..ae57b06c 100644 --- a/author/models/infoauthors_model.php +++ b/author/models/infoauthors_model.php @@ -204,7 +204,7 @@ class Infoauthors_model extends CI_Model { . " ( \n" . " ?, ?, ?, ?, ?, ?, ?, ?, 0 \n" . " ) "; - $query = $this->HT->query($sql, array($fromName, $fromEmail, $toName, $toEmail, $subject, $body, 'Author', 'http://a.chtcdn.com')); + $query = $this->HT->query($sql, array($fromName, $fromEmail, $toName, $toEmail, $subject, $body, 'Author', 'http://author.mycht.cn')); return $query; } diff --git a/author/views/signup.php b/author/views/signup.php index c578ee66..204d53cf 100644 --- a/author/views/signup.php +++ b/author/views/signup.php @@ -112,7 +112,7 @@ Van Hinsbergh

    1. The user agrees to write/edit web -content for www.chinahighlights.com to the following standard. For more details see Freelancer +content for www.chinahighlights.com to the following standard. For more details see Freelancer Article Requirements and Ratings.

    diff --git a/info.php b/info.php index 1898502e..fa440314 100644 --- a/info.php +++ b/info.php @@ -72,8 +72,8 @@ if (defined('ENVIRONMENT')) * NO TRAILING SLASH! * */ -if ($_SERVER['HTTP_HOST']=='a.chtcdn.com') { - header('Location: http://a.cdnch.com/');exit; +if ($_SERVER['HTTP_HOST']=='a.chtcdn.com' || $_SERVER['HTTP_HOST']=='a.cdnch.com') { + header('Location: http://author.mycht.cn/');exit; $application_folder = 'author'; }else{ $application_folder = 'application'; From 47b6934218b3eeaaedaaa03c5340afdef82255b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Thu, 11 May 2017 09:46:52 +0800 Subject: [PATCH 15/28] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=8D=95=E8=AF=8D=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BD=9C=E8=80=85=E5=B9=B3=E5=8F=B0=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- author/controllers/login.php | 4 ++-- author/views/author_field.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/author/controllers/login.php b/author/controllers/login.php index 0be9ffd9..5d67caf1 100644 --- a/author/controllers/login.php +++ b/author/controllers/login.php @@ -199,8 +199,8 @@ class Login extends CI_Controller { $fromEmail = 'noreply02@chinahighlights.net'; $toName = $userdata->a_name; $toEmail = $userdata->a_email; - $subject = 'Your password for "http://a.chtcdn.com"'; - $body = 'Your password for "http://a.chtcdn.com" : ' . $userdata->a_password . '



    For security please change your password once logged in.'; + $subject = 'Your password for "http://author.mycht.cn"'; + $body = 'Your password for "http://author.mycht.cn" : ' . $userdata->a_password . '



    For security please change your password once logged in.'; $is_sendmail = $this->Infoauthors_model->SendMail($fromName, $fromEmail, $toName, $toEmail, $subject, $body); if ($is_sendmail) { $data[] = array('name' => 'ok', 'value' => 'Action successful. Your password has been emailed to you.'); diff --git a/author/views/author_field.php b/author/views/author_field.php index 4b2fb74f..74936d9c 100644 --- a/author/views/author_field.php +++ b/author/views/author_field.php @@ -22,7 +22,7 @@

    - +
    From bcd6208fd83b7ce3a02e3c3740dd5473b161ed65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Thu, 11 May 2017 17:27:07 +0800 Subject: [PATCH 16/28] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E6=A1=86=E9=81=AE=E6=8C=A1=E8=BE=93=E5=85=A5=E6=A1=86=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- author/views/signup.php | 404 ++++++++++++++++++++-------------------- 1 file changed, 202 insertions(+), 202 deletions(-) diff --git a/author/views/signup.php b/author/views/signup.php index 204d53cf..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; ?> 查看
    + + + + +
    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.

    + + From 4c315b31d6599d8fea8886919d0b154470de6cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Tue, 6 Jun 2017 15:56:44 +0800 Subject: [PATCH 26/28] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/third_party/train/controllers/auto.php | 7 +++++-- application/third_party/train/models/BIZ_train_model.php | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/application/third_party/train/controllers/auto.php b/application/third_party/train/controllers/auto.php index 395f4de3..8baf7700 100644 --- a/application/third_party/train/controllers/auto.php +++ b/application/third_party/train/controllers/auto.php @@ -49,7 +49,7 @@ class Auto extends CI_Controller{ } //用于自动出票,接收COLI_SN - public function auto_pay_ticket($coli_sn){ + public function auto_pay_ticket($coli_sn=false){ date_default_timezone_set('Asia/Shanghai'); // $coli_sn="473013018"; //$coli_sn = $this->input->post("coli_sn"); @@ -63,6 +63,7 @@ class Auto extends CI_Controller{ $list->info=array(); foreach ($cold_sn as $v) { //print_r(empty($this->BIZ_train_model->auto_check_pullticket($v->COLD_SN))); + //是否已经出过票 if(empty($this->BIZ_train_model->auto_check_pullticket($v->COLD_SN))){ $back_data = 1; break; @@ -76,15 +77,17 @@ class Auto extends CI_Controller{ $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); - +//乘客人数大于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; diff --git a/application/third_party/train/models/BIZ_train_model.php b/application/third_party/train/models/BIZ_train_model.php index 17688ca1..0c8bf4f3 100644 --- a/application/third_party/train/models/BIZ_train_model.php +++ b/application/third_party/train/models/BIZ_train_model.php @@ -7,8 +7,8 @@ class BIZ_train_model extends CI_Model { $this->HT = $this->load->database('HT', TRUE); } - function auto_check_ticket(){ - $sql = "select top 200 * from BIZ_ConfirmLineInfo bcli left join BIZ_Guest bg on bcli.COLI_GUT_SN = bg.GUT_SN where COLI_ServiceType = '2' and COLI_State ='62' ORDER BY bcli.COLI_SN DESC"; + function auto_check_ticket($topnum=5){ + $sql = "select top $topnum * from BIZ_ConfirmLineInfo bcli left join BIZ_Guest bg on bcli.COLI_GUT_SN = bg.GUT_SN where COLI_ServiceType = '2' and COLI_State ='62' AND bcli.COLI_WebCode='CHT' ORDER BY bcli.COLI_SN DESC"; $query = $this->HT->query($sql); return $query->result(); } From 52c765e874581227bb10c3a1e747cdf3f40a1e71 Mon Sep 17 00:00:00 2001 From: cyc Date: Thu, 8 Jun 2017 13:12:51 +0800 Subject: [PATCH 27/28] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=87=BA=E7=A5=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/train/controllers/auto.php | 163 +++++++++--------- .../train/models/BIZ_train_model.php | 24 ++- .../train/models/sendmail_model.php | 80 +++++++++ 3 files changed, 185 insertions(+), 82 deletions(-) create mode 100644 application/third_party/train/models/sendmail_model.php diff --git a/application/third_party/train/controllers/auto.php b/application/third_party/train/controllers/auto.php index 8baf7700..0a11ea14 100644 --- a/application/third_party/train/controllers/auto.php +++ b/application/third_party/train/controllers/auto.php @@ -37,84 +37,85 @@ class Auto extends CI_Controller{ $this->load->model("BIZ_train_model");//加载模型 } - - public function auto_check_ticket(){ - $ticket_info = $this->BIZ_train_model->auto_check_ticket(); - print_r($ticket_info); - foreach($ticket_info as $value){ - if(strlen($value->GUT_Passport) < 18){ - $this->auto_pay_ticket($value->COLI_SN); - } - } - } - //用于自动出票,接收COLI_SN - public function auto_pay_ticket($coli_sn=false){ + //用于自动出票 + 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) { - //print_r(empty($this->BIZ_train_model->auto_check_pullticket($v->COLD_SN))); - //是否已经出过票 - if(empty($this->BIZ_train_model->auto_check_pullticket($v->COLD_SN))){ - $back_data = 1; - break; + $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($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); -//乘客人数大于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; - } - + + 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"); @@ -146,6 +147,7 @@ class Auto extends CI_Controller{ echo json_encode($reback); return false; } + //前面做过判断,为什么还要再判断一次 if (count($data['people_list']) > 5) { //显示错误,用户超过五个 $reback["mes"]="乘客不能超过五个"; @@ -201,7 +203,7 @@ class Auto extends CI_Controller{ print_r($url); print_r($post_data); die(); - // $bakc_json=$this->post_data($url,$post_data); + //$bakc_json=$this->post_data($url,$post_data); $bakc=json_decode($bakc_json);//json=>obj $add_data=new StdClass(); @@ -221,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"); @@ -266,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"); @@ -273,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){ @@ -285,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(){ diff --git a/application/third_party/train/models/BIZ_train_model.php b/application/third_party/train/models/BIZ_train_model.php index 0c8bf4f3..d63a33f2 100644 --- a/application/third_party/train/models/BIZ_train_model.php +++ b/application/third_party/train/models/BIZ_train_model.php @@ -7,16 +7,32 @@ class BIZ_train_model extends CI_Model { $this->HT = $this->load->database('HT', TRUE); } + //自动获取符合自动出票要求的订单的coli_sn function auto_check_ticket($topnum=5){ - $sql = "select top $topnum * from BIZ_ConfirmLineInfo bcli left join BIZ_Guest bg on bcli.COLI_GUT_SN = bg.GUT_SN where COLI_ServiceType = '2' and COLI_State ='62' AND bcli.COLI_WebCode='CHT' ORDER BY bcli.COLI_SN DESC"; + $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 auto_check_pullticket($coli_sn){ - $sql = "SELECT * FROM BIZ_JuheOrderList where JOL_COLD_SN = '$coli_sn'"; + //自动出票成功后更新订单的状态 + 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->row(); + return $query; } function biz_order_detail($cold_sn) { 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 From cb7b181c7f35a599d17c34adefea92885bad4a91 Mon Sep 17 00:00:00 2001 From: cyc Date: Thu, 8 Jun 2017 13:26:16 +0800 Subject: [PATCH 28/28] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B9=98=E5=AE=A2?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E4=B8=AD=E4=BB=BB=E6=84=8F=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/third_party/train/controllers/auto.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/third_party/train/controllers/auto.php b/application/third_party/train/controllers/auto.php index 0a11ea14..5f1b5dfb 100644 --- a/application/third_party/train/controllers/auto.php +++ b/application/third_party/train/controllers/auto.php @@ -162,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: