本文整理汇总了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