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


PHP Notification::createRecord方法代码示例

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


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

示例1: changeConsumerRank

 function changeConsumerRank($uid)
 {
     //consumer information
     if (!isset($this->consumer)) {
         $this->consumer = new Consumer();
     }
     $this->consumerData = $this->consumer->fetchRow('id = ' . $uid);
     //total points
     $this->rewardPointTransactionRecord = new RewardPointTransactionRecord();
     $rewardData = $this->rewardPointTransactionRecord->fetchAll('consumer_id=' . $uid . ' and transaction_id !=4');
     $rewardDataArray = $rewardData->toArray();
     $total = 0;
     if (count($rewardDataArray)) {
         foreach ($rewardDataArray as $val) {
             $total += $val['point_amount'];
         }
     }
     //participated campaigns
     $campaign = new CampaignInvitation();
     $campaignData = $campaign->fetchAll('state = "ACCEPTED" and consumer_id =' . $uid);
     $campaginNum = count($campaignData);
     //rank information
     $rank = $this->fetchRow('campaign_number<=' . $campaginNum . ' and point_total<=' . $total, 'point_total desc');
     if (count($rank)) {
         if ($this->consumerData->rank == $rank->id) {
             return;
         } else {
             $this->consumerData->rank = $rank->id;
             $this->consumerData->save();
             // add notification
             $notificationModel = new Notification();
             $notificationModel->createRecord("RANK_UPGRADE", $uid);
             $row = $this->rewardPointTransactionRecord->createRow();
             $row->consumer_id = $uid;
             $row->date = date("Y-m-d H:i:s");
             $row->transaction_id = 7;
             $row->point_amount = $rank->point_bonus;
             $row->save();
             $this->changeConsumerRank($uid);
         }
     } else {
         return;
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:44,代码来源:Rank.php

示例2: redeemAction

 function redeemAction()
 {
     $this->view->title = $this->view->translate("Wildfire") . " - " . $this->view->translate("GIFT_REDEEM");
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         $cartNamespace = new Zend_Session_Namespace('Cart');
         if ($cartNamespace->list == null) {
             $this->_redirect('gift/list');
             return;
         }
         // validate consumer info
         $consumerModel = new Consumer();
         $consumer = $consumerModel->fetchRow("email = '" . $this->_currentUser->email . "' and password = MD5('" . $formData['password'] . "')");
         if ($consumer == null) {
             $this->_flashMessenger->addMessage($this->view->translate("Gift_consumer_info_incorrect"));
             $this->_flashMessenger->addMessage(true);
             $this->_redirect('gift/confirmcart');
             return;
         }
         // check redeem condition
         $db = Zend_Registry::get('db');
         $selectTotalCompletedCampaign = $db->select();
         $selectTotalCompletedCampaign->from('campaign_participation', 'count(*)')->join('campaign_invitation', 'campaign_participation.campaign_invitation_id = campaign_invitation.id', null)->where('campaign_invitation.consumer_id = ?', $this->_currentUser->id);
         $this->view->completedCampaignAmount = $db->fetchOne($selectTotalCompletedCampaign);
         //			$selectTotalSubmittedReport = $db->select();
         //			$selectTotalSubmittedReport->from('report', 'count(*)')
         //			->where('state = "APPROVED"')
         //			->where('consumer_id = ?', $this->_currentUser->id);
         //			$this->view->submittedReportAmount = $db->fetchOne($selectTotalSubmittedReport);
         if ($this->view->completedCampaignAmount < 1 || $this->_currentUser->pest != null && $this->_currentUser->pest == 1) {
             $this->_flashMessenger->addMessage($this->view->translate("Gift_can_not_redeem_gift"));
             $this->_flashMessenger->addMessage(true);
             $this->_redirect('gift/confirmcart');
             return;
         }
         // check the point
         $selectUsablePoints = $db->select();
         $selectUsablePoints->from('reward_point_transaction_record', 'SUM(point_amount)')->where("consumer_id = ?", $this->_currentUser->id);
         $usablePoints = (int) $db->fetchOne($selectUsablePoints);
         $amountSelectedProductPoint = 0;
         foreach ($cartNamespace->list as $product) {
             $selectSelectedProductPoint = $db->select();
             $selectSelectedProductPoint->from('product', 'point')->where("id = " . $product['id']);
             $selectedProductPoint = (int) $db->fetchOne($selectSelectedProductPoint);
             $amountSelectedProductPoint += $product['amount'] * $selectedProductPoint;
         }
         if ($amountSelectedProductPoint > $usablePoints) {
             $this->_flashMessenger->addMessage($this->view->translate("Gift_have_no_enough_point"));
             $this->_flashMessenger->addMessage(true);
             $this->_redirect('gift/confirmcart');
             return;
         }
         // save shipping info
         $consumerModel = new Consumer();
         $id = $this->_currentUser->id;
         $consumer = $consumerModel->find($id)->current();
         $consumer->recipients_name = $formData['recipients_name'];
         $consumer->phone = $formData['phone'];
         $consumer->address1 = $formData['address1'];
         $consumer->postalcode = $formData['postalcode'];
         if ($formData['city'] != null && $formData['province'] != null) {
             $consumer->city = $formData['city'];
             $consumer->province = $formData['province'];
         }
         if ($formData['englishcity'] != null) {
             $consumer->city = $formData['englishcity'];
             $consumer->province = null;
         }
         if ($formData['province'] == '' && $formData['englishcity'] == null) {
             $consumer->city = null;
             $consumer->province = null;
         }
         $consumer->save();
         // save exchange records
         $currentTime = date("Y-m-d H:i:s");
         $rewardPointTransactionRecordModel = new RewardPointTransactionRecord();
         $prodcutOrderModel = new ProductOrder();
         $notificationModel = new Notification();
         $total_redeem_point = 0;
         foreach ($cartNamespace->list as $product) {
             // add records to reward_point_transaction_record table
             $rewardPointTransactionRecord = array("consumer_id" => $this->_currentUser->id, "DATE" => $currentTime, "transaction_id" => '4', "point_amount" => -$product['amount'] * $product['point']);
             $transactionRecordId = $rewardPointTransactionRecordModel->insert($rewardPointTransactionRecord);
             // add records to product_order table
             $prodcutOrder = array('consumer_id' => $this->_currentUser->id, 'product_id' => $product['id'], 'create_date' => $currentTime, 'state' => 'NEW', 'reward_point_transaction_record_id' => $transactionRecordId, 'amount' => $product['amount']);
             $prodcutOrderId = $prodcutOrderModel->insert($prodcutOrder);
             // roll back if an exception occurred
             // ...
             $total_redeem_point += $product['amount'] * $product['point'];
         }
         // add notification
         $notificationModel->createRecord("REDEEM_POINT", $this->_currentUser->id, $total_redeem_point);
         $this->paidGifts = $cartNamespace->list;
         $cartNamespace->list = null;
         // show redeem.phtml with "... Successfully"
         $this->_flashMessenger->addMessage("Gift_submit_orders_successfully");
         $this->_flashMessenger->addMessage(false);
         $this->_flashMessenger->addMessage($this->paidGifts);
         $this->_redirect('gift/thankyou');
     } else {
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:wildfire_php,代码行数:101,代码来源:GiftController.php

示例3: adminprofilesurveyAction

 function adminprofilesurveyAction()
 {
     $profileSurvey = $this->_request->getParam('profileSurvey');
     $consumerId = $this->_request->getParam('id');
     $consumerArray = explode(',', $consumerId);
     $profileSurveyInvitation = new ProfileSurveyInvitation();
     $notificationModel = new Notification();
     foreach ($consumerArray as $consumer) {
         if ($consumer != '') {
             $invitation = $profileSurveyInvitation->fetchRow('consumer_id = ' . $consumer . ' and profile_id = ' . $profileSurvey);
             if (!count($invitation)) {
                 $currentTime = date("Y-m-d H:i:s");
                 $row = $profileSurveyInvitation->createRow();
                 $row->consumer_id = $consumer;
                 $row->profile_id = $profileSurvey;
                 $row->date = $currentTime;
                 $row->save();
                 // add notification
                 $notificationModel->createRecord("PROFILE_SURVEY", $consumer, $profileSurvey);
             }
         }
     }
     $this->_helper->json('Success');
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:24,代码来源:CampaigninvitationController.php


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