Example #1
0
 /**
  * 更新发布时间
  * @return json
  */
 public function doUpdateTime()
 {
     //判断权限
     if (!in_array($_SESSION['group'], array(3, 4))) {
         echo json_encode(array('error' => true, 'msg' => '你没权限进行审核操作'));
         return;
     }
     $id = intval($_POST['id']);
     $time = $_POST['time'] . ':00';
     //$is_time = strptime($_POST['time'],'Y-m-d H:i:s');
     $is_time = release::checkTime($time);
     if ($is_time === false) {
         echo json_encode(array('error' => true, 'msg' => '时间格式错误'));
         return;
     }
     if (empty($id)) {
         echo json_encode(array('error' => true, 'msg' => '选择的文章错误'));
         return;
     }
     $date = date('Ymd', strtotime($time));
     $url = $this->app->cfg['game'][$_SESSION['gameid']]['host'] . 'news/' . $date . '/' . $id . '.html';
     $query = $this->app->orm()->query();
     $bol = $query->clear()->addTable('Article')->addWhere('ArticleId', $id)->addWhere('GameType', intval($_SESSION['gameid']))->addValue('PublishTime', $time)->addValue('Url', $url)->update();
     if (empty($bol)) {
         echo json_encode(array('error' => true, 'msg' => '选择的文章错误'));
     } else {
         $this->sync($id);
         echo json_encode(array('error' => false, 'msg' => '时间修改成功', 'time' => $time));
     }
 }