当前位置: 首页>>代码示例>>PHP>>正文


PHP ArticleModel::update方法代码示例

本文整理汇总了PHP中ArticleModel::update方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleModel::update方法的具体用法?PHP ArticleModel::update怎么用?PHP ArticleModel::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArticleModel的用法示例。


在下文中一共展示了ArticleModel::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: detailAction

 public function detailAction()
 {
     $p = $_REQUEST;
     $pAid = empty($p['aid']) ? 0 : intval($p['aid']);
     if (empty($pAid)) {
         echo 'error aid';
         exit;
     }
     $tMO = new ArticleModel();
     $tImgUrl = Yaf_Registry::get("config")->web->url->img;
     $tRow = $tMO->field('id aid, concat(\'' . $tImgUrl . '\', head_img)  head_img,content,(view+initview) viewtotal,title,description,created,source')->where(' id = ' . $pAid)->fRow();
     if (empty($tRow['aid'])) {
         die('该文章不存在');
     }
     $tData = array('id' => $pAid, 'view' => $tRow['viewtotal'] + 1);
     $tMO->update($tData);
     $this->assign('tRow', $tRow);
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:18,代码来源:Article.php

示例2: indexAction

 public function indexAction()
 {
     $tTime = time();
     $tMO = new ArticleModel();
     $tDatas = $tMO->field('title,id,description')->where('is_tui = 0 and status = 1 and push_time <= ' . $tTime)->fList();
     print_R($tDatas);
     if (!count($tDatas)) {
         exit;
     }
     $tGMO = new GetuiModel();
     $tGDatas = $tGMO->field('devicetoken,cid')->fList();
     $tRedis = Cache_Redis::instance();
     foreach ($tDatas as $tRow) {
         foreach ($tGDatas as $tR) {
             $tRes = serialize(array_merge($tRow, $tR, array('type' => 'article', 'content' => '')));
             $tRedis->lpush('dakang_getui', $tRes);
         }
         $tData = array('is_tui' => 1, 'id' => $tRow['id']);
         $tMO->update($tData);
     }
     exit;
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:22,代码来源:Article.php

示例3: editAction

 public function editAction()
 {
     $p = $_REQUEST;
     $pId = empty($p['id']) ? 0 : intval($p['id']);
     $tAMO = new ArticleModel();
     $tCateMO = new CategoryModel();
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $pTitle = empty($p['title']) ? Tool_Fnc::ajaxMsg('文章标题不能为空') : Tool_Fnc::safe_string($p['title']);
         $pCateid = empty($p['cate_id']) ? 0 : intval($p['cate_id']);
         $pContent = empty($p['content']) ? Tool_Fnc::ajaxMsg('内容不能为空') : Tool_Fnc::safe_string($p['content']);
         $pHeadimg = empty($p['head_img']) ? '' : Tool_Fnc::safe_string($p['head_img']);
         $pDescription = empty($p['description']) ? '' : Tool_Fnc::safe_string($p['description']);
         $pSource = empty($p['source']) ? '' : Tool_Fnc::safe_string($p['source']);
         $pInitview = empty($p['initview']) ? '0' : intval($p['initview']);
         $pStatus = empty($p['status']) ? '0' : intval($p['status']);
         $pPushtime = empty($p['push_time']) ? Tool_Fnc::ajaxMsg('请选择日期') : Tool_Fnc::safe_string($p['push_time']);
         $pPushtime = time($pPushtime);
         $tTime = time();
         $tCateRow = $tCateMO->field('*')->where('id = ' . $pCateid)->fRow();
         if (empty($tCateRow['id'])) {
             Tool_Fnc::ajaxMsg('请选择文章分类');
         }
         $tHeadimg = '';
         if (!empty($_FILES['img'])) {
             $tImgurl = '/articleimg/' . date('Y') . '/' . date('m') . '/';
             $tDir = APPLICATION_PATH . '/public' . $tImgurl;
             $tUpload = new Tool_Upload($_FILES['img'], $tDir);
             $tSavename = $tUpload->getSaveName();
             $tExt = $tUpload->extension;
             $tFile = $tSavename . '.' . $tExt;
             $tRes = $tUpload->upload($tSavename);
             if ($tRes == 1) {
                 $tHeadimg = Yaf_Registry::get("config")->web->url->staticimg . $tImgurl . $tFile;
                 if (!empty($pHeadimg)) {
                     unlink(APPLICATION_PATH . '/public' . $pHeadimg);
                 }
             }
         }
         $tHeadimg = empty($tHeadimg) ? $pHeadimg : $tHeadimg;
         $tData = array('head_img' => $tHeadimg, 'title' => $pTitle, 'content' => $pContent, 'description' => $pDescription, 'cate_id' => $pCateid, 'cate_name' => $tCateRow['name'], 'cate_title' => $tCateRow['title'], 'source' => $pSource, 'initview' => $pInitview, 'updated' => $tTime, 'status' => $pStatus, 'push_time' => $pPushtime, 'id' => $pId);
         if (!$tAMO->update($tData)) {
             Tool_Fnc::ajaxMsg('修改失败');
         }
         Tool_Fnc::ajaxMsg('修改成功', 1);
     }
     $tDatas = $tCateMO->field('id,pid,name,title')->fList();
     $this->assign('tCatelist', Tool_Fnc::getSortedCategory($tDatas));
     $tAinfo = $tAMO->field('*')->where('id = ' . $pId)->fRow();
     $this->assign('tAinfo', $tAinfo);
     $this->assign('tId', $pId);
 }
开发者ID:tanqinwang,项目名称:test_own,代码行数:51,代码来源:Article.php


注:本文中的ArticleModel::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。