apps/medal/action/behavior.php
} else { //自动发放
$attention = $notice = $nowhave = '';
if (in_array($medalInfo['associate'], array('continue_login', 'continue_post', 'continue_thread_post'))) {
//获取用户行为信息
$behaviorService = L::loadClass('behaviorService', 'user'); /* @var $medalService PW_MedalService */
$behavior = $behaviorService->getBehaviorStatistic($winduid, $medalInfo['associate']);
$num = ($behavior) ? $behavior['num'] : 0;
$needNum = $medalInfo['confine'] - $num;
if ($medalInfo['associate'] == 'continue_login') {
$attention = '
注意:1天不登录,现有天数会减1
';$notice = ($needNum > 0) ? '你还需连续登录'.$needNum.'天' : '重新登录一次即可获得此勋章';
$notice = $notice . '(现有天数:'.$num.')';
$nowhave = '(现有连续登录天数:'.$num.')';
} elseif ($medalInfo['associate'] == 'continue_thread_post') {
$attention = '
注意:1天不登录,现有连续登录天数会减1
';$notice = ($needNum > 0) ? '你还需连续发主题'.$needNum.'天' : '再发1主题帖即可获得此勋章';
$notice = $notice . '(现有天数:'.$num.')';
$nowhave = '(现有连续主题天数:'.$num.')';
} elseif ($medalInfo['associate'] == 'continue_post') {
$attention = '
注意:1天不发帖,现有天数会减1
';$notice = ($needNum > 0) ? '你还需连续发帖'.$needNum.'天' : '再发1帖即可获得此勋章';
$notice = $notice . '(现有天数:'.$num.')';
$nowhave = '(现有连续发帖天数:'.$num.')';
}
} else {
lib/medal/medalservice.class.php
/**
* 获取自动勋章可以设置的相关类型
* @return array
*/
function getAutoMedalType() {
return array(
'continue_login'=>'连续登录天数',
'continue_post'=>'连续发贴天数',
'continue_thread_post'=>'连续发主题天数',
'post'=>'发帖数',
//'thread_post'=>'主题数',
'shafa'=>'抢沙发数',
'fans'=>'粉丝数',
);
}
lib/user/behaviorservice.class.php
/**
* 获取所有的类型
* @return array
*/
function getBehaviorTypes() {
return array(
1=>'continue_login',//'连续登