From 515b265b2326829c1236bf1a5df30a058bcc1ebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Sun, 30 Apr 2017 16:24:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E7=BD=91=E7=AB=99=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E4=BD=BF=E7=94=A8=E4=BD=9C=E8=80=85=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/author.php | 658 +++++---- application/controllers/information.php | 2 - application/controllers/login.php | 8 +- application/models/infotasks_model.php | 778 ++++++----- .../views/bootstrap/author/author_list.php | 8 +- .../views/bootstrap/author/task_create.php | 1192 ++++++++--------- author/config/config.php | 6 +- author/controllers/index.html | 10 - author/controllers/login.php | 263 ++-- author/controllers/taskhall.php | 261 ++-- author/controllers/welcome.php | 823 ++++++------ author/libraries/permission.php | 30 +- author/models/infoauthors_model.php | 366 +++-- author/models/infotaskarticles_model.php | 455 +++---- author/models/infotasks_model.php | 786 ++++++----- author/views/read_task.php | 302 ++--- .../third_party/paypal/controllers/index.php | 8 + 17 files changed, 2868 insertions(+), 3088 deletions(-) delete mode 100644 author/controllers/index.html diff --git a/application/controllers/author.php b/application/controllers/author.php index 47c567ad..400326a7 100644 --- a/application/controllers/author.php +++ b/application/controllers/author.php @@ -20,17 +20,19 @@ class Author extends CI_Controller { $this->load->model('Infoauthors_model'); $this->load->model('InfoSMS_model'); } - public function index($loadexcel='notexcel',$page=1){ + + public function index($loadexcel = 'notexcel', $page = 1) { $this->load->library('accesscheck'); $this->accesscheck->check_access(); //获取任务状态 - $request_form='get'; - if($loadexcel=='loadexcel')$request_form='post'; - $t_status=$this->input->$request_form('taskstatus'); - if($t_status=="-")$t_status=false; + $request_form = 'get'; + if ($loadexcel == 'loadexcel') + $request_form = 'post'; + $t_status = $this->input->$request_form('taskstatus'); + if ($t_status == "-") + $t_status = false; //根据任务状态加载视图模板 - switch (trim($t_status)) - { + switch (trim($t_status)) { case 'edit': $this->in_edit_tasks($loadexcel); break; @@ -39,7 +41,7 @@ class Author extends CI_Controller { break; case 'reviewed': $this->in_reviewed_tasks($loadexcel); - break; + break; case 'complete': $this->in_complete_tasks($loadexcel); break; @@ -49,14 +51,14 @@ class Author extends CI_Controller { default: //获取作者列表 $data['author_list'] = $this->Infoauthors_model->active_list(); - $task_list = $this->_get_tasks_list(false,$loadexcel,$page,site_url("author/index/$loadexcel")); + $task_list = $this->_get_tasks_list(false, $loadexcel, $page, site_url("author/index/$loadexcel")); $data['task_list'] = $task_list['task_list']; //导出数据到excel表格 - if ($loadexcel=='loadexcel') { + if ($loadexcel == 'loadexcel') { $this->load_to_excel($data['task_list']); return; } - $data['page']=$task_list['page']; + $data['page'] = $task_list['page']; $data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'all_tasks'), true); $this->load->view('bootstrap/header', $data); $this->load->view("bootstrap/author/index"); @@ -65,15 +67,15 @@ class Author extends CI_Controller { } //进行中任务列表 - public function in_edit_tasks($loadexcel='notexcel',$page=false) { - $task_list = $this->_get_tasks_list('edit',$loadexcel,$page,site_url("author/in_edit_tasks/$loadexcel")); + public function in_edit_tasks($loadexcel = 'notexcel', $page = false) { + $task_list = $this->_get_tasks_list('edit', $loadexcel, $page, site_url("author/in_edit_tasks/$loadexcel")); $data['task_list'] = $task_list['task_list']; //导出数据到excel表格 - if ($loadexcel=='loadexcel') { + if ($loadexcel == 'loadexcel') { $this->load_to_excel($data['task_list']); return; } - $data['page']=$task_list['page']; + $data['page'] = $task_list['page']; $data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_edit'), true); $this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/author/welcome'); @@ -81,15 +83,15 @@ class Author extends CI_Controller { } //待审核任务列表 - public function in_review_tasks($loadexcel='notexcel',$page=false) { - $task_list = $this->_get_tasks_list('review',$loadexcel,$page,site_url("author/index/$loadexcel")); + public function in_review_tasks($loadexcel = 'notexcel', $page = false) { + $task_list = $this->_get_tasks_list('review', $loadexcel, $page, site_url("author/index/$loadexcel")); $data['task_list'] = $task_list['task_list']; //导出数据到excel表格 - if ($loadexcel=='loadexcel') { + if ($loadexcel == 'loadexcel') { $this->load_to_excel($data['task_list']); return; } - $data['page']=$task_list['page']; + $data['page'] = $task_list['page']; $data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_review'), true); $this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/author/welcome'); @@ -97,9 +99,9 @@ class Author extends CI_Controller { } //待结算任务列表 - public function in_reviewed_tasks($loadexcel='notexcel',$page=false) { + public function in_reviewed_tasks($loadexcel = 'notexcel', $page = false) { //获取任务列表 - $task_list = $this->_get_tasks_list('reviewed',$loadexcel,$page,site_url("author/index/$loadexcel")); + $task_list = $this->_get_tasks_list('reviewed', $loadexcel, $page, site_url("author/index/$loadexcel")); $data['task_list'] = $task_list['task_list']; //获取作者列表 $data['author_list'] = $this->Infoauthors_model->active_list(); @@ -107,18 +109,18 @@ class Author extends CI_Controller { $task->last_version = $this->Infotaskarticles_model->version_last($task->t_id); } //导出数据到excel表格 - if ($loadexcel=='loadexcel') { + if ($loadexcel == 'loadexcel') { $this->load_to_excel($data['task_list']); return; } //获取最活跃作者 - $active_author=array(); - $data['isset_active_author']=$this->Infotasks_model->is_active_author(); - if (!empty($data['task_list']) && $data['isset_active_author']!=1) { - $active_author=$this->Infotasks_model->get_author_count(); + $active_author = array(); + $data['isset_active_author'] = $this->Infotasks_model->is_active_author(); + if (!empty($data['task_list']) && $data['isset_active_author'] != 1) { + $active_author = $this->Infotasks_model->get_author_count(); } - $data['page']=$task_list['page']; - $data['active_author']=$active_author; + $data['page'] = $task_list['page']; + $data['active_author'] = $active_author; $data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_reviewed'), true); $this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/author/task_list_reviewed'); @@ -126,16 +128,16 @@ class Author extends CI_Controller { } //待审核投稿 - public function in_wait_tasks($loadexcel='notexcel',$page=false) { + public function in_wait_tasks($loadexcel = 'notexcel', $page = false) { $admin_info = $this->session->userdata('session_admin'); - $task_list = $this->_get_tasks_list('wait',$loadexcel,$page,site_url("author/index/$loadexcel")); + $task_list = $this->_get_tasks_list('wait', $loadexcel, $page, site_url("author/index/$loadexcel")); $data['task_list'] = $task_list['task_list']; //导出数据到excel表格 - if ($loadexcel=='loadexcel') { + if ($loadexcel == 'loadexcel') { $this->load_to_excel($data['task_list']); return; } - $data['page']=$task_list['page']; + $data['page'] = $task_list['page']; $data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_wait'), true); $this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/author/welcome'); @@ -143,20 +145,20 @@ class Author extends CI_Controller { } //已完成任务列表 - public function in_complete_tasks($loadexcel='notexcel',$page=1) { + public function in_complete_tasks($loadexcel = 'notexcel', $page = 1) { $data['author_list'] = $this->Infoauthors_model->active_list(); - $task_list = $this->_get_tasks_list('complete',$loadexcel,$page,site_url("author/in_complete_tasks/$loadexcel")); + $task_list = $this->_get_tasks_list('complete', $loadexcel, $page, site_url("author/in_complete_tasks/$loadexcel")); $data['task_list'] = $task_list['task_list']; foreach ($data['task_list'] as $t) { $t->last_version = $this->Infotaskarticles_model->version_last($t->t_id); } //导出数据到excel表格 - if ($loadexcel=='loadexcel') { + if ($loadexcel == 'loadexcel') { $this->load_to_excel($data['task_list']); return; } - $data['page']=$task_list['page']; - $data['site_config']=$this->config->item('site'); + $data['page'] = $task_list['page']; + $data['site_config'] = $this->config->item('site'); $data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'in_complete'), true); $this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/author/task_list_complete'); @@ -164,42 +166,50 @@ class Author extends CI_Controller { } //查询任务列表 - public function _get_tasks_list($t_status=false,$loadexcel=false,$page=false,$pageurl=false){ + public function _get_tasks_list($t_status = false, $loadexcel = false, $page = false, $pageurl = false) { //异步获取任务列表时数据提交方式为get,导出数据时则为post - $request_form='get'; - if($loadexcel=='loadexcel')$request_form='post'; + $request_form = 'get'; + if ($loadexcel == 'loadexcel') + $request_form = 'post'; //任务过滤参数初始化 - $t_a_id=$t_td_type=$start_date=$tasktitle=false; - $end_date=date('Y-m-d'); - if($this->input->$request_form('author') && $this->input->$request_form('author')!=0) $t_a_id=$this->input->$request_form('author'); - if($this->input->$request_form('tasktype') && $this->input->$request_form('tasktype')!='-') $t_td_type=$this->input->$request_form('tasktype'); - if($this->input->$request_form('startdate') && $this->input->$request_form('startdate')!='') $start_date=$this->input->$request_form('startdate'); - if($this->input->$request_form('enddate') && $this->input->$request_form('enddate')!='') $end_date=$this->input->$request_form('enddate'); - if($this->input->$request_form('tasktitle') && $this->input->$request_form('tasktitle')!='') $tasktitle=$this->input->$request_form('tasktitle'); + $t_a_id = $t_td_type = $start_date = $tasktitle = false; + $end_date = date('Y-m-d'); + if ($this->input->$request_form('author') && $this->input->$request_form('author') != 0) + $t_a_id = $this->input->$request_form('author'); + if ($this->input->$request_form('tasktype') && $this->input->$request_form('tasktype') != '-') + $t_td_type = $this->input->$request_form('tasktype'); + if ($this->input->$request_form('startdate') && $this->input->$request_form('startdate') != '') + $start_date = $this->input->$request_form('startdate'); + if ($this->input->$request_form('enddate') && $this->input->$request_form('enddate') != '') + $end_date = $this->input->$request_form('enddate'); + if ($this->input->$request_form('tasktitle') && $this->input->$request_form('tasktitle') != '') + $tasktitle = $this->input->$request_form('tasktitle'); $admin_info = $this->session->userdata('session_admin'); //获取任务列表 - if ($loadexcel=='loadexcel') { - $task_list['task_list'] = $this->Infotasks_model->get_tasks_list($t_status,$admin_info['OPI_Code'],$t_a_id,$t_td_type,$start_date,$end_date,$tasktitle); + if ($loadexcel == 'loadexcel') { + $task_list['task_list'] = $this->Infotasks_model->get_tasks_list($t_status, $admin_info['OPI_Code'], $t_a_id, $t_td_type, $start_date, $end_date, $tasktitle); return $task_list; } //分页 - $page_task=$this->Infotasks_model->get_tasks_list($t_status,$admin_info['OPI_Code'],$t_a_id,$t_td_type,$start_date,$end_date,$tasktitle,$page); - $pages['total']=count($page_task);//数据总条数 - $pages['pageSize']= 50;//每页展示数量 - $pages['url'] = $pageurl;//页码链接 - $pages['current']=$page;//当前页码 - $task_list['page']=show_page($pages); + $page_task = $this->Infotasks_model->get_tasks_list($t_status, $admin_info['OPI_Code'], $t_a_id, $t_td_type, $start_date, $end_date, $tasktitle, $page); + $pages['total'] = count($page_task); //数据总条数 + $pages['pageSize'] = 50; //每页展示数量 + $pages['url'] = $pageurl; //页码链接 + $pages['current'] = $page; //当前页码 + $task_list['page'] = show_page($pages); //获取任务列表 - $task_id_str=0; - if($page) $page_task=array_slice($page_task,$pages['pageSize']*($page-1),$pages['pageSize']); + $task_id_str = 0; + if ($page) + $page_task = array_slice($page_task, $pages['pageSize'] * ($page - 1), $pages['pageSize']); foreach ($page_task as $v) { - $task_id_str.=','.$v->t_id; + $task_id_str.=',' . $v->t_id; } - $flag=false; - if($t_status=='reviewed') $flag=TRUE; - $task_list['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str,$flag); + $flag = false; + if ($t_status == 'reviewed') + $flag = TRUE; + $task_list['task_list'] = $this->Infotasks_model->get_list_by_taskids($task_id_str, $flag); return $task_list; } @@ -246,7 +256,7 @@ class Author extends CI_Controller { $t_id = $this->input->post('t_id'); $t_rating = $this->input->post('t_rating'); $t_rating_total = $this->input->post('t_rating_total'); - + $task = $this->Infotasks_model->detail($t_id); if (empty($task)) { $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('task_error_notfound')); @@ -271,44 +281,40 @@ class Author extends CI_Controller { echo json_encode($data); return false; } else { - $flag=false; - if ($this->input->post('ispublish')==1) - { - $ispublished=$this->publish_task($task); - $flag=$ispublished; + $flag = false; + if ($this->input->post('ispublish') == 1) { + $ispublished = $this->publish_task($task); + $flag = $ispublished; //发布失败 - if(!$ispublished){ + if (!$ispublished) { $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('publish_task_failed')); echo json_encode($data); return false; } } - $this->Infotasks_model->reviwed($t_id, $reviewed, $t_rating,$t_rating_total); + $this->Infotasks_model->reviwed($t_id, $reviewed, $t_rating, $t_rating_total); //保存审核字数和金额 - if($reviewed=='reviewed') - { + if ($reviewed == 'reviewed') { $this->Infotaskarticles_model->update_review($t_id, $this->input->post('ta_count'), $this->input->post('ta_charge')); } - $msg=''; - if($flag!=false) $msg = ' 跳转到信息平台发布页'; - $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_review_submit').$msg); + $msg = ''; + if ($flag != false) + $msg = ' 跳转到信息平台发布页'; + $data[] = array('name' => 'ok_modal', 'value' => $this->lang->line('task_review_submit') . $msg); $data[] = array('name' => 'ok_go', 'value' => site_url('author/in_review_tasks')); echo json_encode($data); - - //发送邮件通知给作者 - $admin_info = $this->session->userdata('session_admin'); - $author=$this->Infoauthors_model->detail_by_id($task->t_a_id); - //通过审核 - if($reviewed=='reviewed') - { - $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_success_subject'),$task->t_title), $this->lang->line('author_email_review_task_success_body')); - } - else - { - $this->Infotasks_model->reviwed($t_id, 'unreviewed',$t_rating,$t_rating_total); - $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_failed_subject'),$task->t_title), $this->lang->line('author_email_review_task_failed_body')); - } + + //发送邮件通知给作者 + $admin_info = $this->session->userdata('session_admin'); + $author = $this->Infoauthors_model->detail_by_id($task->t_a_id); + //通过审核 + if ($reviewed == 'reviewed') { + $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_success_subject'), $task->t_title), $this->lang->line('author_email_review_task_success_body')); + } else { + $this->Infotasks_model->reviwed($t_id, 'unreviewed', $t_rating, $t_rating_total); + $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_review_task_failed_subject'), $task->t_title), $this->lang->line('author_email_review_task_failed_body')); + } } $this->InfoSMS_model->add('task', $t_id, $task->t_a_id, $task->t_ht_op_code, $this->input->post('review_m_content')); } @@ -316,7 +322,7 @@ class Author extends CI_Controller { public function publish_task($task) { $this->load->model('Logs_model'); $t_id = $this->input->post('t_id'); - $ic_is_id=$this->input->post('choose_ic_is_id'); + $ic_is_id = $this->input->post('choose_ic_is_id'); $task_last_version = $this->Infotaskarticles_model->version_last($task->t_id); if (empty($task_last_version->ta_ic_id)) { @@ -332,7 +338,7 @@ class Author extends CI_Controller { , $task_last_version->ta_summary, $task_last_version->ta_seo_title, $task_last_version->ta_seo_description, $task_last_version->ta_seo_keywords , 0, 0, '', $task_last_version->ta_photo, 0, 0, '', '', $information->ic_ht_area_id, $information->ic_ht_area_type, 0, '', $task->t_a_id); if ($this->InfoStructures_model->Add($information->is_id, $this->InfoContents_model->insert_id)) { - $result =site_url('information/edit/' . $this->InfoStructures_model->insert_id); + $result = site_url('information/edit/' . $this->InfoStructures_model->insert_id); } else { $result = false; } @@ -361,24 +367,25 @@ class Author extends CI_Controller { public function publish_task_submit() { $this->load->model('Logs_model'); $t_id = $this->input->post('t_id'); - $ic_is_id=$this->input->post('ic_is_id'); + $ic_is_id = $this->input->post('ic_is_id'); $task = $this->Infotasks_model->detail($t_id); if ($task === false) { show_404(); return false; } - $action_result=true; + $action_result = true; $task_last_version = $this->Infotaskarticles_model->version_last($task->t_id); $information = false; - if (!empty($task_last_version->ta_ic_id)) $information = $this->Information_model->detail_by_ic_id($task_last_version->ta_ic_id); - if (empty($task_last_version->ta_ic_id) or !$information) { + if (!empty($task_last_version->ta_ic_id)) + $information = $this->Information_model->detail_by_ic_id($task_last_version->ta_ic_id); + if (empty($task_last_version->ta_ic_id) or ! $information) { $selected_name = $this->input->post('selected_is_ic_name'); $is_id = mb_substr($selected_name, strpos($selected_name, '{') + 1, -1); $information = $this->Information_model->Detail($is_id); if (empty($information)) { - $action_result=false; + $action_result = false; $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('structures_error_notfound')); echo json_encode($data); return false; @@ -389,18 +396,18 @@ class Author extends CI_Controller { , $task_last_version->ta_summary, $task_last_version->ta_seo_title, $task_last_version->ta_seo_description, $task_last_version->ta_seo_keywords , 0, 0, '', $task_last_version->ta_photo, 0, 0, '', '', $information->ic_ht_area_id, $information->ic_ht_area_type, 0, '', $task->t_a_id); if ($this->InfoStructures_model->Add($information->is_id, $this->InfoContents_model->insert_id)) { - $im_ic_id=$this->InfoContents_model->insert_id; + $im_ic_id = $this->InfoContents_model->insert_id; $data[] = array('name' => 'ok_modal', 'value' => sprintf($this->lang->line('publish_task_success'), site_url('information/edit/' . $this->InfoStructures_model->insert_id))); //$this->Infotasks_model->reviwed($t_id,'published');//标识已经发布 } else { - $action_result=false; + $action_result = false; $data[] = array('name' => 'no_modal', 'value' => $this->lang->line('publish_task_failed')); } //把任务和信息做关联 $this->Infotaskarticles_model->link($task_last_version->ta_id, $this->InfoContents_model->insert_id); } else { //已经有信息关联,只需要更新对应的字段 - $im_ic_id=$information->ic_id; + $im_ic_id = $information->ic_id; $this->InfoContents_model->Update($information->ic_id, $information->ic_url, $information->ic_url_title, $information->ic_type, $task_last_version->ta_title, $task_last_version->ta_content , $task_last_version->ta_summary, $task_last_version->ta_seo_title, $task_last_version->ta_seo_description, $task_last_version->ta_seo_keywords , $information->ic_show_bread_crumbs, $information->ic_status, $information->ic_template, $task_last_version->ta_photo, $information->ic_photo_width @@ -414,8 +421,8 @@ class Author extends CI_Controller { } if ($action_result) { //若作者平台的作者推荐了相关推荐信息,则先删除旧的推荐信息再添加新的推荐信息 - $author_recommend_info=get_meta($t_id, 'meta_author_recommend_info'); - $author_related_info=get_meta($t_id, 'meta_author_related_info'); + $author_recommend_info = get_meta($t_id, 'meta_author_recommend_info'); + $author_related_info = get_meta($t_id, 'meta_author_related_info'); if (!empty($author_recommend_info)) { delete_meta($im_ic_id, 'meta_recommend_info'); add_meta($im_ic_id, 'meta_recommend_info', $author_recommend_info); @@ -439,14 +446,12 @@ class Author extends CI_Controller { return false; } foreach ($t_ids as $t_id) { - $this->Infotasks_model->reviwed($t_id,'complete'); + $this->Infotasks_model->reviwed($t_id, 'complete'); } //设置月度活跃作者 - if ($this->input->post('isset_active_author')==0) { + if ($this->input->post('isset_active_author') == 0) { $this->Infotasks_model->set_active_author( - $this->input->post('active_t_id'), - date('Y-m-d H:i:s'), - $this->input->post('active_ta_id') + $this->input->post('active_t_id'), date('Y-m-d H:i:s'), $this->input->post('active_ta_id') ); } $data[] = array('name' => 'ok', 'value' => $this->lang->line('task_complete_success')); @@ -467,7 +472,7 @@ class Author extends CI_Controller { if ($task_detail) { $data['information'] = $this->Information_model->detail_by_ic_id($task_detail->ta_ic_id); //判断任务是否已上线 - $data['task_status']=$this->Infotasks_model->is_in_used($task_detail->ta_id); + $data['task_status'] = $this->Infotasks_model->is_in_used($task_detail->ta_id); } $data['task_detail_list'] = $this->Infotaskarticles_model->version_list($data['task']->t_id); $data['task_last_version'] = $this->Infotaskarticles_model->version_last($data['task']->t_id); @@ -510,45 +515,37 @@ class Author extends CI_Controller { //获取该任务审核次数并计算奖励的百分比 $review_count = $this->Infotaskarticles_model->get_review_count($t_id); - switch ($review_count) - { - case 1: - $data['discount'] = array('1.1','110%'); - break; - case 2: - $data['discount'] = array('1.05','105%'); - break; - case 0: - case 3: - $data['discount'] = array('1','100%'); - break; - default: - $data['discount'] = array('0.9','90%'); + switch ($review_count) { + case 1: + $data['discount'] = array('1.1', '110%'); + break; + case 2: + $data['discount'] = array('1.05', '105%'); + break; + case 0: + case 3: + $data['discount'] = array('1', '100%'); + break; + default: + $data['discount'] = array('0.9', '90%'); } - + $this->load->view('bootstrap/header', $data); - if ($data['task']->t_status=='wait') { + if ($data['task']->t_status == 'wait') { $this->load->view('bootstrap/author/task_contribute'); - }else{ + } else { $this->load->view('bootstrap/author/task_create'); } $this->load->view('bootstrap/footer'); } //修改任务详细信息 - public function save_task_datailinfo(){ - $result=$this->Infotaskarticles_model->update( - $this->input->post('ta_id'), - $this->input->post('ta_title'), - $this->input->post('ta_content'), - $this->input->post('ta_summary'), - $this->input->post('ta_seo_title'), - $this->input->post('ta_seo_description'), - $this->input->post('ta_seo_keywords'), - $this->input->post('ta_photo')); + public function save_task_datailinfo() { + $result = $this->Infotaskarticles_model->update( + $this->input->post('ta_id'), $this->input->post('ta_title'), $this->input->post('ta_content'), $this->input->post('ta_summary'), $this->input->post('ta_seo_title'), $this->input->post('ta_seo_description'), $this->input->post('ta_seo_keywords'), $this->input->post('ta_photo')); if ($result) { $data[] = array('name' => 'ok', 'value' => 'success!'); - }else{ + } else { $data[] = array('name' => 'no', 'value' => 'error!'); } echo json_encode($data); @@ -556,26 +553,24 @@ class Author extends CI_Controller { } //审核投稿申请 - public function change_wait_tast_status($t_status='edit'){ - $t_id=$this->input->post('t_id'); - $t_a_id=$this->input->post('t_a_id'); - $refuse_msg=$this->input->post('refuse_msg'); - + public function change_wait_tast_status($t_status = 'edit') { + $t_id = $this->input->post('t_id'); + $t_a_id = $this->input->post('t_a_id'); + $refuse_msg = $this->input->post('refuse_msg'); + $admin_info = $this->session->userdata('session_admin'); - $author=$this->Infoauthors_model->detail_by_id($t_a_id); - if ($t_status=='edit' && $this->Infotasks_model->reviwed($t_id,$t_status)) { - if(!empty($author)) - { + $author = $this->Infoauthors_model->detail_by_id($t_a_id); + if ($t_status == 'edit' && $this->Infotasks_model->reviwed($t_id, $t_status)) { + if (!empty($author)) { $this->InfoSMS_model->add('task', $t_id, $t_a_id, $admin_info['OPI_Code'], 'Your proposal has been approved!'); $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, 'Your proposal has been approved.', 'Your proposal has been approved!Please log in at http://a.cdnch.com/author.php'); } $data[] = array('name' => 'ok', 'value' => 'success'); - }elseif ($t_status=='refuse' && $this->Infotasks_model->reviwed($t_id,$t_status)) { + } elseif ($t_status == 'refuse' && $this->Infotasks_model->reviwed($t_id, $t_status)) { //如果指定用户则发送邮件通知 - if(!empty($author)) - { + if (!empty($author)) { $this->InfoSMS_model->add('task', $t_id, $t_a_id, $admin_info['OPI_Code'], $refuse_msg); - $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, 'Your proposal has been rejected.', 'Your proposal has been rejected: '.$refuse_msg.' Please log in at http://a.cdnch.com/author.php'); + $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, 'Your proposal has been rejected.', 'Your proposal has been rejected: ' . $refuse_msg . ' Please log in at http://a.cdnch.com/author.php'); } $data[] = array('name' => 'no', 'value' => 'success'); } @@ -601,25 +596,14 @@ class Author extends CI_Controller { //$t_id 查找一次任务详细,用来判断当前用户是否有权限修改,暂时省略 $this->Infotasks_model->update( - $t_id, - $this->input->post('t_title'), - $this->input->post('t_content'), - $this->input->post('t_a_id'), - $this->input->post('t_td_type'), - $this->input->post('t_expires') + $t_id, $this->input->post('t_title'), $this->input->post('t_content'), $this->input->post('t_a_id'), $this->input->post('t_td_type'), $this->input->post('t_expires') ); $data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit')); echo json_encode($data); } else { $admin_info = $this->session->userdata('session_admin'); $this->Infotasks_model->add( - $this->input->post('t_title'), - $this->input->post('t_content'), - $this->input->post('t_a_id'), - $admin_info['OPI_Code'], - $this->input->post('t_td_type'), - $this->input->post('t_expires'), - $this->config->item('site_code') + $this->input->post('t_title'), $this->input->post('t_content'), $this->input->post('t_a_id'), $admin_info['OPI_Code'], $this->input->post('t_td_type'), $this->input->post('t_expires'), $this->config->item('site_code') ); //新建 $is_id = $this->input->post('is_id'); @@ -632,8 +616,8 @@ class Author extends CI_Controller { } //添加推荐文章信息 - $meta_recommend_info=get_meta($information->ic_id, 'meta_recommend_info'); - $meta_related_info=get_meta($information->ic_id, 'meta_related_info'); + $meta_recommend_info = get_meta($information->ic_id, 'meta_recommend_info'); + $meta_related_info = get_meta($information->ic_id, 'meta_related_info'); if (!empty($meta_recommend_info)) { add_meta($this->Infotasks_model->insert_id, 'meta_author_recommend_info', $meta_recommend_info); } @@ -641,7 +625,8 @@ class Author extends CI_Controller { add_meta($this->Infotasks_model->insert_id, 'meta_author_related_info', $meta_related_info); } - if(empty($information->ic_summary))$information->ic_summary=''; + if (empty($information->ic_summary)) + $information->ic_summary = ''; $this->Infotaskarticles_model->add($this->Infotasks_model->insert_id, $information->ic_id, $information->ic_title , $information->ic_content, $information->ic_summary, $information->ic_seo_title, $information->ic_seo_description , $information->ic_seo_keywords, $information->ic_photo); @@ -649,26 +634,38 @@ class Author extends CI_Controller { $this->Infotaskarticles_model->add($this->Infotasks_model->insert_id, 0, '', '', '', '', '', '', ''); } - $add_articles_res=$this->Infotaskarticles_model->detail($this->Infotasks_model->insert_id); + $add_articles_res = $this->Infotaskarticles_model->detail($this->Infotasks_model->insert_id); if (!$add_articles_res) { $this->Infotasks_model->delete($this->Infotasks_model->insert_id); - $data[] = array('name' => 'no', 'value' => "创建任务失败".$this->Infotaskarticles_model->insert_id); + $data[] = array('name' => 'no', 'value' => "创建任务失败" . $this->Infotaskarticles_model->insert_id); echo json_encode($data); return false; } - //如果指定用户则发送邮件通知 - $t_a_id=$this->input->post('t_a_id'); - $author=$this->Infoauthors_model->detail_by_id($t_a_id); - if(!empty($author)) - { - $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_new_task_subject'),$this->input->post('t_title')), $this->lang->line('author_email_new_task_body')); - }else{ - //给所有作者发送一封邮件 - $author_list = $this->Infoauthors_model->active_list(); - foreach ($author_list as $a) { - $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $a->a_name, $a->a_email, sprintf($this->lang->line('author_email_new_task_subject'),$this->input->post('t_title')), $this->lang->line('author_email_new_task_body2')); - } + //如果指定用户则发送邮件通知 + $t_a_id = $this->input->post('t_a_id'); + //所有作者 + $author_list = $this->Infoauthors_model->active_list(); + switch ($t_a_id) { + case 0://cht所有用户 + foreach ($author_list as $a) { + if ($a->a_sitecode == 'cht' || empty($a->a_sitecode)) { + $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $a->a_name, $a->a_email, sprintf($this->lang->line('author_email_new_task_subject'), $this->input->post('t_title')), $this->lang->line('author_email_new_task_body2')); + } + } + break; + case -1://ah所有用户 + foreach ($author_list as $a) { + if ($a->a_sitecode == 'ah') { + $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $a->a_name, $a->a_email, sprintf($this->lang->line('author_email_new_task_subject'), $this->input->post('t_title')), $this->lang->line('author_email_new_task_body2')); + } + } + break; + default://指定用户 + $author = $this->Infoauthors_model->detail_by_id($t_a_id); + if (!empty($author)) { + $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_new_task_subject'), $this->input->post('t_title')), $this->lang->line('author_email_new_task_body')); + } } $data[] = array('name' => 'ok', 'value' => $this->lang->line('task_success_submit')); @@ -732,13 +729,12 @@ class Author extends CI_Controller { $this->InfoSMS_model->add('task', $task->t_id, $task->t_a_id, $task->t_ht_op_code, $this->input->post('m_content')); $data[] = array('name' => 'ok', 'value' => $this->lang->line('send_sms_success')); echo json_encode($data); - $admin_info = $this->session->userdata('session_admin'); - $author=$this->Infoauthors_model->detail_by_id($task->t_a_id); - if(!empty($author)) - { - $this->InfoSMS_model->send_mail($admin_info['OPI_Name'], $admin_info['OPI_Email'], $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_message_subject'),$task->t_title), $this->lang->line('author_email_message_body')); + $admin_info = $this->session->userdata('session_admin'); + $author = $this->Infoauthors_model->detail_by_id($task->t_a_id); + if (!empty($author)) { + $this->InfoSMS_model->send_mail($admin_info['OPI_Name'], $admin_info['OPI_Email'], $author->a_name, $author->a_email, sprintf($this->lang->line('author_email_message_subject'), $task->t_title), $this->lang->line('author_email_message_body')); } - return true; + return true; } } @@ -747,17 +743,16 @@ class Author extends CI_Controller { if (empty($a_id)) { show_404(); } - $this->Infoauthors_model->update_site($a_id,$this->input->post('a_sitecode')); + $this->Infoauthors_model->update_site($a_id, $this->input->post('a_sitecode')); $this->Infoauthors_model->reviwed($a_id, $this->input->post('a_active')); $admin_info = $this->session->userdata('session_admin'); - $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $this->input->post('edit_a_name'), $this->input->post('edit_a_email'), 'Sign Up For China Highlights Online Writers Platform','Welcom to China Highlights Online Writers Platform:
China Highlights Online Writers Platform'); + $this->InfoSMS_model->send_mail('gavin', 'gavin@chinahighlights.com', $this->input->post('edit_a_name'), $this->input->post('edit_a_email'), 'Sign Up For China Highlights Online Writers Platform', 'Welcom to China Highlights Online Writers Platform:
China Highlights Online Writers Platform'); $data[] = array('name' => 'ok', 'value' => $this->lang->line('author_review_submit')); echo json_encode($data); } //编辑作者资料 - public function profile_submit() - { + public function profile_submit() { $a_id = $this->input->post('a_id'); if (empty($a_id)) { show_404(); @@ -767,105 +762,95 @@ class Author extends CI_Controller { $this->form_validation->set_rules('a_name', 'lang:signup_a_name', 'required'); $this->form_validation->set_rules('a_bank', 'lang:a_bank', 'required'); $this->form_validation->set_rules('a_bank_card', 'lang:a_bank_card', 'required'); - if ($this->form_validation->run() == FALSE) - { + if ($this->form_validation->run() == FALSE) { $data = array(); - foreach ($this->form_validation->_error_array as $key => $value) - { + foreach ($this->form_validation->_error_array as $key => $value) { $data[] = array('name' => $key, 'value' => $value); } echo json_encode($data); return FALSE; - } - else - { + } else { //头像处理 - $a_photo=$this->input->post('a_photo'); - if ($this->input->post('profile_url')!='') { - $profile_file_path=getcwd().'/author/document/profile_photo'; - $profile_url=$this->input->post('profile_url'); - $profile_array=explode('.', $profile_url); - $profile_ext='jpg';//end($profile_array); - $new_profile=$profile_file_path.'/profile_'.$this->input->post('a_email').'.'.$profile_ext; - if(file_exists($new_profile))unlink($new_profile); - rename($profile_file_path.'/'.$profile_url,$new_profile); - rename($profile_file_path.'/'.str_replace('_thumb', '', $profile_url),$profile_file_path.'/profile_'.$this->input->post('a_email').'_org.'.$profile_ext); - $a_photo='profile_'.$this->input->post('a_email').'.'.$profile_ext; + $a_photo = $this->input->post('a_photo'); + if ($this->input->post('profile_url') != '') { + $profile_file_path = getcwd() . '/author/document/profile_photo'; + $profile_url = $this->input->post('profile_url'); + $profile_array = explode('.', $profile_url); + $profile_ext = 'jpg'; //end($profile_array); + $new_profile = $profile_file_path . '/profile_' . $this->input->post('a_email') . '.' . $profile_ext; + if (file_exists($new_profile)) + unlink($new_profile); + rename($profile_file_path . '/' . $profile_url, $new_profile); + rename($profile_file_path . '/' . str_replace('_thumb', '', $profile_url), $profile_file_path . '/profile_' . $this->input->post('a_email') . '_org.' . $profile_ext); + $a_photo = 'profile_' . $this->input->post('a_email') . '.' . $profile_ext; } //处理上传的身份证复印件 - if ($this->input->post('ID_file_name')!='') { - $ID_file_path=getcwd().'/author/document/ID_CARD'; - $a_id_file=$this->input->post('ID_file_name'); - $file_array=explode('.', $a_id_file); - $ext='jpg';//end($file_array); - $new_file=$ID_file_path.'/id_card_'.$this->input->post('a_email').'.'.$ext; - if(file_exists($new_file))unlink($new_file); - rename($ID_file_path.'/'.$a_id_file,$new_file); + if ($this->input->post('ID_file_name') != '') { + $ID_file_path = getcwd() . '/author/document/ID_CARD'; + $a_id_file = $this->input->post('ID_file_name'); + $file_array = explode('.', $a_id_file); + $ext = 'jpg'; //end($file_array); + $new_file = $ID_file_path . '/id_card_' . $this->input->post('a_email') . '.' . $ext; + if (file_exists($new_file)) + unlink($new_file); + rename($ID_file_path . '/' . $a_id_file, $new_file); } - $a_name=trim($this->input->post('a_name')); - $a_name_cn=trim($this->input->post('a_name_cn')); - $this->Infoauthors_model->update($a_id, $this->input->post('a_email'), - $a_name, $a_name_cn, $a_photo, - $this->input->post('a_mobile_phone'),$this->input->post('a_phone'), $this->input->post('a_id_card'), - $this->input->post('a_gender'),$this->input->post('a_address'), $this->input->post('a_school'), - $this->input->post('a_bank'),$this->input->post('a_bank_card'), $this->input->post('a_resume')); - + $a_name = trim($this->input->post('a_name')); + $a_name_cn = trim($this->input->post('a_name_cn')); + $this->Infoauthors_model->update($a_id, $this->input->post('a_email'), $a_name, $a_name_cn, $a_photo, $this->input->post('a_mobile_phone'), $this->input->post('a_phone'), $this->input->post('a_id_card'), $this->input->post('a_gender'), $this->input->post('a_address'), $this->input->post('a_school'), $this->input->post('a_bank'), $this->input->post('a_bank_card'), $this->input->post('a_resume')); + $this->Infoauthors_model->set_title($a_id, $this->input->post('a_title')); - + $data[] = array('name' => 'ok', 'value' => $this->lang->line('setting_profile_success')); echo json_encode($data); return TRUE; - } + } } - + //上传头像、身份证复印件等 - public function upload_ID_file($profile=false){ - $save_path='ID_CARD'; - $jsfunction='get_id_card_file'; - $upload_id='ID_file'; + public function upload_ID_file($profile = false) { + $save_path = 'ID_CARD'; + $jsfunction = 'get_id_card_file'; + $upload_id = 'ID_file'; if ($profile) { - $save_path='profile_photo'; - $jsfunction='get_photo_url'; - $upload_id='Profile_file'; + $save_path = 'profile_photo'; + $jsfunction = 'get_photo_url'; + $upload_id = 'Profile_file'; } - $path=APPPATH; - $config['upload_path'] = getcwd().'/author/document/'.$save_path; + $path = APPPATH; + $config['upload_path'] = getcwd() . '/author/document/' . $save_path; $config['allowed_types'] = 'gif|jpg|png'; $config['encrypt_name'] = true; - + $this->load->library('upload', $config); - if (!$this->upload->do_upload($upload_id)) - { + if (!$this->upload->do_upload($upload_id)) { $error = array('error' => $this->upload->display_errors()); var_dump($error); - } - else - { + } else { $data = array('upload_data' => $this->upload->data()); - $file_name=$data['upload_data']['file_name']; + $file_name = $data['upload_data']['file_name']; if ($profile) { - $baseurl_array=explode('application', dirname(__FILE__)); - $baseurls=$baseurl_array[0]; + $baseurl_array = explode('application', dirname(__FILE__)); + $baseurls = $baseurl_array[0]; $config['image_library'] = 'gd2'; - $config['source_image'] = $baseurls.'author/document/profile_photo/'.$file_name; + $config['source_image'] = $baseurls . 'author/document/profile_photo/' . $file_name; $config['create_thumb'] = TRUE; $config['maintain_ratio'] = false; $config['width'] = 175; $config['height'] = 175; - $this->load->library('image_lib', $config); + $this->load->library('image_lib', $config); $this->image_lib->resize(); - $profile_array=explode('.', $file_name); - $file_name=$profile_array[0].'_thumb.'.$profile_array[1]; + $profile_array = explode('.', $file_name); + $file_name = $profile_array[0] . '_thumb.' . $profile_array[1]; } echo ""; } } - //修改职称 - public function submit_author_title() - { + //修改职称 + public function submit_author_title() { $a_id = $this->input->post('a_id'); if (empty($a_id)) { show_404(); @@ -873,53 +858,56 @@ class Author extends CI_Controller { $this->Infoauthors_model->set_title($a_id, $this->input->post('a_title')); $data[] = array('name' => 'ok', 'value' => $this->lang->line('author_title_submit')); echo json_encode($data); - } + } //公告管理 - public function announce_list(){ - $data['announce_list']=$this->Infotaskarticles_model->get_announce('','announce'); - $data['notice_list']=$this->Infotaskarticles_model->get_announce(); + public function announce_list() { + $data['announce_list'] = $this->Infotaskarticles_model->get_announce('', 'announce'); + $data['notice_list'] = $this->Infotaskarticles_model->get_announce(); $data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'announce_list'), true); $this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/author/announce_list'); $this->load->view('bootstrap/footer'); } + //公告详情 - public function announce_detail($announce_id,$type='notice'){ - $announce=$this->Infotaskarticles_model->get_announce($announce_id,$type); - $data['announce_detail']=$announce[0]; + public function announce_detail($announce_id, $type = 'notice') { + $announce = $this->Infotaskarticles_model->get_announce($announce_id, $type); + $data['announce_detail'] = $announce[0]; $data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'announce_list'), true); $this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/author/announce_list'); $this->load->view('bootstrap/footer'); } + //编辑公告 - public function announce_edit($announce_id="",$type='notice'){ - if ($announce_id!="") { - $announce=$this->Infotaskarticles_model->get_announce($announce_id,$type); - $data['announce']=$announce[0]; + public function announce_edit($announce_id = "", $type = 'notice') { + if ($announce_id != "") { + $announce = $this->Infotaskarticles_model->get_announce($announce_id, $type); + $data['announce'] = $announce[0]; } $data['nav_view'] = $this->load->view('bootstrap/author/nav', array('nav_active' => 'announce_edit'), true); $this->load->view('bootstrap/header', $data); $this->load->view('bootstrap/author/announce_edit'); $this->load->view('bootstrap/footer'); } + //公告更新 - public function add_announce(){ - $title=$this->input->post('title'); - $announce=$this->input->post('announce'); - $announce_id=$this->input->post('announce_id'); - $announce_type=$this->input->post('announce_type'); - $result=false; + public function add_announce() { + $title = $this->input->post('title'); + $announce = $this->input->post('announce'); + $announce_id = $this->input->post('announce_id'); + $announce_type = $this->input->post('announce_type'); + $result = false; if (!empty($announce_id)) { - $result=$this->Infotaskarticles_model->update($this->input->post('announce_id'), $title, $announce, '', $announce_type, '', '', ''); - }else{ - $result=$this->Infotaskarticles_model->add(0,0, $title, $announce, '', $announce_type, '', '', '','announce'); + $result = $this->Infotaskarticles_model->update($this->input->post('announce_id'), $title, $announce, '', $announce_type, '', '', ''); + } else { + $result = $this->Infotaskarticles_model->add(0, 0, $title, $announce, '', $announce_type, '', '', '', 'announce'); } if ($result) { $datas[] = array('name' => 'ok', 'value' => 'success!'); echo json_encode($datas); - }else{ + } else { $datas[] = array('name' => 'no', 'value' => 'error!'); echo json_encode($datas); } @@ -927,35 +915,35 @@ class Author extends CI_Controller { } //删除公告 - public function announce_delete($announce_id){ + public function announce_delete($announce_id) { if ($this->Infotaskarticles_model->delete_announce($announce_id)) { $datas[] = array('name' => 'ok', 'value' => 'success!'); - }else{ + } else { $datas[] = array('name' => 'no', 'value' => 'error!'); } echo json_encode($datas); } //优秀文章评优处理 - public function set_task_charge(){ - $ta_isbest=NULL; - if ($this->input->post('ta_isbest')==1) { - $ta_isbest=date('Y-m-d H:i:s'); + public function set_task_charge() { + $ta_isbest = NULL; + if ($this->input->post('ta_isbest') == 1) { + $ta_isbest = date('Y-m-d H:i:s'); } - $result=$this->Infotaskarticles_model->update_review($this->input->post('t_id'), $this->input->post('ta_count'), $this->input->post('ta_charge'), $ta_isbest); + $result = $this->Infotaskarticles_model->update_review($this->input->post('t_id'), $this->input->post('ta_count'), $this->input->post('ta_charge'), $ta_isbest); if ($result) { - $datas = array('name' => 'ok', 'value' => 'success!'); - }else{ + $datas = array('name' => 'ok', 'value' => 'success!'); + } else { $datas = array('name' => 'no', 'value' => 'error!'); } echo json_encode($datas); } //标识所有收录信息为已读 - public function set_msg_to_read(){ - $msg_ids=array(); - $ic_id_str=$this->input->post('msg_ids'); - $msg_ids=explode(',', $ic_id_str); + public function set_msg_to_read() { + $msg_ids = array(); + $ic_id_str = $this->input->post('msg_ids'); + $msg_ids = explode(',', $ic_id_str); foreach ($msg_ids as $key => $v) { $this->InfoSMS_model->readed_for_info($v); } @@ -964,91 +952,93 @@ class Author extends CI_Controller { //下载数据列表 public function load_to_excel($task_list) { - $sum_count=$sum_charge=0; - $exceldata=array(); - $exceldata[0]=array('任务号','任务名称','类型','作者','编辑','发布时间','完成时间','字数','金额'); - foreach($task_list as $key=>$task){ + $sum_count = $sum_charge = 0; + $exceldata = array(); + $exceldata[0] = array('任务号', '任务名称', '类型', '作者', '编辑', '发布时间', '完成时间', '字数', '金额'); + foreach ($task_list as $key => $task) { if (isset($task->last_version->ta_count)) { $sum_count+=$task->last_version->ta_count; - }else{ - $task->last_version->ta_count='-'; + } else { + $task->last_version->ta_count = '-'; } if (isset($task->last_version->ta_charge)) { $sum_charge+=$task->last_version->ta_charge; - }else{ - $task->last_version->ta_charge='-'; + } else { + $task->last_version->ta_charge = '-'; } if (!isset($task->last_version->ta_datetime)) { - $task->last_version->ta_datetime=$task->t_expires; - $exceldata[0][6]='截止时间'; + $task->last_version->ta_datetime = $task->t_expires; + $exceldata[0][6] = '截止时间'; } - $k=$key+1; - $exceldata["$k"][]=$task->t_id;//任务号 - $exceldata["$k"][]=$task->t_title;//任务名称 - $exceldata["$k"][]=$task->t_td_type;//任务类型 - $exceldata["$k"][]=get_author_name($task->t_a_id);//作者 - $exceldata["$k"][]=get_author_name($task->t_ht_op_code);//编辑 - $exceldata["$k"][]=date('m/d/Y',strtotime($task->t_datetime));//任务发布时间 - $exceldata["$k"][]=date('m/d/Y',strtotime($task->last_version->ta_datetime));//完成时间或者截止时间 - $exceldata["$k"][]=$task->last_version->ta_count;//完成的字数 - $exceldata["$k"][]=$task->last_version->ta_charge;//金额 + $k = $key + 1; + $exceldata["$k"][] = $task->t_id; //任务号 + $exceldata["$k"][] = $task->t_title; //任务名称 + $exceldata["$k"][] = $task->t_td_type; //任务类型 + $exceldata["$k"][] = get_author_name($task->t_a_id); //作者 + $exceldata["$k"][] = get_author_name($task->t_ht_op_code); //编辑 + $exceldata["$k"][] = date('m/d/Y', strtotime($task->t_datetime)); //任务发布时间 + $exceldata["$k"][] = date('m/d/Y', strtotime($task->last_version->ta_datetime)); //完成时间或者截止时间 + $exceldata["$k"][] = $task->last_version->ta_count; //完成的字数 + $exceldata["$k"][] = $task->last_version->ta_charge; //金额 } - $exceldata[]=array('','','','','','','总计',$sum_count,$sum_charge); + $exceldata[] = array('', '', '', '', '', '', '总计', $sum_count, $sum_charge); $this->_excel($exceldata); } //导出数据到excel //$output要填充到excel的数据,必须是一个二维数组 - public function _excel($output=array()){ + public function _excel($output = array()) { header("Content-Type: application/vnd.ms-excel;"); - header("Content-Disposition:attachment;filename=".time().".csv"); - header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); - header('Expires:0'); + header("Content-Disposition:attachment;filename=" . time() . ".csv"); + header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); + header('Expires:0'); header('Pragma:public'); - $excel_str=""; + $excel_str = ""; foreach ($output as $item) { foreach ($item as $v) { - $v=str_replace(',',' ',$v); - $excel_str.=$v.",";//设置某一单元格的值 + $v = str_replace(',', ' ', $v); + $excel_str.=$v . ","; //设置某一单元格的值 } - $excel_str.="\n";//添加行结束符 + $excel_str.="\n"; //添加行结束符 } $filetype = $this->input->post('filetype'); - if($filetype==2) $excel_str=iconv('UTF-8','GB2312',$excel_str);//excel简体中文版使用gb2312编码 + if ($filetype == 2) + $excel_str = iconv('UTF-8', 'GB2312', $excel_str); //excel简体中文版使用gb2312编码 echo "$excel_str"; } //返回指定页面路径pagepath在指定时间内的成效信息 - public function get_analytics_by_date($loadtotal=0){ - $data=array(); + public function get_analytics_by_date($loadtotal = 0) { + $data = array(); //获取请求的日期范围以及请求的页面路径 - $startdate=$this->input->post('startdate'); - $enddate=$this->input->post('enddate'); - $pagepath=$this->input->post('pagepath'); - $sitecode=$this->input->post('sitecode'); + $startdate = $this->input->post('startdate'); + $enddate = $this->input->post('enddate'); + $pagepath = $this->input->post('pagepath'); + $sitecode = $this->input->post('sitecode'); if (empty($pagepath)) { echo ''; return false; } //如果开始时间为空则把开始时间设为往前七天 if ($startdate == '') { - $startdate = time()-7*24*60*60; - }else{ + $startdate = time() - 7 * 24 * 60 * 60; + } else { $startdate = strtotime($startdate); } //如果结束时间为空,则把结束时间设为当天 if ($enddate == '') { $enddate = time(); - }else{ + } else { $enddate = strtotime($enddate); } - if ($startdate>$enddate) { - echo "请选择正确的日期";die(); + if ($startdate > $enddate) { + echo "请选择正确的日期"; + die(); } //查取google分析数据 - $data['analytics_list'] = $this->Infotaskarticles_model->get_analytics_list($pagepath,$sitecode,50,$startdate,$enddate); - $total_visit['pv'] = $total_visit['uv']=$total_visit['agv_time']=$total_visit['entrances']=0; - $analytics_count=0; + $data['analytics_list'] = $this->Infotaskarticles_model->get_analytics_list($pagepath, $sitecode, 50, $startdate, $enddate); + $total_visit['pv'] = $total_visit['uv'] = $total_visit['agv_time'] = $total_visit['entrances'] = 0; + $analytics_count = 0; //访问量汇总 foreach ($data['analytics_list'] as $v) { $total_visit['pv']+=$v->kwa_pageviews; @@ -1057,13 +1047,13 @@ class Author extends CI_Controller { $total_visit['entrances']+=$v->kwa_entrances; $analytics_count++; } - $analytics_count==0 ? $analytics_count=1 : null; - $total_visit['agv_time']=ceil($total_visit['agv_time']/$analytics_count); - $data['total_visit']=$total_visit; + $analytics_count == 0 ? $analytics_count = 1 : null; + $total_visit['agv_time'] = ceil($total_visit['agv_time'] / $analytics_count); + $data['total_visit'] = $total_visit; //如果loadtotal==1,则只返回google分析的汇总数据;如果loadtotal==0,则返回明细数据表 - $data['loadtotal']=$loadtotal; - - $this->load->view('bootstrap/author/analytics',$data); + $data['loadtotal'] = $loadtotal; + + $this->load->view('bootstrap/author/analytics', $data); } -} +} diff --git a/application/controllers/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;
用户ID用户ID 名字 中文名 性别 邮箱 注册时间站点 操作
a_gender; ?> a_email; ?> a_datetime)); ?>a_sitecode; ?> 查看