/** * 对喜欢所属分类进行增减 * @param int $type 1 增加, 0 减 */ public function editLogTag($logid, $tagid, $type = 0) { $logInfo = $this->_getLikeLogDs()->getLikeLog($logid); $tagids = explode(',', $logInfo['tagids']); if ($type) { $tagids[] = $tagid; $this->_getLikeRelationsDs()->addInfo($logid, $tagid); $this->_getLikeTagDs()->updateNumber($tagid); } else { $k = array_search($tagid, $tagids); if ($k) { unset($tagids[$k]); } $this->_getLikeRelationsDs()->deleteInfo($logid, $tagid); $this->_getLikeTagDs()->updateNumber($tagid, false); } //更新log Tag Wind::import('SRV:like.dm.PwLikeLogDm'); $logDm = new PwLikeLogDm($logid); $logDm->setTagids($tagids); $this->_getLikeLogDs()->updateInfo($logDm); return true; }
/** * 更新内容 * * @param int $logid * @param PwLikeDm $dm */ public function updateInfo(PwLikeLogDm $dm) { $resource = $dm->beforeUpdate(); if ($resource instanceof PwError) { return $resource; } return $this->_getLikeLogDao()->updateInfo($dm->logid, $dm->getData()); }