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


PHP Notifications::sendPushNotification方法代码示例

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


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

示例1: actionUpload

 /**
  * Upload a new document.
  *
  * @author Kuldeep Dangi <kuldeep.dangi@yiifrmae.com>
  */
 public function actionUpload()
 {
     //name,category_id,images,description,price,userid,
     $model = new Extensions();
     if (!empty($_POST['user_id'])) {
         $userModel = Users::model()->findByPk($_POST['user_id']);
         if ($userModel) {
             $model->attributes = $_POST;
             $uploadedFiles = CUploadedFile::getInstancesByName('images');
             if ($uploadedFiles && count($uploadedFiles) > 0) {
                 $allUploadedFiles = array();
                 foreach ($uploadedFiles as $uploadedFile) {
                     $fileName = strtotime($this->getCurrentDateTime()) . '-' . $uploadedFile;
                     $uploadedFile->saveAs(Yii::app()->basePath . '/../../' . Extensions::FILE_UPLOAD_PATH . $fileName);
                     $allUploadedFiles[] = $fileName;
                 }
                 $savedFileNames = $model->getPdfFromImages($allUploadedFiles);
                 $model->pdf = Extensions::FILE_CONVERT_PATH . $savedFileNames['pdf'];
                 $model->imagepdf = $savedFileNames['imagepdf'];
                 $model->image = Extensions::FILE_IMAGE_PATH . $savedFileNames['image'];
                 if ($model->save()) {
                     //Update Reward points
                     //                        $userModel->rewardpoints = $userModel->rewardpoints +
                     //                                self::REWARD_ON_NOTE_UPLOAD;
                     //                        $userModel->save();
                     $nCash = new Ncash();
                     $nCash->addAmount($userObj->user_id, self::REWARD_ON_NOTE_UPLOAD, 2);
                     $notficationModel = new Notifications();
                     $notficationModel->sendPushNotification(array('deviceToken' => $userModel->deviceToken, 'deviceType' => $userModel->deviceType, 'message' => 2));
                     $this->result['success'] = true;
                 } else {
                     $this->result['message'] = 'Record save failed.';
                 }
             } else {
                 $this->result['message'] = 'No images to save';
             }
         } else {
             $this->result['message'] = 'User does not exist.';
         }
     } else {
         $this->result['message'] = 'Invalid user id.';
     }
     $this->sendResponse($this->result);
 }
开发者ID:kuldeepro,项目名称:notesgen,代码行数:49,代码来源:DocumentController.php

示例2: actionCheckoutApp

 /**
  * Handle webhook request from instamojo
  *
  * @author Kuldeep Dangi <kuldeep.dangi@yiifrmae.com>
  */
 public function actionCheckoutApp($userId)
 {
     $cartModel = new Cartdetails();
     $userModel = new Users();
     $userByExtentionId = new UsersBuyExtensions();
     $userObj = Users::model()->findByPk($userId);
     $cartData = $cartModel->getUserCartProductIds($userId);
     $settingsModel = Setting::model()->findByPk(1);
     if (!$userObj || count($cartData) < 1) {
         exit;
     }
     $notficationModel = new Notifications();
     $notficationModel->sendPushNotification(array('deviceToken' => $userObj->deviceToken, 'deviceType' => $userObj->deviceType, 'message' => 3));
     foreach ($cartData as $cartRow) {
         $orderModel = new Order();
         $model = Cartdetails::model()->findByPk($cartRow['id']);
         $extentionObj = Extensions::model()->findByPk($model->productid);
         $nCashAmount = $model->price - $model->price * $settingsModel->commission / 100;
         $data = array("user_id" => $userObj->user_id, "coupondata" => '', "uservalrewdata" => '', "userval" => '', "extension_id" => $model->productid, "rewardpoints" => '', "extension_name" => $extentionObj->name, "extension_price" => $model->price, "quantity" => 1, "total_price" => $model->price, "shipping_fee" => '', "transaction_paypal_id" => $_POST['payment_id'], "commission" => $settingsModel->commission, "total_balance" => $nCashAmount, "created_date" => time(), 'added_date' => $this->getCurrentDateTime(), "status" => 1, "payment_type" => 1, "address_id" => 0);
         $orderModel->attributes = $data;
         if ($orderModel->save()) {
             $userModel = Users::model()->findByPk($extentionObj->user_id);
             $nCash = new Ncash();
             // Ncash deducted from buyer account
             $nCash->deductAmount($userObj->user_id, $model->price);
             // Ncash awarded to buyer
             $nCash->addAmount($userObj->user_id, self::REWARD_ON_NOTE_PURCHASE, 2);
             // Ncash for seller
             $nCash->addAmount($userModel->user_id, $nCashAmount, 5);
             if ($userModel) {
                 $notficationModel->sendPushNotification(array('deviceToken' => $userModel->deviceToken, 'deviceType' => $userModel->deviceType, 'message' => 4));
             }
             $model->used = 1;
             $model->save();
             //increment extention download
             // email notification
             $userBuyExtentionObj = $userByExtentionId->findByAttributes(array('user_id' => $userObj->user_id, 'extension_id' => $model->productid));
             if ($userBuyExtentionObj) {
                 $userBuyExtentionObj->download = $userBuyExtentionObj->download + $settingsModel->download_times;
                 if ($userBuyExtentionObj->expire_time > time()) {
                     $userBuyExtentionObj->expire_time = $userBuyExtentionObj->expire_time + $settingsModel->download_expire;
                 } else {
                     $userBuyExtentionObj->expire_time = time() + $settingsModel->download_expire;
                 }
                 $userBuyExtentionObj->save();
             } else {
                 $userByExtentionId->attributes = array('user_id' => $userObj->user_id, 'extension_id' => $model->productid, 'download' => $settingsModel->download_times, 'expire_time' => time() + $settingsModel->download_expire);
                 $userByExtentionId->save();
             }
         }
         $this->result['success'] = true;
     }
     $this->sendResponse($this->result);
 }
开发者ID:kuldeepro,项目名称:notesgen,代码行数:59,代码来源:CartController.php

示例3: actionFollowUser

 /**
  * Add a user to follower list of other and send notifcation
  *
  * @author Kuldeep Dangi <kuldeep.dangi@yiifrmae.com>
  */
 public function actionFollowUser($userId, $followerId)
 {
     $model = new UserFollow();
     $userFollowingObj = Users::model()->findByPk($userId);
     $userObj = Users::model()->findByPk($followerId);
     if ($userFollowingObj && $userObj) {
         $isRecrodExist = $model->findByAttributes(array('id_follower' => $followerId, 'id_following' => $userId));
         if ($isRecrodExist) {
             $this->result['success'] = true;
         } else {
             $model->attributes = array('id_follower' => $followerId, 'id_following' => $userId);
             if ($model->validate() && $model->save()) {
                 $notificationObj = new Notifications();
                 $notificationObj->addNotification(array('byUserId' => $userId, 'user_id' => $followerId, 'type' => 'FOLLOW'));
                 $notificationObj->sendPushNotification(array('deviceToken' => $userObj->deviceToken, 'deviceType' => $userObj->deviceType, 'message' => $userFollowingObj->username . ' has started following you.'));
                 $this->result['success'] = true;
                 $this->getUserInformation($userId);
                 $this->result['message'] = 'Record saved successfuly.';
             } else {
                 $this->result['message'] = 'Invalid Data.';
             }
         }
     } else {
         $this->result['message'] = 'Invalid data.';
     }
     $this->sendResponse($this->result);
 }
开发者ID:kuldeepro,项目名称:notesgen,代码行数:32,代码来源:UsersController.php

示例4: actionAddFile

 /**
  * Add a file in response of a wishlist request.
  *
  * @author Kuldeep Dangi <kuldeep.dangi@yiifrmae.com>
  */
 public function actionAddFile()
 {
     $model = new Extensions();
     $modelUserFeed = new UserFeed();
     if (!empty($_POST['user_id']) && !empty($_POST['reply_to_feed'])) {
         $model->attributes = $_POST;
         $uploadedFiles = CUploadedFile::getInstancesByName('images');
         if ($uploadedFiles && count($uploadedFiles) > 0) {
             $allUploadedFiles = array();
             foreach ($uploadedFiles as $uploadedFile) {
                 $fileName = strtotime($this->getCurrentDateTime()) . '-' . $uploadedFile;
                 $uploadedFile->saveAs(Yii::app()->basePath . '/../../' . Extensions::FILE_UPLOAD_PATH . $fileName);
                 $allUploadedFiles[] = $fileName;
             }
             $savedFileNames = $model->getPdfFromImages($allUploadedFiles);
             $model->pdf = Extensions::FILE_CONVERT_PATH . $savedFileNames['pdf'];
             $model->imagepdf = $savedFileNames['imagepdf'];
             $model->image = Extensions::FILE_IMAGE_PATH . $savedFileNames['image'];
             if ($model->save()) {
                 $modelUserFeed->user_id = $_POST['user_id'];
                 $modelUserFeed->reply_to_feed = $_POST['reply_to_feed'];
                 $modelUserFeed->comment = Extensions::FILE_CONVERT_PATH . $savedFileNames['pdf'];
                 $modelUserFeed->is_file = 1;
                 $modelUserFeed->date_add = time();
                 $modelUserFeed->save();
                 $feedData = $this->loadModel($_POST['reply_to_feed']);
                 $notificationObj = new Notifications();
                 $notificationObj->addNotification(array('byUserId' => $_GET['user_id'], 'user_id' => $feedData->user_id, 'notify_comment' => $feedData->user_feed_id, 'type' => 'WISHLISTUPLOAD'));
                 $userObj = Users::model()->findByPk($feedData->user_id);
                 if ($userObj && !empty($userObj->deviceToken)) {
                     $notificationObj->sendPushNotification(array('deviceToken' => $userObj->deviceToken, 'deviceType' => $userObj->deviceType, 'message' => 6));
                 }
                 $this->result['success'] = true;
             }
         }
     } else {
         $this->result['message'] = 'Invalid Data.';
     }
     $this->sendResponse($this->result);
 }
开发者ID:kuldeepro,项目名称:notesgen,代码行数:45,代码来源:WishlistController.php


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