public function addLike(PwUserBo $userBo, PwLikeDm $dm) { if (!Wekit::C('site', 'task.isOpen')) { return true; } $data = $dm->getData(); if ($data['typeid'] != PwLikeContent::THREAD) { return false; } /* @var $dm PwLikeDm */ $bp = new PwTaskComplete($userBo->uid, $this); $thread = Wekit::load('forum.PwThread')->getThread($data['fromid']); $this->fid = $thread['fid']; $bp->doTask('bbs', 'like'); }
public function addLike(PwUserBo $userBo, PwLikeDm $dm) { Wind::import('SRV:medal.srv.PwAutoAwardMedal'); $data = $dm->getData(); $ds = Wekit::load('user.PwUserBehavior'); $behavior = $ds->getBehavior($data['belikeuid'], 'belike_times'); $condition = isset($behavior['number']) ? (int) $behavior['number'] : 0; $bp = new PwAutoAwardMedal(new PwUserBo($data['belikeuid'])); $bp->autoAwardMedal(6, $condition); //喜欢统计 $condition = isset($userBo->info['likes']) ? (int) $userBo->info['likes'] : 0; $bp = new PwAutoAwardMedal($userBo); $bp->autoAwardMedal(9, $condition); //like_count return true; }
/** * 更新内容 * * @param PwLikeDm $dm */ public function updateInfo(PwLikeDm $dm) { $resource = $dm->beforeUpdate(); if ($resource instanceof PwError) { return $resource; } return $this->_getLikeContentDao()->updateInfo($dm->likeid, $dm->getData()); }
public function addLike(PwUserBo $userBo, PwLikeDm $dm) { $data = $dm->getData(); $ds = Wekit::load('user.PwUserBehavior'); return $ds->replaceBehavior($data['belikeuid'], 'belike_times'); }