Commit cae3f32f by 冷斌

update

parent 18969c88
...@@ -522,7 +522,7 @@ ...@@ -522,7 +522,7 @@
$level=getLevelList(); $level=getLevelList();
foreach($level as $k=>$v){ foreach($level as $k=>$v){
if( $v['level_up']>=$experience){ if( $v['level_up']>$experience){
$levelid=$v['levelid']; $levelid=$v['levelid'];
break; break;
}else{ }else{
...@@ -556,7 +556,7 @@ ...@@ -556,7 +556,7 @@
$level=getLevelAnchorList(); $level=getLevelAnchorList();
foreach($level as $k=>$v){ foreach($level as $k=>$v){
if( $v['level_up']>=$experience){ if( $v['level_up']>$experience){
$levelid=$v['levelid']; $levelid=$v['levelid'];
break; break;
}else{ }else{
......
...@@ -6,90 +6,101 @@ namespace Appapi\Controller; ...@@ -6,90 +6,101 @@ namespace Appapi\Controller;
use Common\Controller\HomebaseController; use Common\Controller\HomebaseController;
class LevelController extends HomebaseController { class LevelController extends HomebaseController {
function index(){ function index(){
$uid=I("uid"); $uid=I("uid");
$token=I("token"); $token=I("token");
if(checkToken($uid,$token)==700){ if(checkToken($uid,$token)==700){
$this->assign("reason",'您的登陆状态失效,请重新登陆!'); $this->assign("reason",'您的登陆状态失效,请重新登陆!');
$this->display(':error'); $this->display(':error');
exit; exit;
} }
$User=M("users"); $User=M("users");
$userinfo=$User->field("avatar,consumption,votestotal")->where("id={$uid}")->find(); $userinfo=$User->field("avatar,consumption,votestotal")->where("id={$uid}")->find();
$userinfo['avatar']=get_upload_path($userinfo['avatar']); $userinfo['avatar']=get_upload_path($userinfo['avatar']);
$this->assign("userinfo",$userinfo); $this->assign("userinfo",$userinfo);
/* 用户等级 */ /* 用户等级 */
$Level=M("experlevel"); $Level=M("experlevel");
$levelinfo=$Level->where("level_up>'{$userinfo['consumption']}'")->order("levelid asc")->find();
$levelinfo=$Level->where("level_up>='{$userinfo['consumption']}'")->order("levelid asc")->find(); if(!$levelinfo){
if(!$levelinfo){ $levelinfo=$Level->order("levelid desc")->find();
$levelinfo=$Level->order("levelid desc")->find(); }
} $cha=$levelinfo['level_up']-$userinfo['consumption'];
$cha=$levelinfo['level_up']+1-$userinfo['consumption']; if($cha>0)
if($cha>0) {
{ $levelinfo['levelid'] = $levelinfo['levelid'] > 1 ? ($levelinfo['levelid']-1) : $levelinfo['levelid'];
$baifen=floor($userinfo['consumption']/$levelinfo['level_up']*100); $baifen=floor($userinfo['consumption']/$levelinfo['level_up']*100);
$type="1"; $type="1";
}else{ }else{
$baifen=100; $baifen=100;
$type="0"; $type="0";
} }
$set=M("experlevel_set")->where('id=1')->find(); $set=M("experlevel_set")->where('id=1')->find();
$this->assign("baifen",$baifen); $this->assign("baifen",$baifen);
$this->assign("levelinfo",$levelinfo); $this->assign("levelinfo",$levelinfo);
$this->assign("cha",$cha); $this->assign("cha",$cha);
$this->assign("type",$type); $this->assign("type",$type);
$this->assign('set', $set); $this->assign('set', $set);
/* 主播等价 */ $anchor_certification = 0;
$Level_a=M("experlevel_anchor"); $auth=M("users_auth")->where("uid={$uid}")->find();
if (!empty($auth)) {
$levelinfo_a=$Level_a->where("level_up>='{$userinfo['votestotal']}'")->order("levelid asc")->find(); if ($auth['status']==1) {
if(!$levelinfo_a){ $anchor_certification = 1;
$levelinfo_a=$Level_a->order("levelid desc")->find(); }
} }
$cha_a=$levelinfo_a['level_up']+1-$userinfo['votestotal'];
if($cha_a>0) $this->assign('anchor_certification', $anchor_certification);
{
$baifen_a=floor($userinfo['votestotal']/$levelinfo_a['level_up']*100); /* 主播等价 */
$type_a="1"; $Level_a=M("experlevel_anchor");
}else{
$baifen_a=100; $levelinfo_a=$Level_a->where("level_up>='{$userinfo['votestotal']}'")->order("levelid asc")->find();
$type_a="0"; if(!$levelinfo_a){
} $Level_a['levelid'] = $Level_a['levelid'] > 1 ? ($Level_a['levelid']-1) : $Level_a['levelid'];
$levelinfo_a=$Level_a->order("levelid desc")->find();
$this->assign("cha_a",$cha_a); }
$this->assign("type_a",$type_a); $cha_a=$levelinfo_a['level_up']-$userinfo['votestotal'];
$this->assign("baifen_a",$baifen_a); if($cha_a>0)
$this->assign("levelinfo_a",$levelinfo_a); {
$baifen_a=floor($userinfo['votestotal']/$levelinfo_a['level_up']*100);
$this->display(); $type_a="1";
}else{
} $baifen_a=100;
$type_a="0";
function level(){ }
$list=M("experlevel")->order("levelid asc")->select();
foreach($list as $k=>$v){ $this->assign("cha_a",$cha_a);
$list[$k]['level_up']=number_format($v['level_up']); $this->assign("type_a",$type_a);
$list[$k]['thumb']=get_upload_path($v['thumb']); $this->assign("baifen_a",$baifen_a);
} $this->assign("levelinfo_a",$levelinfo_a);
$this->assign("list",$list);
$this->display(); $this->display();
}
}
function level_a(){
$list=M("experlevel_anchor")->order("levelid asc")->select(); function level(){
foreach($list as $k=>$v){ $list=M("experlevel")->order("levelid asc")->select();
$list[$k]['level_up']=number_format($v['level_up']); foreach($list as $k=>$v){
$list[$k]['thumb']=get_upload_path($v['thumb']); $list[$k]['level_up']=number_format($v['level_up']);
} $list[$k]['thumb']=get_upload_path($v['thumb']);
$this->assign("list",$list); }
$this->display(); $this->assign("list",$list);
} $this->display();
}
function level_a(){
$list=M("experlevel_anchor")->order("levelid asc")->select();
foreach($list as $k=>$v){
$list[$k]['level_up']=number_format($v['level_up']);
$list[$k]['thumb']=get_upload_path($v['thumb']);
}
$this->assign("list",$list);
$this->display();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment