本文整理匯總了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