12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace Cas\Dao;
- use KIF\Dao\AbstractDao;
- use KIF\Verify;
- class ArticleLike extends AbstractDao {
- protected $tableName = 'article_like';
-
-
- public function like($event_id, $uid) {
- if (!Verify::unsignedInt($event_id)) {
- return false;
- }
-
- if (!Verify::unsignedInt($uid)) {
- return false;
- }
-
- $tableInfo = array(
- 'event_id' => $event_id,
- 'uid' => $uid,
- );
- $tmpResult = $this->create($tableInfo);
- if (!$tmpResult) {
- return false;
- }
-
- return true;
- }
-
-
- 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;
- }
-
-
- 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;
- }
-
-
- }
|