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


PHP Rank::changeConsumerRank方法代码示例

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


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

示例1: thankyouAction

 function thankyouAction()
 {
     $this->view->activeTab = 'Polls';
     $this->view->title = $this->view->title = $this->view->translate("Wildfire") . " - " . $this->view->translate("Thanks_For_Poll");
     $consumer = $this->_currentUser;
     $id = (int) $this->_request->getParam('survey', 0);
     $profileSurveyModel = new ProfileSurvey();
     $profileSurvey = $profileSurveyModel->fetchRow("i2_survey_id =" . $id . " or " . "i2_survey_id_en =" . $id);
     // $this->view->point = $profileSurvey->points;
     //check history to prevent multiple participation
     $db = Zend_Registry::get('db');
     $select1 = $db->select();
     $select1->from("poll_participation", "count(*)");
     $select1->where("poll_participation.poll_id = ?", $profileSurvey->id);
     $select1->where("poll_participation.consumer_id = ?", $consumer->id);
     $participationCount = $db->fetchOne($select1);
     if ($participationCount == 0) {
         // check ws
         $indicate2Connect = new Indicate2_Connect();
         $ids = array($id);
         $wsResult = $indicate2Connect->getAnswerSetCount($consumer->email, $ids);
         // Zend_Debug::dump($wsResult."------------".$profileSurvey->points);die;
         if ($wsResult > 0) {
             // add poll participation
             $currentTime = date("Y-m-d H:i:s");
             $pollParticipationModel = new PollParticipation();
             $pollParticipation = $pollParticipationModel->createRow();
             $pollParticipation->poll_id = $profileSurvey->id;
             $pollParticipation->consumer_id = $consumer->id;
             $pollParticipation->date = $currentTime;
             $pollParticipation->save();
             // add points
             $pointRecordModel = new RewardPointTransactionRecord();
             $point = $pointRecordModel->createRow();
             $point->consumer_id = $consumer->id;
             $point->transaction_id = 3;
             $point->date = $currentTime;
             $point->point_amount = $profileSurvey->points;
             $point->save();
             //2011-05-13 change the rank of consumer
             $rankModel = new Rank();
             $rankModel->changeConsumerRank($consumer->id);
             $this->view->point = $point->point_amount;
         } else {
             // add poll participation
             $currentTime = date("Y-m-d H:i:s");
             $pollParticipationModel = new PollParticipation();
             $pollParticipation = $pollParticipationModel->createRow();
             $pollParticipation->poll_id = $profileSurvey->id;
             $pollParticipation->consumer_id = $consumer->id;
             $pollParticipation->date = $currentTime;
             $pollParticipation->save();
             // add points
             $pointRecordModel = new RewardPointTransactionRecord();
             $point = $pointRecordModel->createRow();
             $point->consumer_id = $consumer->id;
             $point->transaction_id = 3;
             $point->date = $currentTime;
             $point->point_amount = $profileSurvey->points;
             $point->save();
             //2011-05-13 change the rank of consumer
             $rankModel = new Rank();
             $rankModel->changeConsumerRank($consumer->id);
             $this->view->point = $point->point_amount;
         }
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:67,代码来源:ProfilesurveyController.php

示例2: adminsaveurlreportstateAction

 function adminsaveurlreportstateAction()
 {
     $type = $this->_request->getParam('type');
     $db = Zend_Registry::get('db');
     if ($type == 'reportState') {
         $idStr = $this->_request->getParam('reportids');
         $idStrArray = explode(',', $idStr);
         $reportIdArray = array();
         $i = 0;
         $config = Zend_Registry::get('config');
         $smtpSender = new Zend_Mail_Transport_Smtp($config->smtp->report->mail->server, array('username' => $config->smtp->report->mail->username, 'password' => $config->smtp->report->mail->password, 'auth' => $config->smtp->report->mail->auth, 'ssl' => $config->smtp->report->mail->ssl, 'port' => $config->smtp->report->mail->port));
         //			$smtpSender = new Zend_Mail_Transport_Smtp(
         //						'smtp.163.com',array(
         //						'username'=>'yun_simon@163.com',
         //						'password'=>'19990402',
         //						'auth'=>'login'));
         Zend_Mail::setDefaultTransport($smtpSender);
         foreach ($idStrArray as $idAndState) {
             if ($idAndState == '') {
                 continue;
             }
             $idAndStateArray = explode('@', $idAndState);
             if ($idAndStateArray[1] == 'NEW') {
                 continue;
             }
             if ($idAndStateArray[1] == 'APPROVED') {
                 $urlreportModel = new UrlReport();
                 $row = $urlreportModel->fetchRow('id = ' . $idAndStateArray[0]);
                 if ($row->state != 'NEW') {
                     continue;
                 }
                 $row->state = $idAndStateArray[1];
                 if ($row->reward_point_transaction_record_id == null || $row->reward_point_transaction_record_id == '') {
                     $rewardModel = new RewardPointTransactionRecord();
                     $reward = $rewardModel->createRow();
                     $reward->consumer_id = $idAndStateArray[2];
                     $reward->date = date("Y-m-d H:i:s");
                     $reward->transaction_id = 8;
                     $reward->point_amount = 300;
                     $row->reward_point_transaction_record_id = $reward->save();
                 } else {
                     $rewardModel = new RewardPointTransactionRecord();
                     $reward = $rewardModel->fetchRow('id = ' . $row->reward_point_transaction_record_id);
                     if ($reward != null) {
                         $reward->date = date("Y-m-d H:i:s");
                         $reward->point_amount = 300;
                         $reward->save();
                     }
                 }
                 $row->save();
                 //2011-05-13 change the rank of consumer
                 $rankModel = new Rank();
                 $rankModel->changeConsumerRank($idAndStateArray[1]);
             }
             if ($idAndStateArray[1] == 'UNAPPROVED') {
                 $urlreportModel = new UrlReport();
                 $row = $urlreportModel->fetchRow('id = ' . $idAndStateArray[0]);
                 if ($row == null) {
                     continue;
                 }
                 if ($row->reward_point_transaction_record_id != null && $row->reward_point_transaction_record_id != '') {
                     $rewardModel = new RewardPointTransactionRecord();
                     $reward = $rewardModel->fetchRow('id = ' . $row->reward_point_transaction_record_id);
                     if ($reward != null) {
                         $db2 = $rewardModel->getAdapter();
                         $where = $db2->quoteInto('id = ?', $row->reward_point_transaction_record_id);
                         $rows_affected = $rewardModel->delete($where);
                     }
                 }
                 $db2 = $urlreportModel->getAdapter();
                 $where = $db2->quoteInto('id = ?', $idAndStateArray[0]);
                 $rows_affected = $urlreportModel->delete($where);
             }
             $consumerModel = new Consumer();
             $consumer = $consumerModel->fetchRow('id = ' . $idAndStateArray[2]);
             //send mail...
             if ($consumer->email == '') {
                 continue;
             }
             $mail = new Zend_Mail('utf-8');
             if ($consumer->language_pref != null && $consumer->language_pref == 'en') {
                 $emailSubject = $this->view->translate('Admin_Reply_WOM_URLReport_Subject_en');
                 $emailBody = $this->view->translate('Admin_Reply_WOM_URLReport_Body_en');
             } else {
                 $emailSubject = $this->view->translate('Admin_Reply_WOM_URLReport_Subject_zh');
                 $emailBody = $this->view->translate('Admin_Reply_WOM_URLReport_Body_zh');
             }
             $stringChange = array('?USERNAME?' => $consumer->name, '?YOURSTORY?' => $row->url, '?MYRESPONSE?' => $idAndStateArray[3]);
             $emailBody = strtr($emailBody, $stringChange);
             $langNamespace = new Zend_Session_Namespace('Lang');
             if ($langNamespace->lang == 'en' || $langNamespace->lang == 'EN') {
                 $mail->setSubject($emailSubject);
             } else {
                 $mail->setSubject("=?UTF-8?B?" . base64_encode($emailSubject) . "?=");
             }
             $mail->setBodyText($emailBody);
             $mail->addTo($consumer->email);
             $mail->setFrom($config->smtp->report->mail->username, $this->view->translate('Wildfire'));
             //				$mail->setFrom('yun_simon@163.com',$this->view->translate('Wildfire'));
             $mail->send();
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:wildfire_php,代码行数:101,代码来源:ReportController.php

示例3: ajaxsaveweiboreplyAction

 function ajaxsaveweiboreplyAction()
 {
     $this->_helper->layout->disableLayout();
     $topicId = urldecode($this->_request->getParam('topicId'));
     $annotations = array('wildfire_community', $topicId);
     $tokenNamespace = new Zend_Session_Namespace('token');
     $token = $tokenNamespace->token;
     if ($token) {
         include_once 'weiboconfig.php';
         $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $token['access_token']);
         $content = $this->_request->getParam('content');
         $result = $c->update($content, NULL, NULL, $annotations);
         if (isset($result['error_code'])) {
             print_r($result);
         } else {
             $mid = $result['idstr'];
             $userId = $this->_currentUser->id;
             $irrModel = new InboxReplyRecord();
             $row = $irrModel->createRow();
             $row->topic = $topicId;
             $row->consumer = $userId;
             $row->platform_type = "weibo";
             $row->sns_reply_id = $result['idstr'];
             $row->save();
             $replyCount = $irrModel->findReplyCount(array('consumer' => $userId, 'platform_type' => 'weibo', 'topic' => $topicId));
             if ($replyCount < 2) {
                 $rewardPointTransactionRecordModel = new RewardPointTransactionRecord();
                 $rewardPointTransaction = array("consumer_id" => $userId, "date" => date("Y-m-d H:i:s"), "transaction_id" => "11", "point_amount" => "10");
                 $id = $rewardPointTransactionRecordModel->insert($rewardPointTransaction);
                 $row->reward_point_transaction_record_id = $id;
                 $row->save();
                 $rankModel = new Rank();
                 $rankModel->changeConsumerRank($userId);
             }
             echo "ok";
         }
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:38,代码来源:TagController.php

示例4: postcampaignfinishedAction

 function postcampaignfinishedAction()
 {
     $this->view->activeTab = 'Campaign';
     $this->view->title = $this->view->title = $this->view->translate("Wildfire") . " - " . $this->view->translate("You_are_in");
     $id = (int) $this->_request->getParam('survey');
     $campaignModel = new Campaign();
     $this->view->campaign = $campaignModel->fetchRow("post_campaign_survey=" . $id . " or " . "post_campaign_survey_en=" . $id);
     $db = Zend_Registry::get('db');
     $campaignId = $this->view->campaign->id;
     $this->view->campaign_id = $campaignId;
     $consumer = $this->_currentUser;
     if ($campaignId > 0) {
         //change campaign_participation state
         $db = Zend_Registry::get('db');
         $select2 = $db->select();
         $select2->from('campaign_participation', '*')->join('campaign_invitation', 'campaign_invitation.id = campaign_participation.campaign_invitation_id', null)->where('campaign_invitation.consumer_id = ?', $consumer->id)->where('campaign_invitation.campaign_id = ?', $campaignId)->where("campaign_participation.state != 'COMPLETED'");
         $isExist = $db->fetchAll($select2);
         //	Zend_Debug::dump($isExist[0]['campaign_invitation_id']);
         if ($isExist != null) {
             $campaing_participateModel = new CampaignParticipation();
             $campaign_participation = $campaing_participateModel->fetchRow('campaign_invitation_id = ' . $isExist[0]['campaign_invitation_id']);
             $campaign_participation->state = 'COMPLETED';
             $campaign_participation->save();
             //add 200 points for member in reward_point_transaction_record
             $rewardPointTransactionRecordModel = new RewardPointTransactionRecord();
             $rewardPointTransaction = array("consumer_id" => $consumer->id, "date" => date("Y-m-d H:i:s"), "transaction_id" => "5", "point_amount" => "200");
             $id = $rewardPointTransactionRecordModel->insert($rewardPointTransaction);
             //2011-05-13 change the rank of consumer
             $rankModel = new Rank();
             $rankModel->changeConsumerRank($consumer->id);
         }
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:33,代码来源:CampaignController.php

示例5: ajaxaddrewardAction

 function ajaxaddrewardAction()
 {
     $this->_helper->layout->disableLayout();
     $uid = $this->_request->getParam('uid');
     $postData = $this->_request->getPost();
     if (is_numeric($postData['score'])) {
         $rewardPointTransactionRecordModel = new RewardPointTransactionRecord();
         $rewardPointTransactionRecordModel->insert(array('consumer_id' => $uid, 'transaction_id' => 7, 'point_amount' => $postData['score'], 'date' => date("Y-m-d H:i:s")));
         $rankModel = new Rank();
         $rankModel->changeConsumerRank($uid);
         $this->_helper->json("Success");
     } else {
         $this->_helper->json("Wrong");
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:15,代码来源:ConsumerController.php


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