コード例 #1
0
 public function reflushPostTime()
 {
     if (IS_POST) {
         $id = isset($_POST['data']) ? intval(I('post.data')) : '';
         if ($id) {
             $exist = $this->PostModel->existPostPkid($id);
             if ($exist > 0) {
                 $time = $this->PostModel->postReflushTime($id);
                 $time_bool = strtotime($time) ? reflushDay($time, 1) : TRUE;
                 if ($time_bool === TRUE) {
                     $bool = $this->PostModel->updateReflushTime($id);
                     if ($bool) {
                         $data = time2Unit($this->PostModel->postReflushTime($id));
                         returnjson(array('code' => 501, 'status' => TRUE, 'msg' => '', 'data' => $data));
                     } else {
                         returnjson(array('code' => 502, 'status' => FALSE, 'msg' => '刷新失败'));
                     }
                 }
                 if ($time_bool === FALSE) {
                     returnjson(array('code' => 503, 'status' => FALSE, 'msg' => '未到再次刷新限制'));
                 }
             }
         }
     }
 }
コード例 #2
0
 public function read()
 {
     $page = I('get.page');
     $ajax = I('get.ajax') == 'true' ? true : false;
     $count_arr = $this->RegionViewModel->resumeViewTotal();
     $count = $count_arr['sum'];
     $pagebtn['view'] = $count_arr['view'];
     $page_sum = ceil($count / $this->page_number);
     $page = isset($_GET['page']) ? intval($page) : 1;
     $page = min($page, $page_sum);
     $page = max(0, $page);
     $read = $this->RegionViewModel->resumeView($page, $this->page_number);
     foreach ($read as $k => $v) {
         $read[$k]['city'] = regionIdToname($v['city_id'], $this->RegionsModel);
         $read[$k]['scale'] = getScaleText($v['scale_id'], $this->ScaleModel);
         $read[$k]['industry'] = getIndustryText($v['industry_id'], $this->IndustryModel);
         if ($v['view'] > 1) {
             $read[$k]['create_time'] = time2Unit($this->RegionViewModel->lastViewTime($v['enterprise_id']));
         }
         $read[$k]['create_time'] = time2Unit($v['create_time']);
     }
     $pagebtn['btn'] = self::page(1, $page, $page_sum);
     $this->assign('read', $read);
     $this->assign('page', $pagebtn);
     $html = $this->fetch('Student:student_read_list');
     if (!$ajax) {
         $this->assign('readHtml', $html);
         $this->display('Student:student_read');
         exit;
     } else {
         returnjson(array('data' => $html));
     }
 }