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


PHP Viewer::getTrustScore方法代码示例

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


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

示例1: afterSave

 function afterSave($created)
 {
     if ($created) {
         //		$user_id                 = $this->Auth->user('id');
         $data = array();
         $vlog_id = $this->getInsertID();
         $datas = $this->data['VideoResponse'];
         if ($this->data['VideoLog']['user_id'] == 36) {
         } else {
             foreach ($datas as $key => $val) {
                 $data = $this->VideoResponse->set(array('video_log_id' => $vlog_id, 'video_feedback_id' => $key, 'video_feedback_option_id' => $val['video_feedback_option_id']));
                 $this->VideoResponse->saveAll($data);
             }
             $this->Video->incrementvideoview($this->data['VideoLog']['video_id']);
             $vid = $this->Video->findVideo($this->data['VideoLog']['video_id']);
             $num_views = $vid['Video']['video_views'];
             $max_views = $vid['Video']['max_view'];
             if ($num_views == $max_views || $num_views > $max_views) {
                 $this->Video->disableVideo($this->data['VideoLog']['video_id']);
             }
             App::import('Model', 'Viewer');
             $viewer = new Viewer();
             $trust = $viewer->getTrustScore($this->data['VideoLog']['user_id']);
             $credit = $this->Video->findCreditValue($this->data['VideoLog']['video_id']);
             $this->User->credituser($this->data['VideoLog']['user_id'], $credit, $trust);
             $currentbalance = $this->User->findCurrentBalance($this->data['VideoLog']['user_id']);
             App::import('Model', 'CreditLog');
             $creditLog = new CreditLog();
             $ext_id = $this->data['VideoLog']['video_id'];
             $rate = $trust / 16000;
             //checking trust percentage
             if ($rate == 1) {
                 // check if user has 100% trust
                 $creditLog->addCreditLog($this->data['VideoLog']['user_id'], $credit, $currentbalance, $ext_id);
                 //log entry of the Video View
             } else {
                 $credit_added = $credit * $rate;
                 //eels credited to the users account
                 $credit_left = $credit - $credit_added;
                 // credits left from the video view
                 $currentbalance_flipit = $this->User->findCurrentBalance(18);
                 //current balance ofthe flipit account
                 $creditLog->addCreditLog($this->data['VideoLog']['user_id'], $credit_added, $currentbalance, $ext_id);
                 // log entry of the percentage of credit deposited into user account
                 $creditLog->left_CreditLog(18, $credit_left, $currentbalance_flipit, $ext_id);
                 // Log entry of the remaining crdits from the video to flipit account
             }
         }
     }
 }
开发者ID:smtsampath,项目名称:CakePHP-Code-Samples-Project-Online-Video-Survey-System-,代码行数:50,代码来源:VideoLog.php


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