Commit 214dc0d1 authored by houdong's avatar houdong

Merge branch 'master' into 'houdong'

# Conflicts:
#   app/Lib/Action/Vip/PkTopAction.class.php
#   app/Tpl/Vip/PkTop/index.html
parents 7407fd8e 40358726
......@@ -88,25 +88,25 @@ class PkTopAction extends IdentityAction{
$msg = empty($msg2) ? $msg1 : array_merge($msg2, $msg1);
//pk通关榜,1挑战者胜利,2被挑战者胜利
// $allPassUsers = M('PktopData')->field('distinct active_id,active_name')->where(['pk_status' => 1])->order('add_time desc')->select();
$allPassUsers = M('PktopData')->field('distinct active_id,active_name')->where(['pk_status' => 1])->order('add_time desc')->select();
// $passUsers = $this->formatPassUsers($allPassUsers);
$passUsers = $this->formatPassUsers($allPassUsers);
//我的未结束的挑战
// $where = ['pk_end_time' => ['egt', date('Y-m-d')], '_complex' => ['active_id' => $userId, 'passive_id' => $userId, '_logic' => 'or']];
//
// $myPks = M('PktopData')->where($where)->order('add_time desc')->select();
// if (!empty($myPks)) {
// $myPk = $myPks[0];
// $myPk['pk_begin_time'] = date('m月d日', strtotime($myPk['pk_begin_time']));
// $myPk['pk_end_time'] = date('m月d日', strtotime($myPk['pk_end_time']));
// }
// $myPkUserId = [];
// foreach ($myPks as $k => $value) {
// //取我主动挑战的人
// if ($value['active_id'] == $userId) {
// $myPkUserId[] = $value['passive_id'];
// }
// }
$where = ['pk_end_time' => ['egt', date('Y-m-d')], '_complex' => ['active_id' => $userId, 'passive_id' => $userId, '_logic' => 'or']];
$myPks = M('PktopData')->where($where)->order('add_time desc')->select();
if (!empty($myPks)) {
$myPk = $myPks[0];
$myPk['pk_begin_time'] = date('m月d日', strtotime($myPk['pk_begin_time']));
$myPk['pk_end_time'] = date('m月d日', strtotime($myPk['pk_end_time']));
}
$myPkUserId = [];
foreach ($myPks as $k => $value) {
//取我主动挑战的人
if ($value['active_id'] == $userId) {
$myPkUserId[] = $value['passive_id'];
}
}
//最新挑战榜,每个月top10,不需要了
// $top10=$this->formatTop10();
......@@ -119,8 +119,7 @@ class PkTopAction extends IdentityAction{
$lastMonth = date('Y-m', strtotime(date('Y-m-01') . "-1 month"));
$lastMonthInt = intval(date('m', strtotime(date('Y-m-01') . "-1 month")));
// $mingrentang = $this->getMingrentangData($myPkUserId);//应该不用了
$mingrentang = $this->getMingrentangData($myPkUserId);
$rankNow = $this->rankNow('local');
//弹窗里面的pk时间段
......@@ -150,8 +149,9 @@ class PkTopAction extends IdentityAction{
//总决赛列表
$_GET['order'] = 'zongup';
// $finalList = $this->rankNow('local', $this->GID);
// $this->assign('finalList', $finalList['finalList']);
$finalList = $this->rankNow('local', $this->GID);
// var_dump(DB_USER);exit;
$this->assign('finalList', $finalList['finalList']);
//获奖名单,取前18名,暂不需要决赛名单
// $suffix = D('Userinfo')->getTable(FINALS_GROUP);
......@@ -672,40 +672,40 @@ class PkTopAction extends IdentityAction{
// }
//我的所有的挑战列表,包括我挑战别人的,和别人挑战我的
// public function myPkList(){
// $userId = I('userId', '',intval);
// if(!$userId){
// $userId = $this->user['userID'];
// }
//// $where['pk_end_time']=array('egt',date('Y-m-d'));
// $where['_complex'] = array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or');
// $myPkList=M('PktopData')->where($where)->order('pk_begin_time desc')->select();
// foreach ($myPkList as $k => &$v) {
// $v['pk_begin_time']=date('m月d日',strtotime($v['pk_begin_time']));
// $v['pk_end_time']=date('m月d日',strtotime($v['pk_end_time']));
//
// }
//
// $this->assign(array('myPkList'=>$myPkList));
// //进入交易需要的参数
// $groupInfo=M('Group')->field('group_id,web_id,category,name,startTime,endTime')->where(array('group_id'=>$this->GID))->find();
//
// $zhuangtai=$this->getGroupStatus($groupInfo);
// $groupInfo['userID']=$userId;
//
// $groupInfo['close_tips']='';
// $groupInfo['viewPage']=2;
// $groupInfo['zhuangtai'] = $zhuangtai;
// $groupInfo['title'] = '『全民炼股』争霸赛(2020赛季)';
// $groupInfo['desc'] = $groupInfo['shareContent']='红包周周有,万元大奖月月送,精英还可赢PK奖';
//
// $this->assign('groupInfo',json_encode($groupInfo));
// //我的挑战金
// $myInfo=M('PktopUser')->where(array('user_id'=>$userId))->find();
// $leftMoney=$myInfo['active_money']+$myInfo['passive_money']-$myInfo['already_withdraw_money'];
// $this->assign('leftMoney',$leftMoney);
// $this->display();
// }
public function myPkList(){
$userId = I('userId', '',intval);
if(!$userId){
$userId = $this->user['userID'];
}
// $where['pk_end_time']=array('egt',date('Y-m-d'));
$where['_complex'] = array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or');
$myPkList=M('PktopData')->where($where)->order('pk_begin_time desc')->select();
foreach ($myPkList as $k => &$v) {
$v['pk_begin_time']=date('m月d日',strtotime($v['pk_begin_time']));
$v['pk_end_time']=date('m月d日',strtotime($v['pk_end_time']));
}
$this->assign(array('myPkList'=>$myPkList));
//进入交易需要的参数
$groupInfo=M('Group')->field('group_id,web_id,category,name,startTime,endTime')->where(array('group_id'=>$this->GID))->find();
$zhuangtai=$this->getGroupStatus($groupInfo);
$groupInfo['userID']=$userId;
$groupInfo['close_tips']='';
$groupInfo['viewPage']=2;
$groupInfo['zhuangtai'] = $zhuangtai;
$groupInfo['title'] = '『全民炼股』争霸赛(2020赛季)';
$groupInfo['desc'] = $groupInfo['shareContent']='红包周周有,万元大奖月月送,精英还可赢PK奖';
$this->assign('groupInfo',json_encode($groupInfo));
//我的挑战金
$myInfo=M('PktopUser')->where(array('user_id'=>$userId))->find();
$leftMoney=$myInfo['active_money']+$myInfo['passive_money']-$myInfo['already_withdraw_money'];
$this->assign('leftMoney',$leftMoney);
$this->display();
}
//我的邀请列表
public function myInvite(){
......@@ -767,52 +767,52 @@ class PkTopAction extends IdentityAction{
}
//我的未结束的挑战
// private function getMyPkUserId($userId){
// $where=array('pk_end_time'=>array('egt',date('Y-m-d')),
// '_complex'=>array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or'));
//
// $myPks=M('PktopData')->where($where)->order('add_time desc')->select();
//
// $myPkUserId=array();
// foreach ($myPks as $k => $value) {
// //取我主动挑战的人
// if($value['active_id']==$userId){
// $myPkUserId[]=$value['passive_id'];
// }
// }
// return $myPkUserId;
// }
private function getMyPkUserId($userId){
$where=array('pk_end_time'=>array('egt',date('Y-m-d')),
'_complex'=>array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or'));
$myPks=M('PktopData')->where($where)->order('add_time desc')->select();
$myPkUserId=array();
foreach ($myPks as $k => $value) {
//取我主动挑战的人
if($value['active_id']==$userId){
$myPkUserId[]=$value['passive_id'];
}
}
return $myPkUserId;
}
//点首页名人堂的年度精英赛和月排行榜的下拉框月份请求后台
public function getMonthData(){
$type = I('type', '');
$month = I('month', '');
//年度精英赛,month字段有值,证明可以参加年度的精英赛
// if($type=='final'){
// $top10UserIds=array();
// //对应月份的前10名
// $monthUsers=M('PktopUserphb')->where(array('month'=>$month))->order('monthup desc')->select();
// foreach ($monthUsers as $k => &$v4) {
// $top10UserIds[]=$v4['user_id'];
// }
//
// $finalUsers=M('PktopUser')->where(array('month'=>$month,'active_money'=>array('gt',0)))->order('monthup desc')->select();
// foreach ($finalUsers as $k => &$v3) {
// $v3['isTop10']=in_array($v3['user_id'],$top10UserIds)?1:0;
// }
// $count=count($finalUsers);
// $this->assign('finalUsers',$finalUsers);
// $content = $this->fetch('itemPass');
// }
if($type=='final'){
$top10UserIds=array();
//对应月份的前10名
$monthUsers=M('PktopUserphb')->where(array('month'=>$month))->order('monthup desc')->select();
foreach ($monthUsers as $k => &$v4) {
$top10UserIds[]=$v4['user_id'];
}
$finalUsers=M('PktopUser')->where(array('month'=>$month,'active_money'=>array('gt',0)))->order('monthup desc')->select();
foreach ($finalUsers as $k => &$v3) {
$v3['isTop10']=in_array($v3['user_id'],$top10UserIds)?1:0;
}
$count=count($finalUsers);
$this->assign('finalUsers',$finalUsers);
$content = $this->fetch('itemPass');
}
if($type=='month'||$type=='all'){
$userId=$this->user['userID'];
//月排行榜的旧月份和上个月份的页面显示不一样,改成显示一样
$nowMonth=date('Y-m');
$monthUsers=M('PktopUserphb')->where(['month'=>$month])->order('monthup desc')->select();
// $myPkUserId=$this->getMyPkUserId($userId);
$myPkUserId=$this->getMyPkUserId($userId);
$monthIds=array();
foreach ($monthUsers as $k => &$v) {
// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
$v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
$monthIds[]=$v['user_id'];
}
......@@ -842,88 +842,88 @@ class PkTopAction extends IdentityAction{
}
//用户列表,包括最新挑战榜,人气挑战榜等页面
// public function userList(){
// $userId=$this->user['userID'];
// $type = I('type', 'new');
//
// $lastMonth=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
//
// if($type=='new'){
// $userList=$this->formatTop10();
// }
// if($type=='hot'){
// //所有月份的
// $passiveIds=M('PktopData')->group('passive_id')->order('count(*) desc')->getField('passive_id',true);
// $userList=M('PktopUserphb')->where(array('user_id'=>array('in',$passiveIds)))->order('field(user_id,'.implode(',',$passiveIds).')')->select();
// }
// if($type=='all'){
// $month = I('month',$lastMonth,intval);
// $userList=M('PktopUserphb')->where(array('month'=>$month))->order('monthup desc')->select();
// $selectMonth=array();
// foreach ($this->MONTH as $k => $value) {
// $nowMonth=date('Y-m',strtotime(date('Y-m-01')));
// if($k<$nowMonth){
// $selectMonth[$k]=$value;
// }
// }
//// $type='lastMonth';
// }
// $myPkUserId=$this->getMyPkUserId($userId);
// $userIds=array();
// foreach ($userList as $k => &$v) {
// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
// $userIds[]=$v['user_id'];
// }
// $enemyIds=$this->getEnemy($userIds);
// foreach ($userList as $k => &$v4) {
// $v4['enemyNum']=count($enemyIds[$v4['user_id']]);
// $v4['enemy']=$enemyIds[$v4['user_id']];
// $v4['user_name']=$v4['user_id'];
// }
//
//// var_dump($userList);exit;
// $pkTime=date('n月j日',strtotime('next Monday')).'-'.date('n月j日',strtotime('next Monday')+4*3600*24);
// $this->assign(array('type'=>$type,'userList'=>$userList,'selectMonth'=>$selectMonth,'lastMonth'=>$lastMonth
// ,'pkTime'=>$pkTime));
// $this->display();
// }
public function userList(){
$userId=$this->user['userID'];
$type = I('type', 'new');
$lastMonth=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
if($type=='new'){
$userList=$this->formatTop10();
}
if($type=='hot'){
//所有月份的
$passiveIds=M('PktopData')->group('passive_id')->order('count(*) desc')->getField('passive_id',true);
$userList=M('PktopUserphb')->where(array('user_id'=>array('in',$passiveIds)))->order('field(user_id,'.implode(',',$passiveIds).')')->select();
}
if($type=='all'){
$month = I('month',$lastMonth,intval);
$userList=M('PktopUserphb')->where(array('month'=>$month))->order('monthup desc')->select();
$selectMonth=array();
foreach ($this->MONTH as $k => $value) {
$nowMonth=date('Y-m',strtotime(date('Y-m-01')));
if($k<$nowMonth){
$selectMonth[$k]=$value;
}
}
// $type='lastMonth';
}
$myPkUserId=$this->getMyPkUserId($userId);
$userIds=array();
foreach ($userList as $k => &$v) {
$v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
$userIds[]=$v['user_id'];
}
$enemyIds=$this->getEnemy($userIds);
foreach ($userList as $k => &$v4) {
$v4['enemyNum']=count($enemyIds[$v4['user_id']]);
$v4['enemy']=$enemyIds[$v4['user_id']];
$v4['user_name']=$v4['user_id'];
}
// var_dump($userList);exit;
$pkTime=date('n月j日',strtotime('next Monday')).'-'.date('n月j日',strtotime('next Monday')+4*3600*24);
$this->assign(array('type'=>$type,'userList'=>$userList,'selectMonth'=>$selectMonth,'lastMonth'=>$lastMonth
,'pkTime'=>$pkTime));
$this->display();
}
//pk列表,选月份后也调用该方法
// public function pkList(){
// if(IS_GET){
// //显示当前月的挑战
//// $month=date('Y-m');
// $month=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
// $selectMonth=array();
// foreach ($this->MONTH as $k => $value) {
// $nowMonth=date('Y-m',strtotime(date('Y-m-01')));
// if($k<$nowMonth){
// $selectMonth[$k]=$value;
// }
// }
// }else{
// $month = I('month', '',intval);
// }
// $pkList=M('PktopData')->where(array('month'=>$month))->order('add_time desc')->select();
// foreach ($pkList as $k => &$v) {
// $v['pk_begin_time']=date('m月d日',strtotime($v['pk_begin_time']));
// $v['pk_end_time']=date('m月d日',strtotime($v['pk_end_time']));
//
// }
// $this->assign(array('pkList'=>$pkList,'selectMonth'=>$selectMonth,'lastMonth'=>$month));
// $this->assign(['type'=>'pkList']);
// if(IS_GET){
// $userId = $this->user['userID'];
// $this->setGoTrade($userId);
// $this->display();
// }else{
//
// $content = $this->fetch('item2');
// $this->ajaxReturn(array(
// 'status' => 1,'count'=>count($pkList),'data' => $content
// ));
// }
// }
public function pkList(){
if(IS_GET){
//显示当前月的挑战
// $month=date('Y-m');
$month=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
$selectMonth=array();
foreach ($this->MONTH as $k => $value) {
$nowMonth=date('Y-m',strtotime(date('Y-m-01')));
if($k<$nowMonth){
$selectMonth[$k]=$value;
}
}
}else{
$month = I('month', '',intval);
}
$pkList=M('PktopData')->where(array('month'=>$month))->order('add_time desc')->select();
foreach ($pkList as $k => &$v) {
$v['pk_begin_time']=date('m月d日',strtotime($v['pk_begin_time']));
$v['pk_end_time']=date('m月d日',strtotime($v['pk_end_time']));
}
$this->assign(array('pkList'=>$pkList,'selectMonth'=>$selectMonth,'lastMonth'=>$month));
$this->assign(['type'=>'pkList']);
if(IS_GET){
$userId = $this->user['userID'];
$this->setGoTrade($userId);
$this->display();
}else{
$content = $this->fetch('item2');
$this->ajaxReturn(array(
'status' => 1,'count'=>count($pkList),'data' => $content
));
}
}
public function login() {
$userId=I('user_id', '',intval);
......@@ -1032,16 +1032,16 @@ class PkTopAction extends IdentityAction{
}
}
// private function formatPassUsers($data,$num=3) {
// $result=array();
// $tmp=array();
// foreach($data as $k=>&$val) {
//// $val['userUrl'] = tradeDetailLink($this->GID,3,$val['active_id']);
// $tmp[$k/$num][]=$val;
// $result=$tmp;
// }
// return $result;
// }
private function formatPassUsers($data,$num=3) {
$result=array();
$tmp=array();
foreach($data as $k=>&$val) {
// $val['userUrl'] = tradeDetailLink($this->GID,3,$val['active_id']);
$tmp[$k/$num][]=$val;
$result=$tmp;
}
return $result;
}
//记录分享的日志
public function shareLog() {
......@@ -1217,6 +1217,8 @@ class PkTopAction extends IdentityAction{
}
public function dianjiLog(){
$gid=$this->GID;
$userId=$this->user['userID'];
......
......@@ -428,7 +428,7 @@
var time = 50;
var mytimer=setInterval(scrollUp,time);
</script>
<script type="text/javascript" src="__PUBLIC__/js/popad_mini_jiang.js{$Think.config.js_version}"></script>
<script type="text/javascript" src="__PUBLIC__/js/popad_mini_jiang.js{$Think.config.js_version}111"></script>
</html>
<!--userId:{$user.userID}-userName:{$user.userName}-->
\ No newline at end of file
......@@ -71,49 +71,49 @@
</notempty>
</in>
<!--<in name="type" value="pkList">-->
<!--<notempty name="pkList">-->
<!--<foreach name="pkList" key='key' item="vo">-->
<!--<div class="outer-cont">-->
<!--<div class='my-pk-cont <eq name="vo.pk_status" value="1">resWin</eq><eq name="vo.pk_status" value="2">resLose</eq> '>-->
<!--<div class="pk-cont-info">-->
<!--<div class="pk-info left">-->
<!--<span class="pk-user"><img src="{:getPortraitPath($vo['active_id'], 'small', true)}" alt=""></span>-->
<!--<p class="pk-user-name">{$vo.active_name}</p>-->
<!--<p class="pk-user-rate">周收益率-->
<!--<if condition="empty($vo['active_lastweekup']) or $vo['active_lastweekup'] egt 0">-->
<!--<span class="red">{$vo.active_lastweekup|default=0}%</span>-->
<!--<else/>-->
<!--<span class="green">{$vo.active_lastweekup|default=0}%</span>-->
<!--</if>-->
<!--</p>-->
<!--</div>-->
<!--<div class="pk-info right">-->
<!--<span class="pk-user" ><img src="{:getPortraitPath($vo['passive_id'], 'small', true)}" alt=""></span>-->
<!--<p class="pk-user-name">{$vo.passive_name}</p>-->
<!--<p class="pk-user-rate">周收益率-->
<!--<if condition="empty($vo['passive_lastweekup']) or $vo['passive_lastweekup'] egt 0">-->
<!--<span class="red">{$vo.passive_lastweekup|default=0}%</span>-->
<!--<else/>-->
<!--<span class="green">{$vo.passive_lastweekup|default=0}%</span>-->
<!--</if>-->
<!--</p>-->
<!--</div>-->
<!--</div>-->
<!--<div class="pk-img"></div>-->
<!--<eq name="vo.pk_status" value="1"><span class="win-flag"></span></eq>-->
<!--<eq name="vo.pk_status" value="2"><span class="lose-flag"></span></eq>-->
<!--</div>-->
<!--</div>-->
<!--</foreach>-->
<!--<else/>-->
<!--<div class="no-data">-->
<!--<img class="no-data-img" src="__PUBLIC__/Home/images/group/cc-nodata.png" alt="">-->
<!--<p class="no-data-msg" >当前没有挑战榜排行</p>-->
<!--</div>-->
<!--</notempty>-->
<!--</in>-->
<in name="type" value="pkList">
<notempty name="pkList">
<!--item2--3.html-->
<foreach name="pkList" key='key' item="vo">
<div class="outer-cont">
<div class='my-pk-cont <eq name="vo.pk_status" value="1">resWin</eq><eq name="vo.pk_status" value="2">resLose</eq> '>
<div class="pk-cont-info">
<div class="pk-info left">
<span class="pk-user"><img src="{:getPortraitPath($vo['active_id'], 'small', true)}" alt=""></span>
<p class="pk-user-name">{$vo.active_name}</p>
<p class="pk-user-rate">周收益率
<if condition="empty($vo['active_lastweekup']) or $vo['active_lastweekup'] egt 0">
<span class="red">{$vo.active_lastweekup|default=0}%</span>
<else/>
<span class="green">{$vo.active_lastweekup|default=0}%</span>
</if>
</p>
</div>
<div class="pk-info right">
<span class="pk-user" ><img src="{:getPortraitPath($vo['passive_id'], 'small', true)}" alt=""></span>
<p class="pk-user-name">{$vo.passive_name}</p>
<p class="pk-user-rate">周收益率
<if condition="empty($vo['passive_lastweekup']) or $vo['passive_lastweekup'] egt 0">
<span class="red">{$vo.passive_lastweekup|default=0}%</span>
<else/>
<span class="green">{$vo.passive_lastweekup|default=0}%</span>
</if>
</p>
</div>
</div>
<div class="pk-img"></div>
<eq name="vo.pk_status" value="1"><span class="win-flag"></span></eq>
<eq name="vo.pk_status" value="2"><span class="lose-flag"></span></eq>
</div>
</div>
</foreach>
<else/>
<div class="no-data">
<img class="no-data-img" src="__PUBLIC__/Home/images/group/cc-nodata.png" alt="">
<p class="no-data-msg" >当前没有挑战榜排行</p>
</div>
</notempty>
</in>
<script>
......
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