Commit 2eb5987a authored by houdong's avatar houdong

shangxian11111

parents 0457f203 7bc341a1
...@@ -2536,7 +2536,7 @@ input.money:-ms-input-placeholder { /* Internet Explorer 10+ */ ...@@ -2536,7 +2536,7 @@ input.money:-ms-input-placeholder { /* Internet Explorer 10+ */
position: relative; position: relative;
} }
.member-des-item .item-b1{ .member-des-item .item-b1{
font-size: 15px; font-size: 16px;
} }
.member-des-item .item-b1 .out{ .member-des-item .item-b1 .out{
color: #2876dd;padding: 0px 4px; color: #2876dd;padding: 0px 4px;
...@@ -2585,6 +2585,26 @@ input.money:-ms-input-placeholder { /* Internet Explorer 10+ */ ...@@ -2585,6 +2585,26 @@ input.money:-ms-input-placeholder { /* Internet Explorer 10+ */
#popPkTopSucc .pop-main img{ #popPkTopSucc .pop-main img{
display: block; display: block;
} }
.item-filter{
font-size: 12px;
border-radius: 20px;
background-color: #F7F8FA;
color: #333333;
padding: 5px;
width: 178px;
line-height: 23px;display: flex;
}
.item-filter span{
width: 84px;text-align: center;
}
.item-filter span.active{
background-color: #FF2336;
color: #fff;
border-radius: 20px;
}
.item-filter span.active a,.item-filter span.active a:visited,.item-filter span.active a:focus{
color: #ffffff;
}
......
<?php <?php
/** /**
* 炼股赛控制器 * 炼股赛控制器
*/ */
class PkTopAction extends IdentityAction{ class PkTopAction extends IdentityAction
{
public $GID = PRIZE_GROUP_2021; public $GID = PRIZE_GROUP_2021;
//测试时有2020-02
// public $MONTH =array('2022-05'=>'5月','2022-04'=>'4月','2022-03'=>'3月','2022-02'=>'2月','2022-01'=>'1月',
// '2021-12'=>'12月','2021-11'=>'11月','2021-10'=>'10月','2021-09'=>'9月','2021-08'=>'8月','2021-07'=>'7月',
// '2021-06'=>'6月','2021-05'=>'5月','2021-04'=>'4月','2021-03'=>'3月');
public $MONTH =array('2023-04'=>'2023-04','2023-03'=>'2023-03','2023-02'=>'2023-02','2023-01'=>'2023-01',
'2022-12'=>'2022-12','2022-11'=>'2022-11','2022-10'=>'2022-10','2022-09'=>'2022-09');
public $STATUS_TXT =array('1'=>'未开赛','2'=>'进行中','3'=>'已结束'); public $MONTH = array('2023-04' => '2023-04', '2023-03' => '2023-03', '2023-02' => '2023-02', '2023-01' => '2023-01', '2022-12' => '2022-12', '2022-11' => '2022-11', '2022-10' => '2022-10', '2022-09' => '2022-09');
public $STATUS_TXT = array('1' => '未开赛', '2' => '进行中', '3' => '已结束');
public function _initialize() { public function _initialize()
{
parent::_initialize(); parent::_initialize();
$userId = $this->user['userID']; $userId = $this->user['userID'];
$ids = D('Group')->getGroupCache($userId); $ids = D('Group')->getGroupCache($userId);
...@@ -21,16 +20,14 @@ class PkTopAction extends IdentityAction{ ...@@ -21,16 +20,14 @@ class PkTopAction extends IdentityAction{
$this->assign('joinStatus', 1); $this->assign('joinStatus', 1);
} }
//设置进入交易的参数 //设置进入交易的参数
if(in_array(ACTION_NAME,['index','choujiang','phbWeek','phbOther','phbTrade'])){ if (in_array(ACTION_NAME, ['index', 'choujiang', 'phbWeek', 'phbOther', 'phbTrade'])) {
$groupId =$this->GID; $groupId = $this->GID;
$groupInfo = M('Group')->field('group_id,web_id,category,name,startTime,endTime,member_quantity') $groupInfo = M('Group')->field('group_id,web_id,category,name,startTime,endTime,member_quantity')->where(['group_id' => $groupId])->find();
->where(['group_id' => $groupId])->find();
$groupStatus = $this->getGroupStatus($groupInfo); $groupStatus = $this->getGroupStatus($groupInfo);
$share = ['groupId' => $groupId, 'groupStatus' => $groupStatus, 'viewPage' => 2, 'statusInt' => $groupStatus, $share = ['groupId' => $groupId, 'groupStatus' => $groupStatus, 'viewPage' => 2, 'statusInt' => $groupStatus, 'close_tips' => '', 'zhuangtai' => $this->STATUS_TXT[$groupStatus]];
'close_tips' => '','zhuangtai' => $this->STATUS_TXT[$groupStatus]]; $share['userID'] = $userId ? $userId : '';
$share['userID']=$userId?$userId:'';
$groupInfo = array_merge($groupInfo, $share); $groupInfo = array_merge($groupInfo, $share);
$this->assign('groupInfo', json_encode($groupInfo)); $this->assign('groupInfo', json_encode($groupInfo));
...@@ -43,502 +40,195 @@ class PkTopAction extends IdentityAction{ ...@@ -43,502 +40,195 @@ class PkTopAction extends IdentityAction{
$this->assign('weixin', $weixin); $this->assign('weixin', $weixin);
$this->assign('weixinUrl', 'https://eturl.cn/Rhq2wA?is_head=1'); $this->assign('weixinUrl', 'https://eturl.cn/Rhq2wA?is_head=1');
//重置卡个数 //重置卡个数
if($userId){ if ($userId) {
$leftNum=M('MagicboxCard')->where(['user_id'=>$userId,'card_type'=>2,'use_time'=>0])->count(); $leftNum = M('MagicboxCard')->where(['user_id' => $userId, 'card_type' => 2, 'use_time' => 0])->count();
}else{ } else {
$leftNum=0; $leftNum = 0;
} }
$this->assign('resetLeftNum',$leftNum); $this->assign('resetLeftNum', $leftNum);
} }
} }
//首页
// public function indexOld() {
// //首页的排行榜等切换
// if(!I('viewPage')){
// header('location:'.M_URL.'/Match/jiang');
// exit;
//
// }
//
// $userIdParam = I('user_id', '', intval);
// $isapp = I('isapp');
// if ($isapp) {
// $userId = substr($isapp, strpos($isapp, '=') + 1);
// if ($userId) {
// $userIdParam = $userId;
// }
// }
// $key = I('key', '');
// $key2 = I('key2', '');
//
// if ($userIdParam == '') {
// if ($this->user['userID'] == '') {
// //有了第二次请求,不再请求第三次
// if ($key2 == '') {
// $this->assign('refresh', 1);
// $this->assign('viewPage', I('viewPage', '1'));
// }
// } else {
// $userId = $this->user['userID'];
// }
// } else {
// //第二次请求
// if (md5($userIdParam . 'abcd4321') == $key2 || md5('user_id=' . $userIdParam .'abcd4321') == $key) {
// $userId = $userIdParam;
// }
// }
////echo $userId;exit;
// //app从过来可能没有userName
// if ($userId && $this->user['userName'] == '') {
// $this->setUcLogin($userId);
// }
//
//
//// $gid = I('gid', 0, intval);
//// $gid = $gid ? $gid : $this->GID;
//
// $gid = $this->GID;
// $groupId = I('groupId', $gid);
//
//
//// var_dump($groupId);exit;
//
// $groupInfo = M('Group')->field('group_id,web_id,category,name,startTime,endTime,member_quantity')->where(['group_id' => $groupId])->find();
// $groupStatus = $this->getGroupStatus($groupInfo);
// $member_quantity = $groupInfo['member_quantity'];
// //用到
// $ids = D('Group')->getGroupCache($userId);
// if (in_array($groupId, $ids)) {
// $this->assign('joinStatus', 1);
// }
//
// //滚动消息,1pk付款,2发起pk,3pk胜利,4pk失败,5胜利退钱,6失败钱归passive,7买重置卡
// $msg1 = M('PktopNews')->where(['type' => ['in', '2']])->order('add_time desc')->limit(5)->select();
// $msg2 = M('PktopNews')->where(['type' => ['in', '3']])->order('add_time desc')->limit(5)->select();
// $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();
//
// $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'];
// }
// }
//
// //最新挑战榜,每个月top10,不需要了
//// $top10=$this->formatTop10();
//// foreach ($top10 as $k => &$v) {
//// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
//// }
// //我的所有的挑战数,不需要了
//// $myAllPkCount=M('PktopData')->where(array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or'))->count();
//
// $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);
// $rankNow = $this->rankNow('local');
//
// //弹窗里面的pk时间段
// $pkTime = date('n月j日', strtotime('next Monday')) . '-' . date('n月j日', strtotime('next Monday') + 4 * 3600 * 24);
//
// $gonggao = $this->getGonggao();
//
// //获奖心得
// $where = ['think' => ['exp', 'is not null and think != ""']];
// $thinks = M('PktopUserphb')->where($where)->order('month desc')->limit(10)->select();
//
// //刷新页面后获取弹出的消息
// //没有pk,不需要弹窗了
//// $popData = $this->getPopData($userId);
// $popData=null;
// //第一个页面显示的数据,公告,心得等
// $firstPageData = ['popType' => $popData['popType'], 'popPkUserName' => $popData['popPkUserName'], 'thinks' => $thinks, 'gonggao' => $gonggao];
//
// $return = ['msg' => $msg, 'myPk' => $myPk, 'myPkCount' => count($myPks), 'passUsers' => $passUsers,
// 'passUserCount' => count($allPassUsers) + 5, 'top10' => $top10, 'pkTime' => $pkTime,
// 'lastMonthInt' => $lastMonthInt, 'myAllPkCount' => $myAllPkCount];
//
// $this->assign($firstPageData);
// $this->assign($mingrentang);
// $this->assign($rankNow);
// $this->assign($return);
//
// //总决赛列表
// $_GET['order'] = 'zongup';
// $finalList = $this->rankNow('local', $this->GID);
//// var_dump(DB_USER);exit;
// $this->assign('finalList', $finalList['finalList']);
//
//// $share=array('groupId'=>$groupId,'groupStatus'=>$groupStatus,'viewPage'=>2,
//// 'close_tips'=>'','userID'=>'XXXXXX','zhuangtai'=>$this->STATUS_TXT[$groupStatus]);
// $share = array('groupId' => $groupId, 'groupStatus' => $groupStatus, 'viewPage' => 2, 'statusInt' => $groupStatus,
// 'close_tips' => '', 'userID' => $userId, 'zhuangtai' => $this->STATUS_TXT[$groupStatus]);
//
// $groupInfo = array_merge($groupInfo, $share);
//
// $this->assign('groupInfo', json_encode($groupInfo));
//
// $this->setShare($userId, I('cfrom'));
//
// //朋友圈,微信群,好友分享,分享后自己的id,作为邀请人的id,pc扫码后没有from参数
// $inviterId = I('inviterId', '');
// if (in_array(I('from'), array('timeline', 'groupmessage', 'singlemessage'))) {
// if ($inviterId == '') {
// $inviterId = I('user_id', '', intval);
// if ($inviterId == '') {
// $isapp = I('isapp', '');
// $inviterId = substr($isapp, strpos($isapp, '=') + 1);
// }
// }
// }
// $this->assign('inviterId', $inviterId);
//
// //记录页面访问来源,cfrom可能是cofoolwx
//// if(I('cfrom')){
//// $referer=I('cfrom');
//// }else{
//// $referer=$_SERVER['HTTP_REFERER']?$_SERVER['HTTP_REFERER']:I('from','');
//// }
// if (I('cfrom')) {
// $referer = I('cfrom');
// } elseif (I('hFrom')) {
// $referer = I('hFrom');
// } elseif (I('from')) {
// $referer = I('from');
// } else {
// $referer = $_SERVER['HTTP_REFERER'];
// }
// //获奖人员
// $luckydogs = M('PktopLuckydog')->where($where)->order('add_time desc')->limit(10)->select();
// $this->assign('luckydogs', $luckydogs);
// //这个月剩余的抽奖机会
// $leftCjNum = A('Public')->getLeftCjNum();
// $this->assign('leftCjNum', $leftCjNum);
// //大赛状态
// $gInfo['gStatus'] = is_end($groupInfo['endTime']) ? '3' : ($groupInfo['startTime'] > time() ? '1' : '2');
// $this->assign('gInfo', $gInfo);
//
// $this->assign('referer', $referer);
// $this->assign('member_quantity', $member_quantity);
// $this->assign('p', 1);
// //取微信
// $weixin = M('GroupInfo')->where(['group_id' => $groupId])->getField('wechat');
// $this->assign('weixin', $weixin);
// $this->assign('weixinUrl', 'https://eturl.cn/Rhq2wA?is_head=1');
//
//
// $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
// $hideShiPan=0;
//// $tj=strpos($ua, 'oppo')||strpos($ua, 'huawei_jt')||strpos($ua, 'xiaomi');
// $tj=strpos($ua, 'vivo');
// if($tj){
// $hideShiPan=1;
// }
// if(I('channel')=='tencent_new_simplify'&&I('version')<'A3.7.9R'){
// $hideShiPan=1;
// }
// $this->assign('hideShiPan',$hideShiPan);
//
// //更多大赛
// $gList=D('Niu')->getMoreDs($userId);
// $this->assign('gList',$gList);
// $this->assign('gid',$gid);
// $this->display();
// }
//加入炼股赛
private function getGroupStatus($groupInfo)
{
if (is_end($groupInfo['endTime']) == true) {
$groupStatus = 3;
// $zhuangtai='已结束';
} elseif ($groupInfo['startTime'] > time()) {
$groupStatus = 1;
// $zhuangtai='未开赛';
} else {
$groupStatus = 2;
// $zhuangtai='进行中';
}
return $groupStatus;
}
//大赛排行榜的当前排行页面 //检查是否参加了大赛
// public function rankNow($caller='',$gid=0){
// $gid=$gid?$gid:$this->GID; public function setShare($userId, $cfrom = 0)
// $order=I('order','lastmonthup'); {
// $p=I('p', 1); //app内的分享,参数名不能改
//// $pageSize=10; // $shareTitle='您的好友邀请您参加「全民炼股」争霸赛';
// $pageSize=$gid==$this->GID?10:200; // $shareDesc='红包周周有,万元大奖月月送';
// //分表归档
// $suffix = D('Userinfo')->getTable($gid); $shareTitle = '您的好友邀请您参加全民炼股争霸赛-全民分赛场';
// $table =$suffix?'mncg_archive.userinfo'.$suffix:'mncg.userinfo'; $shareDesc = '每周评奖,正盈利即可瓜分奖金!!!';
// $where=array('sex'=>$gid,'new_phb'=>array('gt',0),'zt'=>1);
// //测试时不用缓存->cache(true,cacheTime()) $shareUrl = M_URL . "/PkTop?inviterId=" . $userId . '&cfrom=' . $cfrom;
// $userNowList = M($table, " ", C('DB_CONFIG_MNCG3'))->where($where)->order($order.' desc')->page($p.','.$pageSize)->select(); $appShareInfo['shareTitle'] = $shareTitle;
//// var_dump($gid);exit; $appShareInfo['shareContent'] = $shareDesc;
// $userids = array(); $appShareInfo['shareUrl'] = $shareUrl;
// $usertranids = []; // $this->assign('appShareTitle',$shareTitle);
// foreach ($userNowList as $key => &$rankV) { // $this->assign('appShareContent',$shareDesc);
// $userIDs = explode("X", $rankV['uid']); // $this->assign('appShareUrl',$shareUrl);
// $rankV['user_id'] = $userIDs[1]; $this->assign('appShareInfo', json_encode($appShareInfo));
//// $rankV['userUrl'] = tradeDetailLink($this->GID,3,$userIDs[1]); // $this->assign('h5ShareTitle',$shareTitle);
// $userids[] = $userIDs[1]; // $this->assign('h5ShareDesc',$shareDesc);
// $usertranids[] = $rankV['uid']; // $this->assign('h5ShareUrl',$shareUrl);
// } //定义在微信分享的显示
// $signPackage = D('Share')->getSignPackage();
// $nick_name_arry =getUser($userids,'nick');//// $this->assign('signPackage', $signPackage);
// $robot_user = [];
// if(!empty($usertranids)){ $appParam['url'] = $shareUrl;
// $robot_user = D('Robot')->groupRobotTranUserList($usertranids); $appParam['name'] = $shareTitle;
// } $appParam['introduction'] = $shareDesc;
// foreach ($userNowList as $key => &$value) { $this->assign('appParam', json_encode($appParam));
// $nick_name = $nick_name_arry[$value['user_id']];
// //$value['user_name'] = $nick_name?$nick_name:$value['username'];
// $value['user_name'] = $nick_name; //定义在微信分享的显示
// $signPackage = D('Share')->getSignPackage();
// $robot_flag_show = D('Robot')->robot_flag_show($value['user_id']); $this->assign('signPackage', json_encode($signPackage));
// $value['robot_user'] = in_array($value['user_id'],$robot_user) && $robot_flag_show == 1 ? 1 : 0;
// $value['robot_url'] = in_array($value['user_id'],$robot_user) && $robot_flag_show == 1 ? M_URL.'/Robot' : ''; return $appShareInfo;
// }
// }
// //总数目
// $totalCount = M($table, " ", C('DB_CONFIG_MNCG3'))->where($where)->count(); //月赛前10名用户的挑战情况
// if($caller=='local'){ // private function formatTop10(){
// if($gid==$this->GID){ // $month=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
// $return['userList']=$userNowList; // $top10=M('PktopUserphb')->where(array('month'=>$month))->order('month desc,monthup desc')->limit(10)->select();
// $return['order']=$order; // $top10UserIds=array();
// $return['totalCount']=$totalCount; // foreach ($top10 as $k => $v) {
// $return['pages']=ceil($totalCount/$pageSize); // $top10UserIds[]=$v['user_id'];
// }else{
// $return['finalList']=$userNowList;
// $return['order']=$order;
//// $return['totalCount']=$totalCount;
//// $return['pages']=$totalCount/10;
// } // }
// //
// return $return; // $enemyIds=$this->getEnemy($top10UserIds);
// }else{ // foreach ($top10 as $k => &$v) {
// $this->assign(array('order'=>$order,'userList'=>$userNowList,'p'=>$p)); // $v['enemyNum']=count($enemyIds[$v['user_id']]);
// if($gid==$this->GID){ //// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
// $content = $this->fetch('itemNow'); // //敌人头像列表
// }else{ // $v['enemy']=$enemyIds[$v['user_id']];
// $content = $this->fetch('finalList');
// } // }
// $content = $this->fetch('itemNow'); //// var_dump($top10);exit;
// $this->ajaxReturn(array( // return $top10;
// 'status' => 1,'count' =>$totalCount,'data' => $content ));
// } // }
// }
// public function getEnemy($passiveIds) {
// public function getMingrentangData($myPkUserId){ // //取被挑战者的挑战人员array('pk_end_time'=>array('egt',date('Y-m-d')),'passive_id'=>array('in',$passiveIds))
// $lastMonth=date('Y-m',strtotime(date('Y-m-01') . "-1 month")); // $enemy=M('PktopData')->where(array('passive_id'=>array('in',$passiveIds)))->select();
// //名人堂的月份下拉框 // $enemyIds=array();
// $selectMonth1=$selectMonth2=array(); // foreach ($enemy as $k => $v) {
// foreach ($this->MONTH as $k => $value) { // $enemyIds[$v['passive_id']][]=$v['active_id'];
// $nowMonth=date('Y-m',strtotime(date('Y-m-01')));
//
//// if($k<$nowMonth){
// $selectMonth1[$k]=$selectMonth2[$k]=$value;
//// }
//
// //月排行榜显示当前的月份
//// if($k==$nowMonth){
//// $selectMonth2[$k]=$value;
//// }
// }
// $mingrentang=array('selectMonth1'=>$selectMonth1,'selectMonth2'=>$selectMonth2,
// 'selectMonthStart1'=>current($selectMonth1),'selectMonthStart2'=>current($selectMonth2));
//
// $nowTop10UserIds=array();
// //名人堂的月排行榜,默认显示当前月的前10名
// $monthUsers=M('PktopUserphb')->where(array('month'=>date('Y-m')))->order('monthup desc')->select();
// foreach ($monthUsers as $k => &$v4) {
// $v4['pkStatus']=in_array($v4['user_id'],$myPkUserId)?1:0;
// $nowTop10UserIds[]=$v4['user_id'];
// }
// $enemyIds=$this->getEnemy($nowTop10UserIds);
//
// $zongupData=$this->getZongup();
// foreach ($monthUsers as $k => &$v4) {
// $v4['enemyNum']=count($enemyIds[$v4['user_id']]);
// $v4['enemy']=$enemyIds[$v4['user_id']];
// $v4['zongup']=$zongupData[$v4['user_id']];
// } // }
// // return $enemyIds;
// //名人堂数据的决赛名单,只包括pk胜利者,现在用不到
//// $finalUsers=M('PktopUser')->where(array('month'=>$lastMonth,'active_money'=>array('gt',0)))->order('monthup desc')->select();
//// $mingrentang['finalUsers']=$finalUsers;
//
// $mingrentang['userList']=$monthUsers;
// $mingrentang['type']='nowMonth';
// return $mingrentang;
// } // }
//加入炼股赛 public function join()
public function join(){ {
// $code_type = 35; // $code_type = 35;
$code_type = 32; $code_type = 32;
$mfrom = I('mfrom',0); $mfrom = I('mfrom', 0);
//报名大赛 //报名大赛
$mobile = I('mobile', ''); $mobile = I('mobile', '');
$smsCode = I('smsCode', ''); $smsCode = I('smsCode', '');
$referer = I('referer', ''); $referer = I('referer', '');
$inviterId = I('inviterId', '',intval); $inviterId = I('inviterId', '', intval);
$targetUrl = I('targetUrl', ''); $targetUrl = I('targetUrl', '');
//app外打开 //app外打开
if($mobile){ if ($mobile) {
if(!$smsCode) { if (!$smsCode) {
$this->ajaxReturn(['status' => 0, 'info' => '请输入手机验证码!']); $this->ajaxReturn(['status' => 0, 'info' => '请输入手机验证码!']);
} }
$param = ['mobile'=>$mobile,'code'=>$smsCode,'type'=>$code_type]; $param = ['mobile' => $mobile, 'code' => $smsCode, 'type' => $code_type];
if(!D('Sms')->checkCode($param)){ if (!D('Sms')->checkCode($param)) {
$this->ajaxReturn(['status' => 0, 'info' => '对不起!手机验证码错误或已过期!']); $this->ajaxReturn(['status' => 0, 'info' => '对不起!手机验证码错误或已过期!']);
} }
$ucUser = uc_get_user(['token' => $mobile]); $ucUser = uc_get_user(['token' => $mobile]);
//没有该用户,开始注册,status0有该用户,111表示用户不存在 //没有该用户,开始注册,status0有该用户,111表示用户不存在
if($ucUser['status']==111){ if ($ucUser['status'] == 111) {
$ucData=$this->reg2020($mobile,$inviterId); $ucData = $this->reg2020($mobile, $inviterId);
}else{ } else {
$ucData=$ucUser['data']; $ucData = $ucUser['data'];
} }
}else{ } else {
$groupInfo=M('Group')->field('group_id,web_id,category,name,startTime,endTime')->where(array('group_id'=>$this->GID))->find(); $groupInfo = M('Group')->field('group_id,web_id,category,name,startTime,endTime')->where(array('group_id' => $this->GID))->find();
$groupStatus=$this->getGroupStatus($groupInfo); $groupStatus = $this->getGroupStatus($groupInfo);
if ($groupStatus==3) { if ($groupStatus == 3) {
$this->ajaxReturn(['status' => 0, 'info' => '大赛已经结束,不能报名!']); $this->ajaxReturn(['status' => 0, 'info' => '大赛已经结束,不能报名!']);
} }
if($mfrom==1||$mfrom==2){ if ($mfrom == 1 || $mfrom == 2) {
$userId = I('userId', '',intval); $userId = I('userId', '', intval);
if($mfrom==1){ if ($mfrom == 1) {
$referer=$referer?$referer:(I('place')?I('place'):'ios_banner'); $referer = $referer ? $referer : (I('place') ? I('place') : 'ios_banner');
} }
if($mfrom==2){ if ($mfrom == 2) {
$referer=$referer?$referer:(I('place')?I('place'):'android_banner'); $referer = $referer ? $referer : (I('place') ? I('place') : 'android_banner');
} }
}else{ } else {
$userId = $this->user['userID']; $userId = $this->user['userID'];
} }
if(!$userId){ if (!$userId) {
$this->ajaxReturn(['status' => 0, 'info' => '请登录!']); $this->ajaxReturn(['status' => 0, 'info' => '请登录!']);
} }
$uc = uc_get_user(['userId' => $userId,'type' => 3]); $uc = uc_get_user(['userId' => $userId, 'type' => 3]);
$ucData = $uc['data']; $ucData = $uc['data'];
$mobile=$ucData['mobile']; $mobile = $ucData['mobile'];
} }
//自动登录 //自动登录
$this->setLogin(array('userID'=>$ucData['user_id'],'userName'=>$ucData['user_name'],'nick'=>$ucData['nick'])); $this->setLogin(array('userID' => $ucData['user_id'], 'userName' => $ucData['user_name'], 'nick' => $ucData['nick']));
//同步登陆 //同步登陆
require_once './uc_client_php/client.php'; require_once './uc_client_php/client.php';
uc_user_synlogin(array('userId'=>$ucData['user_id'],'userName'=>$ucData['user_name'],'nick'=>$ucData['nick'],'webId'=>$ucData['web_id'])); uc_user_synlogin(array('userId' => $ucData['user_id'], 'userName' => $ucData['user_name'], 'nick' => $ucData['nick'], 'webId' => $ucData['web_id']));
if($targetUrl){ if ($targetUrl) {
return array('status'=>11,'info'=>''); return array('status' => 11, 'info' => '');
} }
//加入大赛 //加入大赛
// $cfrom=I('cfrom'); // $cfrom=I('cfrom');
// $place=$cfrom?$cfrom:I('hfrom'); // $place=$cfrom?$cfrom:I('hfrom');
$place=''; $place = '';
$return=$this->joinUserGroup($ucData['user_id'],$ucData['user_name'],$this->GID,$inviterId,$referer,$place,$mobile); $return = $this->joinUserGroup($ucData['user_id'], $ucData['user_name'], $this->GID, $inviterId, $referer, $place, $mobile);
$this->ajaxReturn($return); $this->ajaxReturn($return);
} }
public function reg2020($mobile, $inviterId)
//检查是否参加了大赛
public function checkJoin(){
$userId = I('userId', '');
$groupId=I('groupId',0,intval);
if($userId){
$ids = D('Group')->getGroupCache($userId);
$joinStatus=in_array($groupId,$ids)?1:0;
}
$this->ajaxReturn(array('status' => 1,'joinStatus' =>$joinStatus,'userId'=>$userId));
}
//月赛前10名用户的挑战情况
// private function formatTop10(){
// $month=date('Y-m',strtotime(date('Y-m-01') . "-1 month"));
// $top10=M('PktopUserphb')->where(array('month'=>$month))->order('month desc,monthup desc')->limit(10)->select();
// $top10UserIds=array();
// foreach ($top10 as $k => $v) {
// $top10UserIds[]=$v['user_id'];
// }
//
// $enemyIds=$this->getEnemy($top10UserIds);
// foreach ($top10 as $k => &$v) {
// $v['enemyNum']=count($enemyIds[$v['user_id']]);
//// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
// //敌人头像列表
// $v['enemy']=$enemyIds[$v['user_id']];
// }
//// var_dump($top10);exit;
// return $top10;
// }
// public function getEnemy($passiveIds) {
// //取被挑战者的挑战人员array('pk_end_time'=>array('egt',date('Y-m-d')),'passive_id'=>array('in',$passiveIds))
// $enemy=M('PktopData')->where(array('passive_id'=>array('in',$passiveIds)))->select();
// $enemyIds=array();
// foreach ($enemy as $k => $v) {
// $enemyIds[$v['passive_id']][]=$v['active_id'];
// }
// return $enemyIds;
// }
public function sendMessage()
{ {
$mobile = I('mobile'); $username = randUsername('股神', $mobile);
$verify_data = I('verify_data'); $password = '1Aa' . substr(md5($username), 18);
if (empty($verify_data)) { $regData = ['userName' => $username, 'password' => $password, 'ip' => get_client_ip(), 'inviteFrom' => 'web', 'mobile' => $mobile, 'mobile_status' => 1, 'psourse' => 'm'];
$this->ajaxReturn(array('status' => 0, 'info' => '验证失败')); $regData['sourse'] = $inviterId ? 'zcyaoqing' : 'zcguanfang';
} else {
$check_code = D('Ali')->checkVerify($verify_data);
if ($check_code != 200) {
$this->ajaxReturn(array('status' => 0, 'info' => '验证失败,请刷新重试'));
}
}
$type=32;
//手机发送短信验证码
$code = randString(6,1);
$tpl =C('WWW_SMS_TPL');
$content= cplang($tpl[$type]['content'],[$code]);
$data= array('mobile' => $mobile,'content' => $content, 'type' => $type,'id'=>time(),'code'=>$code);
$result = D('Sms')->send($data,true,true );
if($result){
session('mobileCode',md5(strtolower($mobile.$code)));
$this->ajaxReturn(array('status' => 1,'info' => '短信验证码已发送,请等待...' ));
}else{
$this->ajaxReturn(array('status' => 0,'info' => '发送失败'));
}
}
public function reg2020($mobile,$inviterId){
$username = randUsername('股神',$mobile);
$password = '1Aa'.substr(md5($username), 18);
$regData=['userName' => $username, 'password' => $password, 'ip' => get_client_ip(),
'inviteFrom' => 'web', 'mobile' => $mobile,'mobile_status' => 1,'psourse' =>'m'];
$regData['sourse']=$inviterId?'zcyaoqing':'zcguanfang';
$uc = uc_user_register($regData); $uc = uc_user_register($regData);
// var_dump($uc);exit; // var_dump($uc);exit;
//status0是注册成功 //status0是注册成功
if ($uc['status']) { if ($uc['status']) {
$this->ajaxReturn(array('status' => 0, 'info' => '注册失败!','debug'=>json_encode($uc))); $this->ajaxReturn(array('status' => 0, 'info' => '注册失败!', 'debug' => json_encode($uc)));
} }
//注册成功 //注册成功
$ucData = $uc['data']; $ucData = $uc['data'];
$info = array('user_id'=>$ucData['user_id'],'user_name'=>$ucData['user_name'],'mobile'=>$mobile,'mobile_status'=>1); $info = array('user_id' => $ucData['user_id'], 'user_name' => $ucData['user_name'], 'mobile' => $mobile, 'mobile_status' => 1);
$res = D('Userinfo')->_addUser($info); $res = D('Userinfo')->_addUser($info);
if ($res <= 0) { if ($res <= 0) {
...@@ -546,510 +236,215 @@ class PkTopAction extends IdentityAction{ ...@@ -546,510 +236,215 @@ class PkTopAction extends IdentityAction{
} else { } else {
//注册后不用让其自动登录 //注册后不用让其自动登录
uc_user_synlogin(array('userId' => $info['user_id'], 'userName' => $info['user_name'], 'nick' => '', 'webId' => '')); uc_user_synlogin(array('userId' => $info['user_id'], 'userName' => $info['user_name'], 'nick' => '', 'webId' => ''));
$this->setLogin(array('userID'=>$info['user_id'],'userName'=>$info[' user_name'],'nick'=>'')); $this->setLogin(array('userID' => $info['user_id'], 'userName' => $info[' user_name'], 'nick' => ''));
} }
//新用户注册送150富币 //新用户注册送150富币
D('CofCoin')->addMoneyForNewUser($info['user_id'],$info['user_name'],$mobile); D('CofCoin')->addMoneyForNewUser($info['user_id'], $info['user_name'], $mobile);
return $info; return $info;
} }
public function setLogin($userInfo){ public function setLogin($userInfo)
{
//清空cookie //清空cookie
cookie('_userID', $userInfo['userID']); cookie('_userID', $userInfo['userID']);
cookie('_userName',$userInfo['userName']); cookie('_userName', $userInfo['userName']);
// cookie('_nick',$userInfo['nick']); // cookie('_nick',$userInfo['nick']);
cookie('_auth',null); cookie('_auth', null);
cookie('_auth', think_encrypt($userInfo['userName']."\t".$userInfo['userID']."\t".$userInfo['nick']),86400*30); cookie('_auth', think_encrypt($userInfo['userName'] . "\t" . $userInfo['userID'] . "\t" . $userInfo['nick']), 86400 * 30);
} }
//参加大赛 //参加大赛
public function joinUserGroup($userId,$userName,$groupId,$inviterId,$referer,$place,$mobile){ public function joinUserGroup($userId, $userName, $groupId, $inviterId, $referer, $place, $mobile)
{
// $field='group_id,name,question_privacy,reg_answer,type,web_id,capital,teamid,category,is_open'; // $field='group_id,name,question_privacy,reg_answer,type,web_id,capital,teamid,category,is_open';
// $group =M('Group')->where(array('group_id'=>$groupId))->field($field)->find(); // $group =M('Group')->where(array('group_id'=>$groupId))->field($field)->find();
$field='a.group_id,a.name,question_privacy,reg_answer,a.type,a.web_id,a.capital,a.teamid,a.category,is_open,wechat'; $field = 'a.group_id,a.name,question_privacy,reg_answer,a.type,a.web_id,a.capital,a.teamid,a.category,is_open,wechat';
$group=M('Group a')->join('left join cofool_group_info b on a.group_id=b.group_id') $group = M('Group a')->join('left join cofool_group_info b on a.group_id=b.group_id')->field($field)->where(['a.group_id' => $groupId])->find();
->field($field)->where(['a.group_id'=>$groupId])->find();
// $bmContent='您正在报名全民争霸赛,请添加陪伴老师微信加入【大赛高手交流群】,老师微信号:'.$group['wechat']; // $bmContent='您正在报名全民争霸赛,请添加陪伴老师微信加入【大赛高手交流群】,老师微信号:'.$group['wechat'];
// $bmContent='您正在报名全民争霸赛,请添加陪伴老师微信加入【大赛高手交流群】,老师微信号:19144412198'; // $bmContent='您正在报名全民争霸赛,请添加陪伴老师微信加入【大赛高手交流群】,老师微信号:19144412198';
$bmContent='您正在报名全民炼股争霸赛,请下载简投APP联系官方客服,领取参赛福利。'; $bmContent = '您正在报名全民炼股争霸赛,请下载简投APP联系官方客服,领取参赛福利。';
if($group['is_open']==0){ if ($group['is_open'] == 0) {
return array('status'=>0,'info'=>'当前大赛不允许加入!'); return array('status' => 0, 'info' => '当前大赛不允许加入!');
} }
//有grade,不改成user_group缓存 //有grade,不改成user_group缓存
$row = M('UserGroup')->where(array('user_id'=>$userId,'group_id'=>$groupId))->find(); $row = M('UserGroup')->where(array('user_id' => $userId, 'group_id' => $groupId))->find();
if(empty($row)){ if (empty($row)) {
$initData=array('user_id'=>$userId,'user_name'=>$userName,'group_id'=>$groupId,'grade'=>0,'teamid'=>$groupId,'add_time'=>NOW_TIME); $initData = array('user_id' => $userId, 'user_name' => $userName, 'group_id' => $groupId, 'grade' => 0, 'teamid' => $groupId, 'add_time' => NOW_TIME);
$u_data=array('u_web_id'=>$group['web_id'],'u_name'=>$group['name'],'u_category'=>$group['category'],'u_capital'=>$group['capital']); $u_data = array('u_web_id' => $group['web_id'], 'u_name' => $group['name'], 'u_category' => $group['category'], 'u_capital' => $group['capital']);
$result = M('UserGroup')->add(array_merge($initData,$u_data)); $result = M('UserGroup')->add(array_merge($initData, $u_data));
//增加人数 //增加人数
M('Group')->where(array('group_id'=>$groupId))->setInc('member_quantity'); M('Group')->where(array('group_id' => $groupId))->setInc('member_quantity');
}else{ } else {
//如果被踢出则恢复 //如果被踢出则恢复
if($row['grade'] == -2){ if ($row['grade'] == -2) {
M('UserGroup')->where(['user_id'=>$userId,'group_id'=>$groupId])->save(['grade'=>0,'add_time'=>time()]); M('UserGroup')->where(['user_id' => $userId, 'group_id' => $groupId])->save(['grade' => 0, 'add_time' => time()]);
}else{ } else {
// return ['status'=>0,'info'=>'您已经参加过该大赛','debug'=>$userId,'flag'=>1]; // return ['status'=>0,'info'=>'您已经参加过该大赛','debug'=>$userId,'flag'=>1];
return ['status'=>0,'info'=>'登录成功','debug'=>$userId,'flag'=>1]; return ['status' => 0, 'info' => '登录成功', 'debug' => $userId, 'flag' => 1];
} }
} }
//加入炼股赛用户表 //加入炼股赛用户表
$exist=M('PktopUser')->where(array('user_id'=>$userId))->find(); $exist = M('PktopUser')->where(array('user_id' => $userId))->find();
if(empty($exist)){ if (empty($exist)) {
$inviterId=$inviterId?$inviterId:cookie('aid'); $inviterId = $inviterId ? $inviterId : cookie('aid');
$inviterId=$inviterId?$inviterId:5420972; $inviterId = $inviterId ? $inviterId : 5420972;
$userData=array('user_id'=>$userId,'user_name'=>$userName,'inviter_id'=>$inviterId, $userData = array('user_id' => $userId, 'user_name' => $userName, 'inviter_id' => $inviterId, 'referer' => $referer, 'add_time' => time(), 'device' => $place ? $place : 'm');
'referer'=>$referer,'add_time'=>time(),'device'=>$place?$place:'m');
//ur里面有user_id时,判断不出是自己的还是邀请人的 //ur里面有user_id时,判断不出是自己的还是邀请人的
if($userId==$inviterId){ if ($userId == $inviterId) {
$userData['inviter_id']=''; $userData['inviter_id'] = '';
} }
M('PktopUser')->add($userData); M('PktopUser')->add($userData);
} }
//清user_group缓存 //清user_group缓存
D('Group')->clearGroupCache($userId); D('Group')->clearGroupCache($userId);
//普通大赛 //普通大赛
$db = getModel($group['web_id']); $db = getModel($group['web_id']);
$uid = $groupId.'X'.$userId; $uid = $groupId . 'X' . $userId;
$row = M('userinfo', " ", C('DB_CONFIG_MNCG3'))->where(array('uid'=>$uid))->count(); $row = M('userinfo', " ", C('DB_CONFIG_MNCG3'))->where(array('uid' => $uid))->count();
if(!empty($row)){ if (!empty($row)) {
M('userinfo', " ", C('DB_CONFIG_MNCG3'))->where(array('uid'=>$uid))->data(array('zt'=>1))->save(); M('userinfo', " ", C('DB_CONFIG_MNCG3'))->where(array('uid' => $uid))->data(array('zt' => 1))->save();
}else{ } else {
$initData=['stock_balance'=>0,'all_cjl'=>0,'new_phb'=>0,'old_phb'=>0,'zt'=>1,'XinyongED'=>6]; $initData = ['stock_balance' => 0, 'all_cjl' => 0, 'new_phb' => 0, 'old_phb' => 0, 'zt' => 1, 'XinyongED' => 6];
$initData['uid']=$uid; $initData['uid'] = $uid;
$initData['username']=$userName; $initData['username'] = $userName;
$initData['balance']=$initData['frozen_balance']=$initData['all_balance']=$group['capital']; $initData['balance'] = $initData['frozen_balance'] = $initData['all_balance'] = $group['capital'];
$initData['sex']=$group['teamid']; $initData['sex'] = $group['teamid'];
$initData['regdate']=date('Y-m-d H:i:s',NOW_TIME); $initData['regdate'] = date('Y-m-d H:i:s', NOW_TIME);
M('userinfo', " ", C('DB_CONFIG_MNCG3'))->add($initData); M('userinfo', " ", C('DB_CONFIG_MNCG3'))->add($initData);
} }
D('User')->addInvite($userId,$userName); D('User')->addInvite($userId, $userName);
//完成勋章 //完成勋章
D('User')->finishXunzhang($userId,$userName,$mobile,'cansai'); D('User')->finishXunzhang($userId, $userName, $mobile, 'cansai');
D('Sms')->send(['mobile'=>$mobile,'content' =>$bmContent,'type'=>46],true,true); D('Sms')->send(['mobile' => $mobile, 'content' => $bmContent, 'type' => 46], true, true);
#富币任务-全民邀请参赛 #富币任务-全民邀请参赛
$aid=cookie('aid')?cookie('aid'):5420972; $aid = cookie('aid') ? cookie('aid') : 5420972;
$result = D('CofCoin')->addMoneyForQmJoin($userId,$aid); $result = D('CofCoin')->addMoneyForQmJoin($userId, $aid);
if(cookie('aid')){ if (cookie('aid')) {
cookie('aid',null); cookie('aid', null);
} }
return ['status' => 1, 'info' => '参赛成功', 'debug' => $userId, 'is_coin' => $result]; return ['status' => 1, 'info' => '参赛成功', 'debug' => $userId, 'is_coin' => $result];
} }
//我的邀请列表
// public function myInvite(){
// $userId = $this->user['userID'];
// $cfrom=I('cfrom', '');
// $key=I('key', '');
// if($cfrom=='pcInvitation'){
// $userIdParam=I('user_id', '',intval);
//// echo md5('user_id='.$userIdParam.'abcd4321');exit;
// if(md5('user_id='.$userIdParam.C('login_user_id_salt'))==$key){
// $this->setUcLogin($userIdParam);
// $userId=$userIdParam;
// }else{
// //校验不对
// $userId=-1;
// }
// }
//// $userId=4825940;
// $guests=M('PktopUser')->where(array('inviter_id'=>$userId))->getField('user_id,user_id,user_name',true);
// $mncgData = M("userinfo", " ", C('DB_CONFIG_MNCG3'))->field('uid,lastmonthup')->where(array('sex'=>$this->GID,'new_phb'=>array('gt',0)))
// ->order('lastmonthup desc,regdate asc')->cache(true,300)->select();
// foreach ($mncgData as $k => $value) {
// $guestId=str_replace($this->GID.'X','',$value['uid']);
// //有交易数据
// if(!empty($guests[$guestId])){
// $guests[$guestId]['order']=$k+1;
// $guests[$guestId]['lastmonthup']=$value['lastmonthup'];
// }
// }
////var_dump($mncgData);exit;
// $shareInfo=$this->setShare($userId,$cfrom);
//
// $return=array('guests'=>$guests,'guestNum'=>count($guests));
//
// //点分享按钮时调用app的分享
// $appParam['url'] = $shareInfo['shareUrl'];
// $appParam['name'] = $shareInfo['shareTitle'];
// $appParam['introduction'] = $shareInfo['shareContent'];
// ;
// $this->assign('appParam',json_encode($appParam));
// $this->assign($return);
//
// $this->display();
// }
//取大赛的状态 //取大赛的状态
private function getGroupStatus($groupInfo){ public function checkJoin()
if(is_end($groupInfo['endTime'])==true){ {
$groupStatus=3; $userId = I('userId', '');
// $zhuangtai='已结束'; $groupId = I('groupId', 0, intval);
}elseif($groupInfo['startTime']>time()){ if ($userId) {
$groupStatus=1; $ids = D('Group')->getGroupCache($userId);
// $zhuangtai='未开赛'; $joinStatus = in_array($groupId, $ids) ? 1 : 0;
}else{ }
$groupStatus=2;
// $zhuangtai='进行中'; $this->ajaxReturn(array('status' => 1, 'joinStatus' => $joinStatus, 'userId' => $userId));
}
return $groupStatus;
} }
//我的未结束的挑战 public function sendMessage()
// private function getMyPkUserId($userId){ {
// $where=array('pk_end_time'=>array('egt',date('Y-m-d')), $mobile = I('mobile');
// '_complex'=>array('active_id'=>$userId,'passive_id'=>$userId,'_logic'=>'or')); $verify_data = I('verify_data');
// if (empty($verify_data)) {
// $myPks=M('PktopData')->where($where)->order('add_time desc')->select(); $this->ajaxReturn(array('status' => 0, 'info' => '验证失败'));
// } else {
// $myPkUserId=array(); $check_code = D('Ali')->checkVerify($verify_data);
// foreach ($myPks as $k => $value) { if ($check_code != 200) {
// //取我主动挑战的人 $this->ajaxReturn(array('status' => 0, 'info' => '验证失败,请刷新重试'));
// 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=='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);
// $monthIds=array();
// foreach ($monthUsers as $k => &$v) {
// $v['pkStatus']=in_array($v['user_id'],$myPkUserId)?1:0;
// $monthIds[]=$v['user_id'];
// }
//
// $enemyIds=$this->getEnemy($monthIds);
//
// $nickList =getUser($monthIds,'nick');////
//
// foreach ($monthUsers as $k => &$v4) {
// $v4['enemyNum']=count($enemyIds[$v4['user_id']]);
// $v4['enemy']=$enemyIds[$v4['user_id']];
//
// $nick = $nickList[$v4['user_id']];////
// $v4['user_name'] = $nick;//?$nick:$v4['user_name'];////
// }
//
// $count=count($monthUsers);
// if($month==$nowMonth){
// $type='nowMonth';
// }
// $this->assign(array('type'=>$type,'userList'=>$monthUsers));
// $content = $this->fetch('item2');
// }
//
// $this->ajaxReturn(array(
// 'status' => 1,'count' =>$count,'type' =>$type,'data' => $content
// ));
// }
//用户列表,包括最新挑战榜,人气挑战榜等页面
// 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 login() {
$userId=I('user_id', '',intval);
if($userId&&$this->user['userName']==''){
$user_data = uc_get_user(array('userName' => '', 'webId' => 0, 'userId' => $userId));
$ucData=$user_data['data'];
$userName = $ucData['user_name'];
uc_user_synlogin(array('userId'=>$userId,'userName'=>$userName,'nick'=>'','webId'=>$ucData['web_id']));
$this->assign(array(
'user'=>array('userID'=>$userId,'userName'=>$userName)
));
} }
} }
$type = 32;
//手机发送短信验证码
$code = randString(6, 1);
$tpl = C('WWW_SMS_TPL');
$content = cplang($tpl[$type]['content'], [$code]);
$data = array('mobile' => $mobile, 'content' => $content, 'type' => $type, 'id' => time(), 'code' => $code);
$result = D('Sms')->send($data, true, true);
if ($result) {
session('mobileCode', md5(strtolower($mobile . $code)));
$this->ajaxReturn(array('status' => 1, 'info' => '短信验证码已发送,请等待...'));
} else {
$this->ajaxReturn(array('status' => 0, 'info' => '发送失败'));
}
//首页滚动的公告
public function getGonggao() {
// $gonggao=M('pktop_gonggao','cofool_', C('DB_CONFIG_DEMO'))->where(array('view_flag'=>1))->order('add_time desc')->limit(5)->select();
$gonggao=M('Gonggao')->where(['group_id'=>PRIZE_GROUP_2021,'view_flag'=>1])->order('add_time desc')->limit(5)->select();
return $gonggao;
} }
//首页滚动的公告
public function setUcLogin($userId) { public function login()
$user_data = uc_get_user(array('userName' => '', 'webId' => 0, 'userId' => $userId)); {
$ucData=$user_data['data']; $userId = I('user_id', '', intval);
$userName = $ucData['user_name']; if ($userId && $this->user['userName'] == '') {
// var_dump($userId);exit; $user_data = uc_get_user(array('userName' => '', 'webId' => 0, 'userId' => $userId));
uc_user_synlogin(array('userId'=>$userId,'userName'=>$userName,'nick'=>'','webId'=>$ucData['web_id'])); $ucData = $user_data['data'];
$this->setLogin(array('userId'=>$userId,'userName'=>$userName)); $userName = $ucData['user_name'];
$this->assign(array( uc_user_synlogin(array('userId' => $userId, 'userName' => $userName, 'nick' => '', 'webId' => $ucData['web_id']));
'user'=>['userID'=>$userId,'userName'=>$userName,'nick'=>$ucData['nick']] $this->assign(array('user' => array('userID' => $userId, 'userName' => $userName)));
));
}
public function setShare($userId,$cfrom=0) {
//app内的分享,参数名不能改
// $shareTitle='您的好友邀请您参加「全民炼股」争霸赛';
// $shareDesc='红包周周有,万元大奖月月送';
$shareTitle='您的好友邀请您参加全民炼股争霸赛-全民分赛场';
$shareDesc='每周评奖,正盈利即可瓜分奖金!!!';
$shareUrl=M_URL."/PkTop?inviterId=".$userId.'&cfrom='.$cfrom;
$appShareInfo['shareTitle']=$shareTitle;
$appShareInfo['shareContent']=$shareDesc;
$appShareInfo['shareUrl']=$shareUrl;
// $this->assign('appShareTitle',$shareTitle);
// $this->assign('appShareContent',$shareDesc);
// $this->assign('appShareUrl',$shareUrl);
$this->assign('appShareInfo',json_encode($appShareInfo));
// $this->assign('h5ShareTitle',$shareTitle);
// $this->assign('h5ShareDesc',$shareDesc);
// $this->assign('h5ShareUrl',$shareUrl);
//定义在微信分享的显示
$signPackage=D('Share')->getSignPackage();
$this->assign('signPackage',$signPackage);
$appParam['url'] = $shareUrl;
$appParam['name'] = $shareTitle;
$appParam['introduction'] = $shareDesc;
;
$this->assign('appParam',json_encode($appParam));
//定义在微信分享的显示
$signPackage=D('Share')->getSignPackage();
$this->assign('signPackage',json_encode($signPackage));
return $appShareInfo;
} }
}
//提现页面 public function shareLog()
// public function withdraw() { {
// $userID = $this->user['userID'];
// $userName = $this->user['userName'];
// if (!$userID) {
// header("Location:/Passport/login/type/1.html?refer=/Pktop/withdraw");
// }
//
// //flag1提现,2挑战金记录
// $flag=I('flag',0,intval);
// if($flag==2){
// //1pk付款,2发起pk,3pk胜利,4pk失败,5胜利退钱,6失败钱归passive,7买重置卡
// $moneyList = M('PktopNews')->where(['user_id' => $userID,'type'=>['in','1,5,6,8']])->order('add_time desc')->select();
// $this->assign(array('flag'=>2,'moneyList'=>$moneyList));
// $this->display();
// exit;
// }
//
// if($flag==1){
// $user = M('PktopUser')->where(array('user_id' => $userID))->find();
// if (IS_GET) {
// $cashout_log = M('pktop_cashout_log')->where(['user_id' => $userID])->order('id desc')->find();
// $money=$user['active_money']+$user['passive_money']-$user['already_withdraw_money'];
// $this->assign(array('flag'=>1,'money'=>$money,'cashout_log'=>$cashout_log));
// $this->display('/Pktop/withdraw');
// exit;
// }else{
// //插入流水表
// $alipayAccount = I('alipayAccount');
// $money = I('money', '', 'float');
// $data = ['user_id' => $userID, 'user_name' => $userName, 'Alipay' => $alipayAccount,
// 'apply_cashout' => $money, 'time_cashout' => time()];
//
// $id = M('PktopCashoutLog')->add($data);
// if ($id) {
// $this->ajaxReturn(array(
// 'status' => 1,
// 'info' => ''
// ));
// } else {
// $this->ajaxReturn(array(
// 'status' => 3,
// 'info' => '数据有误,请联系客服人员'
// ));
// }
// }
// }
// }
// 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() {
$userID = $this->user['userID']; $userID = $this->user['userID'];
M('PktopShare')->add(array('user_id'=>$userID,'add_time'=>time(),'device'=>'m')); M('PktopShare')->add(array('user_id' => $userID, 'add_time' => time(), 'device' => 'm'));
$this->ajaxReturn(array('status' => 0, 'info' => '')); $this->ajaxReturn(array('status' => 0, 'info' => ''));
} }
// public function setGoTrade($userId) { public function getGoTradeInfo()
// //进入交易需要的参数 {
// $groupInfo=M('Group')->field('group_id,web_id,category,name,startTime,endTime')->where(array('group_id'=>$this->GID))->find(); $userId = I('userId', '', intval);
//
// $zhuangtai=$this->getGroupStatus($groupInfo);
// $groupInfo['userID']=$userId;
//
// $groupInfo['close_tips']='';
// $groupInfo['zhuangtai'] = $zhuangtai;
// $groupInfo['viewPage'] = 2;
// //跳到交易区
// $groupInfo['jump'] = 1;
//// $groupInfo['title'] = '『全民炼股』争霸赛(2020赛季)';
//// $groupInfo['desc'] = $groupInfo['shareContent']='红包周周有,万元大奖月月送,精英还可赢PK奖';
//
// $this->assign('groupInfo',json_encode($groupInfo));
// }
//进入交易需要的参数,可能跳转到他人主页
public function getGoTradeInfo() {
$userId = I('userId', '',intval);
$userName = I('userName', ''); $userName = I('userName', '');
$gid=I('gid',$this->GID,intval); $gid = I('gid', $this->GID, intval);
if(!$userId){ if (!$userId) {
$this->ajaxReturn(['status' =>0,'info'=>'非法参数']); $this->ajaxReturn(['status' => 0, 'info' => '非法参数']);
} }
$gInfo=M('Group')->field('group_id,web_id,category,name,startTime,endTime')->where(['group_id'=>$gid])->find(); $gInfo = M('Group')->field('group_id,web_id,category,name,startTime,endTime')->where(['group_id' => $gid])->find();
$goTradeInfo=['group_id'=>$gInfo['group_id'],'web_id'=>$gInfo['web_id'],'category'=>$gInfo['category'],'name'=>$gInfo['name']]; $goTradeInfo = ['group_id' => $gInfo['group_id'], 'web_id' => $gInfo['web_id'], 'category' => $gInfo['category'], 'name' => $gInfo['name']];
$goTradeInfo['groupStatus'] = $gInfo['startTime']>time()?'1': (is_end($gInfo['endTime'])?'3':'2'); $goTradeInfo['groupStatus'] = $gInfo['startTime'] > time() ? '1' : (is_end($gInfo['endTime']) ? '3' : '2');
$goTradeInfo['zhuangtai'] = $gInfo['startTime']>time()?'未开始': (is_end($gInfo['endTime'])?'已结束':'进行中'); $goTradeInfo['zhuangtai'] = $gInfo['startTime'] > time() ? '未开始' : (is_end($gInfo['endTime']) ? '已结束' : '进行中');
$goTradeInfo['userID']=$userId; $goTradeInfo['userID'] = $userId;
$goTradeInfo['userName']=$userName; $goTradeInfo['userName'] = $userName;
$goTradeInfo['jump']=$this->user['userID']==$userId?1:2; $goTradeInfo['jump'] = $this->user['userID'] == $userId ? 1 : 2;
$this->ajaxReturn(['status' => 1,'data'=>json_encode($goTradeInfo)]); $this->ajaxReturn(['status' => 1, 'data' => json_encode($goTradeInfo)]);
} }
//取总盈利率 //记录分享的日志
private function getZongup(){ public function dianjiLog()
$db = getModel(102); {
$gid = $this->GID;
$suffix = D('Userinfo')->getTable($this->GID); $userId = $this->user['userID'];
$table =$suffix?'mncg_archive.userinfo'.$suffix:'mncg.userinfo'; if ($userId) {
// var_dump($table);exit; $where = ['user_id' => $userId, 'add_time' => ['egt', strtotime('today')], 'model' => MODULE_NAME, 'action' => 'moreDs', 'param1' => $gid];
// $userInfoData = $db->table($table)->where(array('sex' => $this->GID))->getField('uid,zongup'); $count = M('ClickLog')->where($where)->count();
$userInfoData = M($table, " ", C('DB_CONFIG_MNCG3'))->where(array('sex' => $this->GID))->getField('uid,zongup'); if (!$count) {
$data = ['user_id' => $userId, 'user_name' => $this->user['userName'], 'model' => MODULE_NAME, 'action' => 'moreDs', 'add_time' => time(), 'client' => getSys(), 'day' => date('Ymd', time()), 'param1' => $gid];
// var_dump($userInfoData);exit; M('ClickLog')->add($data);
$zongupData=array();
foreach ($userInfoData as $k => $v1) {
$tmpId=str_replace($this->GID.'X','',$k);
$zongupData[$tmpId]=$v1;
} }
return $zongupData;
} }
$this->ajaxReturn(['status' => 1, 'debug' => '用户id:' . $userId . ',旧数据条数' . $count]);
}
public function dianjiLog(){ //进入交易需要的参数,可能跳转到他人主页
$gid=$this->GID;
$userId=$this->user['userID'];
if($userId){
$where=['user_id'=>$userId,'add_time'=>['egt',strtotime('today')],'model'=>MODULE_NAME,'action'=>'moreDs','param1'=>$gid];
$count = M('ClickLog')->where($where)->count();
if(!$count){
$data=['user_id'=>$userId,'user_name'=>$this->user['userName'],'model'=>MODULE_NAME,'action'=>'moreDs',
'add_time'=>time(),'client'=>getSys(),'day'=>date('Ymd',time()),'param1'=>$gid];
M('ClickLog')->add($data);
}
}
$this->ajaxReturn(['status'=>1,'debug'=>'用户id:'.$userId.',旧数据条数'.$count]);
}
//新首页
public function index() public function index()
{ {
//邀请人id //邀请人id
if(I('aid')){ if (I('aid')) {
cookie('aid',I('aid')); cookie('aid', I('aid'));
} }
$userIdParam = I('user_id', '', intval); $userIdParam = I('user_id', '', intval);
$key = I('key', ''); $key = I('key', '');
...@@ -1067,7 +462,7 @@ class PkTopAction extends IdentityAction{ ...@@ -1067,7 +462,7 @@ class PkTopAction extends IdentityAction{
} }
} else { } else {
//第二次请求 //第二次请求
if (md5($userIdParam . 'abcd4321') == $key2 || md5('user_id=' . $userIdParam .'abcd4321') == $key) { if (md5($userIdParam . 'abcd4321') == $key2 || md5('user_id=' . $userIdParam . 'abcd4321') == $key) {
$userId = $userIdParam; $userId = $userIdParam;
} }
} }
...@@ -1081,9 +476,8 @@ class PkTopAction extends IdentityAction{ ...@@ -1081,9 +476,8 @@ class PkTopAction extends IdentityAction{
$groupStatus = $this->getGroupStatus($groupInfo); $groupStatus = $this->getGroupStatus($groupInfo);
$member_quantity = $groupInfo['member_quantity']; $member_quantity = $groupInfo['member_quantity'];
$share = ['groupId' => $groupId, 'groupStatus' => $groupStatus, 'viewPage' => 2, 'statusInt' => $groupStatus, $share = ['groupId' => $groupId, 'groupStatus' => $groupStatus, 'viewPage' => 2, 'statusInt' => $groupStatus, 'close_tips' => '', 'zhuangtai' => $this->STATUS_TXT[$groupStatus]];
'close_tips' => '','zhuangtai' => $this->STATUS_TXT[$groupStatus]]; $share['userID'] = $userId ? $userId : '';
$share['userID']=$userId?$userId:'';
$this->assign('groupInfo', json_encode(array_merge($groupInfo, $share))); $this->assign('groupInfo', json_encode(array_merge($groupInfo, $share)));
...@@ -1093,37 +487,20 @@ class PkTopAction extends IdentityAction{ ...@@ -1093,37 +487,20 @@ class PkTopAction extends IdentityAction{
if (in_array($groupId, $ids)) { if (in_array($groupId, $ids)) {
$this->assign('joinStatus', 1); $this->assign('joinStatus', 1);
} }
if(!in_array($groupId, $ids)){ if (!in_array($groupId, $ids)) {
$this->assign('is_auto_join', I('aid') ? 1 : 0); $this->assign('is_auto_join', I('aid') ? 1 : 0);
} }
//滚动消息,1pk付款,2发起pk,3pk胜利,4pk失败,5胜利退钱,6失败钱归passive,7买重置卡
// $msg1 = M('PktopNews')->where(['type' => ['in', '2']])->order('add_time desc')->limit(5)->select();
// $msg2 = M('PktopNews')->where(['type' => ['in', '3']])->order('add_time desc')->limit(5)->select();
// $msg = empty($msg2) ? $msg1 : array_merge($msg2, $msg1);
$lastMonth = date('Y-m', strtotime(date('Y-m-01') . "-1 month"));
$lastMonthInt = intval(date('m', strtotime(date('Y-m-01') . "-1 month")));
// $rankNow = $this->rankNow('local');
//弹窗里面的pk时间段 //弹窗里面的pk时间段
$pkTime = date('n月j日', strtotime('next Monday')) . '-' . date('n月j日', strtotime('next Monday') + 4 * 3600 * 24);
$gonggao = $this->getGonggao(); $gonggao = $this->getGonggao();
//获奖心得 //获奖心得
$where = ['think' => ['exp', 'is not null and think != ""']]; $where = ['think' => ['exp', 'is not null and think != ""']];
$thinks = M('PktopUserphb')->where($where)->order('month desc')->limit(10)->select(); $thinks = M('PktopUserphb')->where($where)->order('month desc')->limit(10)->select();
$popData=null;
//第一个页面显示的数据,公告,心得等 //第一个页面显示的数据,公告,心得等
$firstPageData = [ $firstPageData = [
// 'popType' => $popData['popType'], 'popPkUserName' => $popData['popPkUserName'], 'thinks' => $thinks, 'gonggao' => $gonggao
'thinks' => $thinks, 'gonggao' => $gonggao]; ];
$this->assign($firstPageData); $this->assign($firstPageData);
...@@ -1150,14 +527,11 @@ class PkTopAction extends IdentityAction{ ...@@ -1150,14 +527,11 @@ class PkTopAction extends IdentityAction{
$referer = I('hFrom'); $referer = I('hFrom');
} elseif (I('from')) { } elseif (I('from')) {
$referer = I('from'); $referer = I('from');
}elseif (I('place')) { } elseif (I('place')) {
$referer = I('place'); $referer = I('place');
} else { } else {
$referer = $_SERVER['HTTP_REFERER']; $referer = $_SERVER['HTTP_REFERER'];
} }
// //这个月剩余的抽奖机会
// $leftCjNum = $this->getLeftCjNum();
// $this->assign('leftCjNum', $leftCjNum);
//大赛状态 //大赛状态
$gInfo['gStatus'] = is_end($groupInfo['endTime']) ? '3' : ($groupInfo['startTime'] > time() ? '1' : '2'); $gInfo['gStatus'] = is_end($groupInfo['endTime']) ? '3' : ($groupInfo['startTime'] > time() ? '1' : '2');
$this->assign('gInfo', $gInfo); $this->assign('gInfo', $gInfo);
...@@ -1168,55 +542,119 @@ class PkTopAction extends IdentityAction{ ...@@ -1168,55 +542,119 @@ class PkTopAction extends IdentityAction{
//我的成绩 //我的成绩
$this->setMyData(); $this->setMyData();
//重置卡个数 //重置卡个数
if($userId){ if ($userId) {
$leftNum=M()->db(10, C('DB_CONFIG_DEMO'))->table('cofool_magicbox_card')->where(['user_id'=>$userId,'card_type'=>2,'use_time'=>0])->count(); $leftNum = M()->db(10, C('DB_CONFIG_DEMO'))->table('cofool_magicbox_card')->where(['user_id' => $userId, 'card_type' => 2, 'use_time' => 0])->count();
}else{ } else {
$leftNum=0; $leftNum = 0;
} }
$this->assign('resetLeftNum',$leftNum); $this->assign('resetLeftNum', $leftNum);
$this->display(); $this->display();
} }
public function choujiang() { //取总盈利率
//这个月剩余的抽奖机会
$leftCjNum = A('Vip/Public')->getLeftCjNum(); private function setUcLogin($userId)
$this->assign('leftCjNum', $leftCjNum); {
$this->display(); $user_data = uc_get_user(array('userName' => '', 'webId' => 0, 'userId' => $userId));
$ucData = $user_data['data'];
$userName = $ucData['user_name'];
uc_user_synlogin(array('userId' => $userId, 'userName' => $userName, 'nick' => '', 'webId' => $ucData['web_id']));
$this->setLogin(array('userId' => $userId, 'userName' => $userName));
$this->assign(array('user' => ['userID' => $userId, 'userName' => $userName, 'nick' => $ucData['nick']]));
}
private function getGonggao()
{
$gonggao = M('Gonggao')->where(['group_id' => PRIZE_GROUP_2021, 'view_flag' => 1])->order('add_time desc')->limit(5)->select();
return $gonggao;
}
//新首页
private function setMyData()
{
$userId = $this->user['userID'];
if ($userId) {
$myData = ['userId' => $userId, 'userName' => $this->user['userName'], 'nick' => $this->user['nick']];
$tid = $this->GID . 'X' . $userId;
//->cache(true,300)
$tData = M("userinfo", " ", C('DB_CONFIG_MNCG3'))->where(['uid' => $tid])->find();
if (!empty($tData)) {
$myData['lastweekup'] = $tData['lastweekup'];
$myData['monthzzl'] = $tData['monthzzl'];
$where = ['sex' => $this->GID, 'monthzzl' => ['gt', 0], 'lastweekup' => ['gt', 0], 'zt' => 1];
$weekData = M("userinfo", " ", C('DB_CONFIG_MNCG3'))->where($where)->order('lastweekup desc')->cache(true, 300)->select();
foreach ($weekData as $k => $v) {
if ($v['uid'] == $tid) {
$myData['weekPhb'] = $k + 1;
break;
}
}
}
$this->assign('myData', $myData);
} }
}
public function choujiang()
{
//这个月剩余的抽奖机会
$leftCjNum = A('Vip/Public')->getLeftCjNum();
$this->assign('leftCjNum', $leftCjNum);
$this->display();
}
//周奖榜单页
public function phbWeek()
{
$p = I('p', 1);
$pageSize = 10;
$order = I('order', 'lastweekup');
$this->assign('order', $order);
$phb = $this->getPhb($p, $pageSize, $order);
$this->assign('weekPhb', $phb[0]);
$this->assign(['p' => $p, 'pageSize' => $pageSize, 'pages' => ceil($phb[1] / $pageSize), 'count' => $phb[1]]);
//大赛排行榜的当前排行页面 if (IS_GET) {
public function getPhb($p,$pageSize=10,$order){ //我的排名
$gid=$this->GID; $this->setMyData();
// $order=I('order','lastweekup'); $this->display();
// $pageSize=10;
// $pageSize=$gid==$this->GID?10:200; } else {
$content = $this->fetch('itemWeek');
$this->ajaxReturn(['status' => 1, 'count' => $phb[1], 'data' => $content]);
}
}
private function getPhb($p, $pageSize = 10, $order = '')
{
$gid = $this->GID;
//分表归档 //分表归档
$suffix = D('Userinfo')->getTable($gid); $suffix = D('Userinfo')->getTable($gid);
$table =$suffix?'mncg_archive.userinfo'.$suffix:'mncg.userinfo'; $table = $suffix ? 'mncg_archive.userinfo' . $suffix : 'mncg.userinfo';
$where=['sex'=>$gid,'zt'=>1,'new_phb'=>['gt',0]]; $where = ['sex' => $gid, 'zt' => 1, 'new_phb' => ['gt', 0]];
if($order=='lastweekup'){ if ($order == 'lastweekup') {
$where['lastweekup']=['gt',0]; $where['lastweekup'] = ['gt', 0];
$where['monthzzl']=['gt',0]; $where['monthzzl'] = ['gt', 0];
} }
//->cache(true,300) $tDataList = M($table, " ", C('DB_CONFIG_MNCG3'))->field('uid,lastweekup,monthzzl,successup,zongup,lastdayup,lastmonthup')->where($where)->order($order . ' desc')->page($p . ',' . $pageSize)->select();
$tDataList = M($table, " ", C('DB_CONFIG_MNCG3'))->field('uid,lastweekup,monthzzl,successup,zongup,lastdayup,lastmonthup') $uids = [];
->where($where)->order($order.' desc')->page($p.','.$pageSize)->select();
// var_dump(M($table, " ", C('DB_CONFIG_MNCG3'))->getLastSql());exit;
$uids =[];
foreach ($tDataList as $key => &$rankV) { foreach ($tDataList as $key => &$rankV) {
$userIDs = explode("X", $rankV['uid']); $userIDs = explode("X", $rankV['uid']);
$rankV['user_id'] = $userIDs[1]; $rankV['user_id'] = $userIDs[1];
$uids[] = $userIDs[1]; $uids[] = $userIDs[1];
} }
$nick_name_arry =getUser($uids,'nick');//// $nick_name_arry = getUser($uids, 'nick');
foreach ($tDataList as $key => &$value) { foreach ($tDataList as $key => &$value) {
$nick_name = $nick_name_arry[$value['user_id']]; $nick_name = $nick_name_arry[$value['user_id']];
...@@ -1224,182 +662,160 @@ class PkTopAction extends IdentityAction{ ...@@ -1224,182 +662,160 @@ class PkTopAction extends IdentityAction{
} }
//总数目 //总数目
$totalCount = M($table, " ", C('DB_CONFIG_MNCG3'))->where($where)->cache(true,300)->count(); $totalCount = M($table, " ", C('DB_CONFIG_MNCG3'))->where($where)->cache(true, 300)->count();
return [$tDataList,$totalCount]; return [$tDataList, $totalCount];
} }
public function phbWeek() { //盈利排行榜页
$p=I('p', 1); public function phbOther()
$pageSize=10; {
$order=I('order','lastweekup'); $p = I('p', 1);
$this->assign('order',$order); $pageSize = 10;
$order = I('order', 'zongup');
$phb=$this->getPhb($p,$pageSize,$order); $this->assign('order', $order);
$this->assign('weekPhb',$phb[0]);
$this->assign(['p'=>$p,'pageSize'=>$pageSize,'pages'=>ceil($phb[1]/$pageSize),'count'=>$phb[1]]);
if(IS_GET){
//我的排名
$this->setMyData();
$this->display();
}else{
$content = $this->fetch('itemWeek');
$this->ajaxReturn(['status' => 1,'count' =>$phb[1],'data' => $content]);
}
}
public function phbOther() {
$p=I('p', 1);
$pageSize=10;
$order=I('order','zongup');
$this->assign('order',$order);
$phb=$this->getPhb($p,$pageSize,$order); $phb = $this->getPhb($p, $pageSize, $order);
$this->assign('otherPhb',$phb[0]); $this->assign('otherPhb', $phb[0]);
$this->assign(['p'=>$p,'pageSize'=>$pageSize,'pages'=>ceil($phb[1]/$pageSize),'count'=>$phb[1]]); $this->assign(['p' => $p, 'pageSize' => $pageSize, 'pages' => ceil($phb[1] / $pageSize), 'count' => $phb[1]]);
if(IS_GET){ if (IS_GET) {
//我的排名 //我的排名
$this->setMyData(); $this->setMyData();
$this->display(); $this->display();
}else{ } else {
$content = $this->fetch('itemOther'); $content = $this->fetch('itemOther');
$this->ajaxReturn(['status' => 1,'count' =>$phb[1],'data' => $content]); $this->ajaxReturn(['status' => 1, 'count' => $phb[1], 'data' => $content]);
} }
} }
//成员交易页面
public function phbTrade()
{
$p = I('p', 1);
$pageSize = 10;
$order = I('order', 0);
$gInfo = D('Group')->getGroup($this->GID);
public function setMyData(){ //查看前n名
$userId = $this->user['userID']; $uids = [];
if($userId){ if ($order == 1) {
$myData=['userId'=>$userId,'userName'=>$this->user['userName'],'nick'=>$this->user['nick']]; $phb = $this->getPhb(1, 1, 'lastweekup');
$tid=$this->GID.'X'.$userId; $uids = array_column($phb[0], 'uid');
//->cache(true,300)
$tData = M("userinfo", " ", C('DB_CONFIG_MNCG3'))->where(['uid'=>$tid])->find();
if(!empty($tData)){
$myData['lastweekup']=$tData['lastweekup'];
$myData['monthzzl']=$tData['monthzzl'];
$where=['sex'=>$this->GID,'monthzzl'=>['gt',0],'lastweekup'=>['gt',0],'zt'=>1];
$weekData = M("userinfo", " ", C('DB_CONFIG_MNCG3'))->where($where)->order('lastweekup desc')->cache(true,300)->select();
foreach ($weekData as $k=>$v) {
if($v['uid']==$tid){
$myData['weekPhb']=$k+1;
break;
}
}
}
$this->assign('myData',$myData);
}
} }
//委托列表 $phb = D('User')->getWtList($gInfo, $p, $pageSize, $uids);
public function phbTrade() {
$p=I('p', 1);
$pageSize=10;
$gInfo = D('Group')->getGroup($this->GID);
$phb=D('User')->getWtList($gInfo,$p,$pageSize);
$wtList=$phb[0]; $wtList = $phb[0];
//取最新价 //取最新价
$stockHq=[]; $stockHq = [];
$stockCodes=array_column($wtList,'stock_code'); $stockCodes = array_column($wtList, 'stock_code');
$res = D('Stock')->stockQuotation(implode(',',$stockCodes),['type'=>1]); $res = D('Stock')->stockQuotation(implode(',', $stockCodes), ['type' => 1]);
if (count($stockCodes) == 1) { if (count($stockCodes) == 1) {
$typeCode=strtolower($wtList[0]['stock_type'].$stockCodes); $typeCode = strtolower($wtList[0]['stock_type'] . $stockCodes);
$stockHq[$typeCode]=$res; $stockHq[$typeCode] = $res;
}else{ } else {
$stockHq = $res; $stockHq = $res;
} }
foreach ($wtList as &$e) { foreach ($wtList as &$e) {
$stockCodeType = strtolower($e['stock_type'] . $e['stock_code']); $stockCodeType = strtolower($e['stock_type'] . $e['stock_code']);
$quo = $stockHq[$stockCodeType]; $quo = $stockHq[$stockCodeType];
if($quo){ if ($quo) {
$nowPrice=formatPrice(($quo['nowprice']>0?$quo['nowprice']:$quo['closePrice'])); $nowPrice = formatPrice(($quo['nowprice'] > 0 ? $quo['nowprice'] : $quo['closePrice']));
$e['now_price'] =$nowPrice; $e['now_price'] = $nowPrice;
$e['zd'] =formatPrice(($nowPrice-$e['cj_price'])/$e['cj_price']*100,2).'%'; $e['zd'] = formatPrice(($nowPrice - $e['cj_price']) / $e['cj_price'] * 100, 2) . '%';
} }
} }
$nick_name_arry =getUser(array_column($wtList,'CD'),'nick'); $nick_name_arry = getUser(array_column($wtList, 'CD'), 'nick');
$tids =array_column($wtList,'userid'); $tids = array_column($wtList, 'userid');
$tInfo = M("userinfo", " ", C('DB_CONFIG_MNCG3'))->where(['uid'=>['in',$tids]])->cache(true,60)->getField('uid,new_phb,zongup'); $tInfo = M("userinfo", " ", C('DB_CONFIG_MNCG3'))->where(['uid' => ['in', $tids]])->cache(true, 60)->getField('uid,new_phb,zongup');
foreach ($wtList as &$n) { foreach ($wtList as &$n) {
$nick_name = $nick_name_arry[$n['CD']]; $nick_name = $nick_name_arry[$n['CD']];
$n['username'] = $nick_name; $n['username'] = $nick_name;
$n['cj_time']=substr($n['cj_time'],11,8); $n['cj_time'] = substr($n['cj_time'], 11, 8);
$n['entrust_bs']=$n['entrust_bs']=='r'?'买入':'卖出'; $n['entrust_bs'] = $n['entrust_bs'] == 'r' ? '买入' : '卖出';
$n['price'] =number_format($n['price'],2,'.',''); $n['price'] = number_format($n['price'], 2, '.', '');
$n['cj_price'] =number_format($n['cj_price'],2,'.',''); $n['cj_price'] = number_format($n['cj_price'], 2, '.', '');
//大赛排名和总盈利率 //大赛排名和总盈利率
$n['phb']=$tInfo[$n['userid']]['new_phb']; $n['phb'] = $tInfo[$n['userid']]['new_phb'];
$n['zongup']=$tInfo[$n['userid']]['zongup']; $n['zongup'] = $tInfo[$n['userid']]['zongup'];
//点击用户名和股票名跳转需要的参数 //点击用户名和股票名跳转需要的参数
$n['goTradeInfo'] =$this->setGoTrade($gInfo,$n['CD'],$nick_name,2); $n['goTradeInfo'] = $this->setGoTrade($gInfo, $n['CD'], $nick_name, 2);
$n['StockTrade'] = json_encode(['name'=>$n['stock_name'],'code'=>$n['stock_code'], $n['StockTrade'] = json_encode(['name' => $n['stock_name'], 'code' => $n['stock_code'], 'market' => $n['stock_type'], 'zqlb' => $n['zqlb']]);
'market'=>$n['stock_type'],'zqlb'=>$n['zqlb']]); }
} $this->assign([
'p' => $p,
$this->assign('wtList',$wtList); 'pageSize' => $pageSize,
'pages' => ceil($phb[1] / $pageSize),
$this->assign(['p'=>$p,'pageSize'=>$pageSize,'pages'=>ceil($phb[1]/$pageSize),'count'=>$phb[1]]); 'count' => $phb[1],
'order' => $order,
if(IS_GET){ 'wtList'=> $wtList
]);
if (IS_GET) {
//我的排名 //我的排名
$this->setMyData(); $this->setMyData();
$this->display(); $this->display();
}else{ } else {
$content = $this->fetch('itemTrade'); $content = $this->fetch('itemTrade');
$this->ajaxReturn(['status' => 1,'count' =>$phb[1],'data' => $content]); $this->ajaxReturn(['status' => 1, 'count' => $phb[1], 'data' => $content]);
} }
} }
//进入交易需要的参数,可能跳转到他人主页 //委托列表
public function setGoTrade($gInfo,$userId,$userName,$jump) { public function setGoTrade($gInfo, $userId, $userName, $jump)
{
//非特殊大赛 //非特殊大赛
if($gInfo['type']!=1){ if ($gInfo['type'] != 1) {
$goTradeInfo=['group_id'=>$gInfo['group_id'],'web_id'=>$gInfo['web_id'],'category'=>$gInfo['category'], $goTradeInfo = ['group_id' => $gInfo['group_id'], 'web_id' => $gInfo['web_id'], 'category' => $gInfo['category'], 'name' => $gInfo['name']];
'name'=>$gInfo['name']]; $groupStatus = $gInfo['startTime'] > time() ? '1' : (is_end($gInfo['endTime']) ? '3' : '2');
$groupStatus=$gInfo['startTime']>time()?'1': (is_end($gInfo['endTime'])?'3':'2');
$goTradeInfo['groupStatus'] = $groupStatus; $goTradeInfo['groupStatus'] = $groupStatus;
$goTradeInfo['zhuangtai'] = $gInfo['startTime']>time()?'未开始': (is_end($gInfo['endTime'])?'已结束':'进行中'); $goTradeInfo['zhuangtai'] = $gInfo['startTime'] > time() ? '未开始' : (is_end($gInfo['endTime']) ? '已结束' : '进行中');
$goTradeInfo['statusInt'] =$groupStatus; $goTradeInfo['statusInt'] = $groupStatus;
} }
$goTradeInfo['userID']=$userId; $goTradeInfo['userID'] = $userId;
$goTradeInfo['userName']=$userName; $goTradeInfo['userName'] = $userName;
if(in_array($gInfo["category"],[1,9])){ if (in_array($gInfo["category"], [1, 9])) {
$goTradeInfo['viewPage']=1; $goTradeInfo['viewPage'] = 1;
} }
if(in_array($gInfo["category"],[3,4,6,7])){ if (in_array($gInfo["category"], [3, 4, 6, 7])) {
$goTradeInfo['viewPage']=2; $goTradeInfo['viewPage'] = 2;
} }
if(in_array($gInfo["category"],[2,5])){ if (in_array($gInfo["category"], [2, 5])) {
$goTradeInfo['viewPage']=3; $goTradeInfo['viewPage'] = 3;
} }
if(in_array($gInfo["category"],[8])){ if (in_array($gInfo["category"], [8])) {
$user_agent = explode('cofool/',$_SERVER['HTTP_USER_AGENT']); $user_agent = explode('cofool/', $_SERVER['HTTP_USER_AGENT']);
$version = $user_agent[1]; $version = $user_agent[1];
$goTradeInfo['viewPage']=checkVersion('>=','3.7.1',$version,'' )?1:2; $goTradeInfo['viewPage'] = checkVersion('>=', '3.7.1', $version, '') ? 1 : 2;
} }
//2到个人主页,1是交易区 //2到个人主页,1是交易区
$goTradeInfo['jump']=$jump; $goTradeInfo['jump'] = $jump;
return json_encode($goTradeInfo); return json_encode($goTradeInfo);
// $this->assign('goTradeInfo',json_encode($goTradeInfo)); }
//进入交易需要的参数,可能跳转到他人主页
private function getZongup()
{
$suffix = D('Userinfo')->getTable($this->GID);
$table = $suffix ? 'mncg_archive.userinfo' . $suffix : 'mncg.userinfo';
$userInfoData = M($table, " ", C('DB_CONFIG_MNCG3'))->where(array('sex' => $this->GID))->getField('uid,zongup');
$zongupData = array();
foreach ($userInfoData as $k => $v1) {
$tmpId = str_replace($this->GID . 'X', '', $k);
$zongupData[$tmpId] = $v1;
}
return $zongupData;
} }
} }
?> ?>
......
<?php <?php
class UserModel extends Model{
//默认表 class UserModel extends Model
public $trueTableName = "cofool_user"; {
//默认表
//切换表 public $trueTableName = "cofool_user";
public function selTable($table = 'user'){
$TableName = "cofool_".$table; //切换表
$this->trueTableName = $TableName; public function selTable($table = 'user')
} {
//获取用户基本信息 $TableName = "cofool_" . $table;
public function getUserInfo($where = '',$field = "*",$table = 'cofool_user',$limit = ''){ $this->trueTableName = $TableName;
}
$this->trueTableName = $table;
if(!$where){ //获取用户基本信息
$userInfo = $this->field($field)->limit($limit)->order('rand()')->select(); public function getUserInfo($where = '', $field = "*", $table = 'cofool_user', $limit = '')
}else{ {
$userInfo = $this->field($field)->where($where)->limit($limit)->order('rand()')->select();
} $this->trueTableName = $table;
return $userInfo; if (!$where) {
} $userInfo = $this->field($field)->limit($limit)->order('rand()')->select();
//获取用户基本信息 } else {
public function getUserFind($where = '',$field = "*",$table = 'cofool_user'){ $userInfo = $this->field($field)->where($where)->limit($limit)->order('rand()')->select();
}
$this->trueTableName = $table; return $userInfo;
if(!$where){ }
$userInfo = $this->field($field)->find();
}else{ //获取用户基本信息
$userInfo = $this->field($field)->where($where)->find(); public function getUserFind($where = '', $field = "*", $table = 'cofool_user')
} {
return $userInfo;
} $this->trueTableName = $table;
if (!$where) {
public function isMyFriend($userID,$user_id){ $userInfo = $this->field($field)->find();
} else {
if(!$userID || !$user_id){ $userInfo = $this->field($field)->where($where)->find();
return false; }
} return $userInfo;
}
$r = M('Friend')->where(array('user_id'=>$userID,'friend_user_id'=>$user_id))->find(); public function isMyFriend($userID, $user_id)
{
return !empty($r) ? 1 : 0;
if (!$userID || !$user_id) {
} return false;
}
public function isMyConcern($userID,$user_id){
if(!$userID || !$user_id){ $r = M('Friend')->where(array('user_id' => $userID, 'friend_user_id' => $user_id))->find();
return false;
} return !empty($r) ? 1 : 0;
$r = M('Concern')->where(array('concern_user_id'=>$userID,'user_id'=>$user_id))->find(); }
return !empty($r) ? $r['concern_user_id'] : 0; public function isMyConcern($userID, $user_id)
} {
if (!$userID || !$user_id) {
return false;
}
$r = M('Concern')->where(array('concern_user_id' => $userID, 'user_id' => $user_id))->find();
return !empty($r) ? $r['concern_user_id'] : 0;
}
//参赛送1.88元 //参赛送1.88元
public function addMoney($userId,$userName,$mobile){ public function addMoney($userId, $userName, $mobile)
$wallet=M('Wallet')->where(['user_id'=>$userId])->find(); {
if(empty($wallet)){ $wallet = M('Wallet')->where(['user_id' => $userId])->find();
M('Wallet')->add(['user_id'=>$userId,'user_name'=>$userName,'add_time'=>time(),'money'=>1.88]); if (empty($wallet)) {
}else{ M('Wallet')->add(['user_id' => $userId, 'user_name' => $userName, 'add_time' => time(), 'money' => 1.88]);
M('Wallet')->where(['user_id'=>$userId])->setInc('money',1.88); } else {
M('Wallet')->where(['user_id' => $userId])->setInc('money', 1.88);
} }
$addData=['user_id'=>$userId,'user_name'=>$userName,'mobile'=>$mobile, $addData = ['user_id' => $userId, 'user_name' => $userName, 'mobile' => $mobile, 'item_money' => 1.88, 'item_time' => time(), 'group_id' => PRIZE_GROUP_2021, 'status' => 1, 'note' => '【全民分赛场】报名奖励红包'];
'item_money'=>1.88,'item_time'=>time(),'group_id'=>PRIZE_GROUP_2021,'status'=>1,'note'=>'【全民分赛场】报名奖励红包'];
M('WalletItem')->add($addData); M('WalletItem')->add($addData);
} }
//加入邀请表 //加入邀请表
public function addInvite($userIdB,$userNameB){ public function addInvite($userIdB, $userNameB)
$aid=cookie('aid'); {
$aid=$aid?$aid:5420972; $aid = cookie('aid');
if($aid){ $aid = $aid ? $aid : 5420972;
$ucA = uc_get_user(['userId' => $aid,'type' => 3]); if ($aid) {
$ucA = uc_get_user(['userId' => $aid, 'type' => 3]);
$ucDataA = $ucA['data']; $ucDataA = $ucA['data'];
$userNameA=$ucDataA['user_name']; $userNameA = $ucDataA['user_name'];
//检查被邀请人是否被邀请过 //检查被邀请人是否被邀请过
$oldB=M('WalletInvite')->where(['user_id_b'=>$userIdB,'status'=>1,'group_id'=>PRIZE_GROUP_2021])->count();
if($oldB){ $oldB = M('WalletInvite')->where(['user_id_b' => $userIdB, 'status' => 1])->count();
if ($oldB) {
//-1不显示在界面上 //-1不显示在界面上
M('WalletInvite')->add(['user_id_a'=>$aid,'user_name_a'=>$userNameA,'user_id_b'=>$userIdB, M('WalletInvite')->add(['user_id_a' => $aid, 'user_name_a' => $userNameA, 'user_id_b' => $userIdB, 'user_name_b' => $userNameB, 'status' => -1, 'add_time' => time(), 'group_id' => PRIZE_GROUP_2021]);
'user_name_b'=>$userNameB,'status'=>-1,'add_time'=>time(),'group_id'=>PRIZE_GROUP_2021]); } else {
}else{ M('WalletInvite')->where(['user_id_b' => $userIdB, 'status' => 0])->delete();
M('WalletInvite')->where(['user_id_b'=>$userIdB,'status'=>0,'group_id'=>PRIZE_GROUP_2021])->delete();
//status0报名未审核,1审核通过已报名状态 //status0报名未审核,1审核通过已报名状态
M('WalletInvite')->add(['user_id_a'=>$aid,'user_name_a'=>$userNameA,'user_id_b'=>$userIdB, M('WalletInvite')->add(['user_id_a' => $aid, 'user_name_a' => $userNameA, 'user_id_b' => $userIdB, 'user_name_b' => $userNameB, 'status' => 0, 'add_time' => time(), 'group_id' => PRIZE_GROUP_2021]);
'user_name_b'=>$userNameB,'status'=>0,'add_time'=>time(),'group_id'=>PRIZE_GROUP_2021]);
//邀请人加1.88元 //邀请人加1.88元
//被邀请人有交易后再加1.88元 //被邀请人有交易后再加1.88元
...@@ -103,93 +113,98 @@ class UserModel extends Model{ ...@@ -103,93 +113,98 @@ class UserModel extends Model{
} }
//从委托表和历史委托表取委托数据 //从委托表和历史委托表取委托数据
public function getWtList($gInfo,$p=1,$pageSize=10) { public function getWtList($gInfo, $p = 1, $pageSize = 10, $uids = [])
{
// if($userList===0){ // if($userList===0){
// $userList=$this->getUserList($gInfo); // $userList=$this->getUserList($gInfo);
// } // }
$gid=$gInfo['teamid']; $gid = $gInfo['teamid'];
// $phbs=array_column($userList,'new_phb','uid'); // $phbs=array_column($userList,'new_phb','uid');
// var_dump($userList);; // var_dump($userList);;
// var_dump($phbs);exit; // var_dump($phbs);exit;
$db=M()->db(11,getModel($gInfo['web_id'])); $db = M()->db(11, getModel($gInfo['web_id']));
$where=['bz'=>$gid,'status'=>'已成']; $where = ['bz' => $gid, 'status' => '已成'];
if (!empty($uids)) {
$where['userid'] = ['in', $uids];
}
$suffix = D('Userinfo')->getTable($gid); $suffix = D('Userinfo')->getTable($gid);
$hisTable=$suffix?'mncg_archive.hisentrust'.$suffix:'mncg.hisentrust'; $hisTable = $suffix ? 'mncg_archive.hisentrust' . $suffix : 'mncg.hisentrust';
if($suffix){ if ($suffix) {
$entrustList = $db->table($hisTable)->where($where)->order('cj_time desc')->cache(true,3600)->page($p.','.$pageSize)->select(); $entrustList = $db->table($hisTable)->where($where)->order('cj_time desc')->cache(true, 3600)->page($p . ',' . $pageSize)->select();
$total= $db->table($hisTable)->where($where)->cache(true,3600)->count(); $total = $db->table($hisTable)->where($where)->cache(true, 3600)->count();
// $userNum = $db->table($hisTable)->where($where)->cache(true,3600)->count('distinct userid'); // $userNum = $db->table($hisTable)->where($where)->cache(true,3600)->count('distinct userid');
}else{ } else {
if($p == 1){ if ($p == 1) {
$count = $db->table('entrust')->where($where)->count(); $count = $db->table('entrust')->where($where)->count();
$page = ceil($count/$pageSize); $page = ceil($count / $pageSize);
$limit = $count%$pageSize; $limit = $count % $pageSize;
$memcache_data = ['count'=>$count,'page'=>max($page,1),'limit'=>$limit]; $memcache_data = ['count' => $count, 'page' => max($page, 1), 'limit' => $limit];
S($gid.'_part_page',$memcache_data,7200); S($gid . '_part_page', $memcache_data, 7200);
} }
// var_dump('a'.$page);exit; // var_dump('a'.$page);exit;
$cache = S($gid.'_part_page'); $cache = S($gid . '_part_page');
if(isset($cache['count'])){ if (isset($cache['count'])) {
$page = intval($cache['page']); $page = intval($cache['page']);
$limit = intval($cache['limit']); $limit = intval($cache['limit']);
// $count = intval($cache['count']); // $count = intval($cache['count']);
// var_dump($page);exit; // var_dump($page);exit;
if($p<$page){ if ($p < $page) {
$entrustList = $db->table('entrust')->where($where)->order('cj_time desc')->cache(true,60)->page($p.','.$pageSize)->select(); $entrustList = $db->table('entrust')->where($where)->order('cj_time desc')->cache(true, 60)->page($p . ',' . $pageSize)->select();
} }
if($p==$page){ if ($p == $page) {
$entrustList = $db->table('entrust')->where($where)->order('cj_time desc')->cache(true,60)->page($p.','.$pageSize)->select(); $entrustList = $db->table('entrust')->where($where)->order('cj_time desc')->cache(true, 60)->page($p . ',' . $pageSize)->select();
if(empty($entrustList)){ if (empty($entrustList)) {
$entrustList = $db->table($hisTable)->where($where)->order('cj_time desc')->cache(true,60)->page($p.','.$pageSize)->select(); $entrustList = $db->table($hisTable)->where($where)->order('cj_time desc')->cache(true, 60)->page($p . ',' . $pageSize)->select();
}else{ } else {
if($limit){ if ($limit) {
$start=0; $start = 0;
$pageSize= $pageSize-$limit; $pageSize = $pageSize - $limit;
$hisList = $db->table($hisTable)->where($where)->order('cj_time desc')->cache(true,60)->limit($start.','.$pageSize)->select(); $hisList = $db->table($hisTable)->where($where)->order('cj_time desc')->cache(true, 60)->limit($start . ',' . $pageSize)->select();
if(!empty($hisList)){ if (!empty($hisList)) {
$entrustList = array_merge((array)$entrustList,$hisList); $entrustList = array_merge((array)$entrustList, $hisList);
} }
} }
} }
} }
if($p>$page){ if ($p > $page) {
$start=($p-$page)*$pageSize-$limit; $start = ($p - $page) * $pageSize - $limit;
$entrustList = $db->table($hisTable)->where($where)->order('cj_time desc')->cache(true,60)->limit($start.','.$pageSize)->select(); $entrustList = $db->table($hisTable)->where($where)->order('cj_time desc')->cache(true, 60)->limit($start . ',' . $pageSize)->select();
} }
$total= $db->table('entrust')->where($where)->count(); $total = $db->table('entrust')->where($where)->count();
$hisTotal= $db->table($hisTable)->where($where)->cache(true,60)->count(); $hisTotal = $db->table($hisTable)->where($where)->cache(true, 60)->count();
$total=intval($total)+intval($hisTotal); $total = intval($total) + intval($hisTotal);
} }
} }
return [$entrustList,$total?$total:0]; return [$entrustList, $total ? $total : 0];
} }
//完成勋章,只有参赛勋章 //完成勋章,只有参赛勋章
public function finishXunzhang($userId,$userName,$mobile,$xzType) { public function finishXunzhang($userId, $userName, $mobile, $xzType)
$level=M('XunzhangLevel')->where(['user_id'=>$userId])->getField('level'); {
if(!$level){ $level = M('XunzhangLevel')->where(['user_id' => $userId])->getField('level');
if (!$level) {
return; return;
} }
$xzData=M('Xunzhang')->where(['xz_type'=>$xzType])->find(); $xzData = M('Xunzhang')->where(['xz_type' => $xzType])->find();
$xzid=$xzData['xz_id']; $xzid = $xzData['xz_id'];
if($level!=$xzData['xz_level']){ if ($level != $xzData['xz_level']) {
return; return;
} }
$old=M('XunzhangUser')->where(['user_id'=>$userId,'xz_id'=>$xzid])->count(); $old = M('XunzhangUser')->where(['user_id' => $userId, 'xz_id' => $xzid])->count();
if(!$old){ if (!$old) {
$addData=['user_id'=>$userId,'user_name'=>$userName,'xz_id'=>$xzid,'mobile'=>$mobile]; $addData = ['user_id' => $userId, 'user_name' => $userName, 'xz_id' => $xzid, 'mobile' => $mobile];
$addData['add_time']=$addData['finish1_time']=$addData['finish2_time']=time(); $addData['add_time'] = $addData['finish1_time'] = $addData['finish2_time'] = time();
//直接打开百宝箱,防止重复领取1.88元 //直接打开百宝箱,防止重复领取1.88元
$addData['openbox_time']=time(); $addData['openbox_time'] = time();
M('XunzhangUser')->add($addData); M('XunzhangUser')->add($addData);
} }
} }
} }
?> ?>
\ No newline at end of file
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</table> </table>
<span class="list-check-btn username" goTradeInfo='{$vo.goTradeInfo}'>查看</span> <span class="list-check-btn username" goTradeInfo='{$vo.goTradeInfo}'>查看</span>
<div class="team-no"> <div class="team-no">
<span class="team-no-span">成员背景:<span class="c3">大赛排名No.{$vo.phb|default='--'}</span></span> <span class="team-no-span">排名:<span class="c3">{$vo.phb|default='--'}</span></span>
<!-- <lt name="vo.zongup" value="0"><span>总盈利率:<span class="green">{$vo.zongup|default='-'}%</span></span></lt>--> <!-- <lt name="vo.zongup" value="0"><span>总盈利率:<span class="green">{$vo.zongup|default='-'}%</span></span></lt>-->
<!-- <gt name="vo.zongup" value="0"><span>总盈利率:<span class="red">{$vo.zongup|default='-'}%</span></span></gt>--> <!-- <gt name="vo.zongup" value="0"><span>总盈利率:<span class="red">{$vo.zongup|default='-'}%</span></span></gt>-->
<!-- <eq name="vo.zongup" value="0"><span>总盈利率:<span>0.00%</span></span></eq>--> <!-- <eq name="vo.zongup" value="0"><span>总盈利率:<span>0.00%</span></span></eq>-->
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<div class="award-tab-btn"> <div class="award-tab-btn">
<div class="btn "><a href="/PkTop/phbWeek">周奖榜单</a></div> <div class="btn "><a href="/PkTop/phbWeek">周奖榜单</a></div>
<div class="btn active"><a href="/PkTop/phbOther">其它排行</a></div> <div class="btn active"><a href="/PkTop/phbOther">其它排行</a></div>
<div class="btn "><a href="/PkTop/phbTrade">成员动态</a></div> <div class="btn "><a href="/PkTop/phbTrade">成员交易</a></div>
</div> </div>
<div class="award-tab-panel" > <div class="award-tab-panel" >
......
...@@ -53,17 +53,18 @@ ...@@ -53,17 +53,18 @@
<include file="myItem"/> <include file="myItem"/>
<div class="award-cont"> <div class="award-cont">
<div class="award-tab-btn"> <div class="award-tab-btn">
<div class="btn "><a href="/PkTop/phbWeek">周奖榜单</a></div> <div class="btn"><a href="/PkTop/phbWeek">周奖榜单</a></div>
<div class="btn"><a href="/PkTop/phbOther">其它排行</a></div> <div class="btn"><a href="/PkTop/phbOther">其它排行</a></div>
<div class="btn active"><a href="/PkTop/phbTrade">成员动态</a></div> <div class="btn active"><a href="/PkTop/phbTrade">成员交易</a></div>
</div> </div>
<div class="award-tab-panel">
<div class="award-tab-panel" > <div class="item-filter">
<span class="<eq name="order" value="0">active</eq>"><a href="/PkTop/phbTrade?order=0">全部</a></span>
<span class="<eq name="order" value="1">active</eq>"><a href="/PkTop/phbTrade?order=1">只看前100名</a></span>
</div>
<div class="panel-item" id="container" > <div class="panel-item" id="container" >
<include file="itemTrade"/> <include file="itemTrade"/>
</div> </div>
<gt name="count" value="2"> <gt name="count" value="2">
<div style="padding: 10px 15px 0px;text-align:center;font-size: 14px;" <div style="padding: 10px 15px 0px;text-align:center;font-size: 14px;"
currPage="1" totalPage='{$pages}' id="loadBtn"> currPage="1" totalPage='{$pages}' id="loadBtn">
...@@ -72,16 +73,10 @@ ...@@ -72,16 +73,10 @@
<p class="loading l_3" style="display: none;" id="no_content"><span class="txt">没有更多用户了</span></p> <p class="loading l_3" style="display: none;" id="no_content"><span class="txt">没有更多用户了</span></p>
</div> </div>
</gt> </gt>
</div> </div>
</div> </div>
</div>
</div> </div>
</div>
<include file="bottom"/> <include file="bottom"/>
...@@ -119,7 +114,6 @@ ...@@ -119,7 +114,6 @@
//点加载更多按钮 //点加载更多按钮
$(".loading.l_2").click(function(){ $(".loading.l_2").click(function(){
// $(".l_2").hide();
var totalPage = $("#loadBtn").attr("totalPage"); var totalPage = $("#loadBtn").attr("totalPage");
var currPage = $("#loadBtn").attr("currPage"); var currPage = $("#loadBtn").attr("currPage");
...@@ -130,18 +124,14 @@ ...@@ -130,18 +124,14 @@
$(".l_2").hide(); $(".l_2").hide();
$(".l_3").show(); $(".l_3").show();
return; return;
} else {
} }
order='{$order}'; order='{$order}';
$.post('/PkTop/phbTrade',{p:nextPage,'order':order,'debug':'scroll'},function(e){ $.post('/PkTop/phbTrade',{p:nextPage,'order':order,'debug':'scroll'},function(e){
$(".l_1").hide(); $(".l_1").hide();
if(nextPage>=parseInt(totalPage)) { if(nextPage>=parseInt(totalPage)) {
// $(".l_2").hide();
$(".l_3").show(); $(".l_3").show();
lastPage = 1; lastPage = 1;
} else { } else {
// $(".l_2").show();
$(".l_1").show(); $(".l_1").show();
} }
if(e.status == 0) {layer.alert(e.info, 8);return false;} if(e.status == 0) {layer.alert(e.info, 8);return false;}
...@@ -152,7 +142,12 @@ ...@@ -152,7 +142,12 @@
},'json'); },'json');
}); });
$('.item-filter span').each(function(i,obj){
$(obj).click(function(){
$(this).siblings().removeClass('active')
$(this).addClass('active')
})
})
}); });
</script> </script>
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<div class="award-tab-btn"> <div class="award-tab-btn">
<div class="btn active"><a href="/PkTop/phbWeek">周奖榜单</a></div> <div class="btn active"><a href="/PkTop/phbWeek">周奖榜单</a></div>
<div class="btn"><a href="/PkTop/phbOther">其它排行</a></div> <div class="btn"><a href="/PkTop/phbOther">其它排行</a></div>
<div class="btn"><a href="/PkTop/phbTrade">成员动态</a></div> <div class="btn"><a href="/PkTop/phbTrade">成员交易</a></div>
</div> </div>
<div class="award-tab-panel"> <div class="award-tab-panel">
<span class="rule-make">上榜规则:当周收益为正、月周转率>0</span> <span class="rule-make">上榜规则:当周收益为正、月周转率>0</span>
......
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