$event_id, 'uid' => $uid, ); $tmpResult = $this->create($tableInfo); if (!$tmpResult) { return false; } return true; } /** * 取消点赞 * @param int $event_id * @param int $uid * @return boolean */ public function cancalLike($event_id, $uid) { if (!Verify::unsignedInt($event_id)) { return false; } if (!Verify::unsignedInt($uid)) { return false; } $condition = array( 'event_id' => $event_id, 'uid' => $uid, ); $tmpResult = $this->delete($condition); if (!$tmpResult) { return false; } return true; } /** * 是否已经喜欢 * @param int $event_id * @param int $uid * @return boolean */ public function isHasLike($event_id, $uid) { if (!Verify::unsignedInt($event_id)) { return false; } if (!Verify::unsignedInt($uid)) { return false; } $condition = array( 'event_id' => $event_id, 'uid' => $uid, ); $tmpResult = $this->fetchOne($condition); if (!$tmpResult) { return false; } return true; } }