当前位置: 首页>>代码示例>>PHP>>正文


PHP account::getAllowGiftsGCM方法代码示例

本文整理汇总了PHP中account::getAllowGiftsGCM方法的典型用法代码示例。如果您正苦于以下问题:PHP account::getAllowGiftsGCM方法的具体用法?PHP account::getAllowGiftsGCM怎么用?PHP account::getAllowGiftsGCM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在account的用法示例。


在下文中一共展示了account::getAllowGiftsGCM方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 public function send($giftId, $giftTo, $message, $giftAnonymous = 0)
 {
     $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
     if ($giftId == 0) {
         return $result;
     }
     $giftInfo = $this->db_info($giftId);
     if ($giftInfo['error'] === true) {
         return $result;
     }
     $currentTime = time();
     $stmt = $this->db->prepare("INSERT INTO gifts (giftId, giftTo, giftFrom, giftAnonymous, message, imgUrl, createAt) value (:giftId, :giftTo, :giftFrom, :giftAnonymous, :message, :imgUrl, :createAt)");
     $stmt->bindParam(":giftId", $giftId, PDO::PARAM_INT);
     $stmt->bindParam(":giftTo", $giftTo, PDO::PARAM_INT);
     $stmt->bindParam(":giftFrom", $this->requestFrom, PDO::PARAM_INT);
     $stmt->bindParam(":giftAnonymous", $giftAnonymous, PDO::PARAM_INT);
     $stmt->bindParam(":message", $message, PDO::PARAM_STR);
     $stmt->bindParam(":imgUrl", $giftInfo['imgUrl'], PDO::PARAM_STR);
     $stmt->bindParam(":createAt", $currentTime, PDO::PARAM_INT);
     if ($stmt->execute()) {
         $giftId = $this->db->lastInsertId();
         $result = array("error" => false, "error_code" => ERROR_SUCCESS, "giftId" => $this->db->lastInsertId(), "gift" => $this->info($this->db->lastInsertId()));
         $account = new account($this->db, $giftTo);
         $account->updateCounters();
         unset($account);
         if ($this->requestFrom != $giftTo) {
             $blacklist = new blacklist($this->db);
             $blacklist->setRequestFrom($giftTo);
             if (!$blacklist->isExists($this->requestFrom)) {
                 $account = new account($this->db, $giftTo);
                 if ($account->getAllowGiftsGCM() == ENABLE_GIFTS_GCM) {
                     $gcm = new gcm($this->db, $giftTo);
                     $gcm->setData(GCM_NOTIFY_GIFT, "You have new gift", 0);
                     $gcm->send();
                 }
                 unset($account);
                 $notify = new notify($this->db);
                 $notify->createNotify($giftTo, $this->requestFrom, NOTIFY_TYPE_GIFT, $giftId);
                 unset($notify);
             }
             unset($blacklist);
         }
     }
     return $result;
 }
开发者ID:JohnWilliamsMSU,项目名称:Steady,代码行数:45,代码来源:class.gift.inc.php

示例2: isset

<?php

/*!
 * ifsoft.co.uk engine v1.0
 *
 * http://ifsoft.com.ua, http://ifsoft.co.uk
 * qascript@ifsoft.co.uk
 *
 * Copyright 2012-2016 Demyanchuk Dmitry (https://vk.com/dmitry.demyanchuk)
 */
include_once $_SERVER['DOCUMENT_ROOT'] . "/core/init.inc.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/config/api.inc.php";
if (!empty($_POST)) {
    $accountId = isset($_POST['accountId']) ? $_POST['accountId'] : 0;
    $accessToken = isset($_POST['accessToken']) ? $_POST['accessToken'] : '';
    $allowGiftsGCM = isset($_POST['allowGiftsGCM']) ? $_POST['allowGiftsGCM'] : 0;
    $allowGiftsGCM = helper::clearInt($allowGiftsGCM);
    $result = array("error" => true, "error_code" => ERROR_UNKNOWN);
    $auth = new auth($dbo);
    if (!$auth->authorize($accountId, $accessToken)) {
        api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
    }
    $result = array("error" => false, "error_code" => ERROR_SUCCESS);
    $account = new account($dbo, $accountId);
    $account->setAllowGiftsGCM($allowGiftsGCM);
    $result['allowGiftsGCM'] = $account->getAllowGiftsGCM();
    echo json_encode($result);
    exit;
}
开发者ID:JohnWilliamsMSU,项目名称:Steady,代码行数:29,代码来源:account.setAllowGiftsGCM.inc.php


注:本文中的account::getAllowGiftsGCM方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。