本文整理汇总了PHP中account::updateCounters方法的典型用法代码示例。如果您正苦于以下问题:PHP account::updateCounters方法的具体用法?PHP account::updateCounters怎么用?PHP account::updateCounters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类account
的用法示例。
在下文中一共展示了account::updateCounters方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
public function remove($giftId)
{
$result = array("error" => true, "error_code" => ERROR_UNKNOWN);
$giftInfo = $this->info($giftId);
if ($giftInfo['error'] === true) {
return $result;
}
if ($giftInfo['giftTo'] != $this->requestFrom) {
return $result;
}
$currentTime = time();
$stmt = $this->db->prepare("UPDATE gifts SET removeAt = (:removeAt) WHERE id = (:giftId)");
$stmt->bindParam(":giftId", $giftId, PDO::PARAM_INT);
$stmt->bindParam(":removeAt", $currentTime, PDO::PARAM_INT);
if ($stmt->execute()) {
$result = array("error" => false, "error_code" => ERROR_SUCCESS);
$account = new account($this->db, $giftInfo['giftTo']);
$account->updateCounters();
unset($account);
$notify = new notify($this->db);
$notify->removeNotify($giftInfo['giftTo'], $giftInfo['giftFrom'], NOTIFY_TYPE_GIFT, $giftInfo['id']);
unset($notify);
}
return $result;
}
示例2: remove
public function remove($friendId)
{
$result = array("error" => true, "error_code" => ERROR_UNKNOWN);
$my_profile = new profile($this->db, $this->profileId);
if ($my_profile->is_friend_exists($friendId)) {
$currentTime = time();
$stmt = $this->db->prepare("UPDATE friends SET removeAt = (:removeAt) WHERE friendTo = (:friendTo) AND friend = (:friend) AND removeAt = 0");
$stmt->bindParam(":friendTo", $this->profileId, PDO::PARAM_INT);
$stmt->bindParam(":friend", $friendId, PDO::PARAM_INT);
$stmt->bindParam(":removeAt", $currentTime, PDO::PARAM_INT);
if ($stmt->execute()) {
$result = array("error" => false, "error_code" => ERROR_SUCCESS);
$stmt2 = $this->db->prepare("UPDATE friends SET removeAt = (:removeAt) WHERE friend = (:friend) AND friendTo = (:friendTo) AND removeAt = 0");
$stmt2->bindParam(":friend", $this->profileId, PDO::PARAM_INT);
$stmt2->bindParam(":friendTo", $friendId, PDO::PARAM_INT);
$stmt2->bindParam(":removeAt", $currentTime, PDO::PARAM_INT);
$stmt2->execute();
$account = new account($this->db, $this->profileId);
$account->updateCounters();
unset($account);
$account = new account($this->db, $friendId);
$account->updateCounters();
}
}
return $result;
}
示例3: like
public function like($fromUserId)
{
$result = array("error" => true, "error_code" => ERROR_UNKNOWN);
$account = new account($this->db, $fromUserId);
$account->setLastActive();
unset($account);
if ($this->is_like_exists($fromUserId)) {
$removeAt = time();
$stmt = $this->db->prepare("UPDATE profile_likes SET removeAt = (:removeAt) WHERE toUserId = (:toUserId) AND fromUserId = (:fromUserId) AND removeAt = 0");
$stmt->bindParam(":fromUserId", $fromUserId, PDO::PARAM_INT);
$stmt->bindParam(":toUserId", $toUserId, PDO::PARAM_INT);
$stmt->bindParam(":removeAt", $removeAt, PDO::PARAM_INT);
$stmt->execute();
$notify = new notify($this->db);
$notify->removeNotify($this->id, $fromUserId, NOTIFY_TYPE_LIKE, 0);
unset($notify);
$myLike = false;
} else {
$createAt = time();
$ip_addr = helper::ip_addr();
$stmt = $this->db->prepare("INSERT INTO profile_likes (toUserId, fromUserId, createAt, ip_addr) value (:toUserId, :fromUserId, :createAt, :ip_addr)");
$stmt->bindParam(":toUserId", $this->id, PDO::PARAM_INT);
$stmt->bindParam(":fromUserId", $fromUserId, PDO::PARAM_INT);
$stmt->bindParam(":createAt", $createAt, PDO::PARAM_INT);
$stmt->bindParam(":ip_addr", $ip_addr, PDO::PARAM_STR);
$stmt->execute();
$myLike = true;
if ($this->id != $fromUserId) {
$blacklist = new blacklist($this->db);
$blacklist->setRequestFrom($this->id);
if (!$blacklist->isExists($fromUserId)) {
$account = new account($this->db, $this->id);
if ($account->getAllowLikesGCM() == ENABLE_LIKES_GCM) {
$gcm = new gcm($this->db, $this->id);
$gcm->setData(GCM_NOTIFY_LIKE, "You have new like", 0);
$gcm->send();
}
unset($account);
$notify = new notify($this->db);
$notify->createNotify($this->id, $fromUserId, NOTIFY_TYPE_LIKE, 0);
unset($notify);
}
unset($blacklist);
}
}
$account = new account($this->db, $this->id);
$account->updateCounters();
$likesCount = $account->getLikesCount();
unset($account);
$result = array("error" => false, "error_code" => ERROR_SUCCESS, "likesCount" => $likesCount, "myLike" => $myLike);
return $result;
}
示例4: remove
public function remove($photoId)
{
$result = array("error" => true);
$photoInfo = $this->info($photoId);
if ($photoInfo['error'] === true) {
return $result;
}
if ($photoInfo['fromUserId'] != $this->requestFrom) {
return $result;
}
$currentTime = time();
$stmt = $this->db->prepare("UPDATE photos SET removeAt = (:removeAt) WHERE id = (:photoId)");
$stmt->bindParam(":photoId", $photoId, PDO::PARAM_INT);
$stmt->bindParam(":removeAt", $currentTime, PDO::PARAM_INT);
if ($stmt->execute()) {
$result = array("error" => false);
$account = new account($this->db, $photoInfo['fromUserId']);
$account->updateCounters();
unset($account);
}
return $result;
}